@fluentui-react-native/experimental-shimmer 0.13.20 → 0.14.1
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 +52 -0
- package/SPEC.md +2 -2
- package/lib/Shimmer.d.ts +1 -1
- package/lib/Shimmer.d.ts.map +1 -1
- package/lib/Shimmer.js +15 -16
- package/lib/Shimmer.js.map +1 -1
- package/lib/Shimmer.test.js +16 -12
- package/lib/Shimmer.test.js.map +1 -1
- package/lib/Shimmer.win32.d.ts +1 -1
- package/lib/Shimmer.win32.d.ts.map +1 -1
- package/lib/Shimmer.win32.js +15 -21
- package/lib/Shimmer.win32.js.map +1 -1
- package/lib/ShimmerTokens.android.js.map +1 -1
- package/lib/ShimmerTokens.ios.js.map +1 -1
- package/lib/ShimmerTokens.js.map +1 -1
- package/lib/ShimmerTokens.win32.js.map +1 -1
- package/lib/SvgShapeToPath.js.map +1 -1
- package/lib/Win32ShimmerNativeComponent.d.ts +2 -2
- package/lib/Win32ShimmerNativeComponent.d.ts.map +1 -1
- package/lib/Win32ShimmerNativeComponent.js +2 -2
- package/lib/Win32ShimmerNativeComponent.js.map +1 -1
- package/lib-commonjs/Shimmer.d.ts.map +1 -1
- package/lib-commonjs/Shimmer.js +14 -15
- package/lib-commonjs/Shimmer.js.map +1 -1
- package/lib-commonjs/Shimmer.test.js +33 -19
- package/lib-commonjs/Shimmer.test.js.map +1 -1
- package/lib-commonjs/Shimmer.types.js +1 -1
- package/lib-commonjs/Shimmer.types.js.map +1 -1
- package/lib-commonjs/Shimmer.types.win32.js +1 -1
- package/lib-commonjs/Shimmer.types.win32.js.map +1 -1
- package/lib-commonjs/Shimmer.win32.d.ts.map +1 -1
- package/lib-commonjs/Shimmer.win32.js +20 -26
- package/lib-commonjs/Shimmer.win32.js.map +1 -1
- package/lib-commonjs/ShimmerTokens.android.js.map +1 -1
- package/lib-commonjs/ShimmerTokens.ios.js.map +1 -1
- package/lib-commonjs/ShimmerTokens.js.map +1 -1
- package/lib-commonjs/ShimmerTokens.win32.js.map +1 -1
- package/lib-commonjs/SvgShapeToPath.js +2 -3
- package/lib-commonjs/SvgShapeToPath.js.map +1 -1
- package/lib-commonjs/Win32ShimmerNativeComponent.d.ts +2 -2
- package/lib-commonjs/Win32ShimmerNativeComponent.d.ts.map +1 -1
- package/lib-commonjs/Win32ShimmerNativeComponent.js +2 -5
- package/lib-commonjs/Win32ShimmerNativeComponent.js.map +1 -1
- package/lib-commonjs/index.js +3 -3
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +63 -61
- package/src/Shimmer.test.tsx +16 -13
- package/src/Shimmer.tsx +4 -5
- package/src/Shimmer.win32.tsx +1 -3
- package/src/ShimmerTokens.android.ts +1 -1
- package/src/ShimmerTokens.ios.ts +1 -1
- package/src/ShimmerTokens.ts +1 -1
- package/src/ShimmerTokens.win32.ts +1 -1
- package/src/Win32ShimmerNativeComponent.ts +3 -3
|
@@ -15,15 +15,26 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
const
|
|
36
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
37
|
+
const react_1 = require("react");
|
|
27
38
|
const renderer = __importStar(require("react-test-renderer"));
|
|
28
39
|
const Shimmer_1 = require("./Shimmer");
|
|
29
40
|
function shimmerRects() {
|
|
@@ -58,21 +69,24 @@ function shimmerRects() {
|
|
|
58
69
|
];
|
|
59
70
|
}
|
|
60
71
|
const style = { width: 300, height: 100 };
|
|
72
|
+
// mocks out setTimeout and other timer functions with mock functions, test will fail without this as we're using Animated API
|
|
73
|
+
jest.useFakeTimers();
|
|
61
74
|
describe('Shimmer component tests', () => {
|
|
62
|
-
beforeAll(() => {
|
|
63
|
-
// mocks out setTimeout and other timer functions with mock functions, test will fail without this as we're using Animated API
|
|
64
|
-
jest.useFakeTimers();
|
|
65
|
-
jest.mock('react-native/Libraries/Animated/NativeAnimatedHelper');
|
|
66
|
-
});
|
|
67
75
|
it('Shimmer default', async () => {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
76
|
+
let component;
|
|
77
|
+
(0, react_1.act)(() => {
|
|
78
|
+
component = renderer.create(jsx_runtime_1.jsx(Shimmer_1.Shimmer, { elements: shimmerRects() }));
|
|
79
|
+
});
|
|
80
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
81
|
+
await (0, react_1.act)(async () => null);
|
|
71
82
|
});
|
|
72
83
|
it('Shimmer with style prop', async () => {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
84
|
+
let component;
|
|
85
|
+
(0, react_1.act)(() => {
|
|
86
|
+
component = renderer.create(jsx_runtime_1.jsx(Shimmer_1.Shimmer, { elements: shimmerRects(), style: style }));
|
|
87
|
+
});
|
|
88
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
89
|
+
await (0, react_1.act)(async () => null);
|
|
76
90
|
});
|
|
77
91
|
});
|
|
78
92
|
//# sourceMappingURL=Shimmer.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Shimmer.test.js","sourceRoot":"","sources":["../src/Shimmer.test.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Shimmer.test.js","sourceRoot":"","sources":["../src/Shimmer.test.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAA4B;AAE5B,MAAY,QAAQ,gDAA4B;AAEhD,uCAAoC;AAGpC,SAAS,YAAY,GAAqD;IACxE,OAAO;QACL;YACE,IAAI,EAAE,MAAM;YACZ,aAAa,EAAE,CAAC;YAChB,aAAa,EAAE,CAAC;YAChB,KAAK,EAAE,GAAG;YACV,MAAM,EAAE,EAAE;YACV,CAAC,EAAE,EAAE;YACL,CAAC,EAAE,EAAE;SACN;QACD;YACE,IAAI,EAAE,MAAM;YACZ,aAAa,EAAE,CAAC;YAChB,aAAa,EAAE,CAAC;YAChB,KAAK,EAAE,GAAG;YACV,MAAM,EAAE,EAAE;YACV,CAAC,EAAE,EAAE;YACL,CAAC,EAAE,EAAE;SACN;QACD;YACE,IAAI,EAAE,MAAM;YACZ,aAAa,EAAE,CAAC;YAChB,aAAa,EAAE,CAAC;YAChB,KAAK,EAAE,GAAG;YACV,MAAM,EAAE,EAAE;YACV,CAAC,EAAE,EAAE;YACL,CAAC,EAAE,EAAE;SACN;KACF,CAAC;AAAA,CACH;AAED,MAAM,KAAK,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AAE1C,8HAA8H;AAC9H,IAAI,CAAC,aAAa,EAAE,CAAC;AAErB,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE,CAAC;IACxC,EAAE,CAAC,iBAAiB,EAAE,KAAK,IAAI,EAAE,CAAC;QAChC,IAAI,SAAqC,CAAC;QAC1C,IAAA,WAAG,EAAC,GAAG,EAAE,CAAC;YACR,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,kBAAC,iBAAO,IAAC,QAAQ,EAAE,YAAY,EAAE,GAAI,CAAC,CAAC;QAAA,CACpE,CAAC,CAAC;QACH,MAAM,CAAC,SAAU,CAAC,MAAM,EAAE,CAAC,CAAC,eAAe,EAAE,CAAC;QAC9C,MAAM,IAAA,WAAG,EAAC,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC;IAAA,CAC7B,CAAC,CAAC;IAEH,EAAE,CAAC,yBAAyB,EAAE,KAAK,IAAI,EAAE,CAAC;QACxC,IAAI,SAAqC,CAAC;QAC1C,IAAA,WAAG,EAAC,GAAG,EAAE,CAAC;YACR,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,kBAAC,iBAAO,IAAC,QAAQ,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,KAAK,GAAI,CAAC,CAAC;QAAA,CAClF,CAAC,CAAC;QACH,MAAM,CAAC,SAAU,CAAC,MAAM,EAAE,CAAC,CAAC,eAAe,EAAE,CAAC;QAC9C,MAAM,IAAA,WAAG,EAAC,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC;IAAA,CAC7B,CAAC,CAAC;AAAA,CACJ,CAAC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.shimmerName = void 0;
|
|
4
|
-
|
|
4
|
+
const Shimmer_types_shared_1 = require("./Shimmer.types.shared");
|
|
5
5
|
Object.defineProperty(exports, "shimmerName", { enumerable: true, get: function () { return Shimmer_types_shared_1.shimmerName; } });
|
|
6
6
|
//# sourceMappingURL=Shimmer.types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Shimmer.types.js","sourceRoot":"","sources":["../src/Shimmer.types.ts"],"names":[],"mappings":";;;AASA
|
|
1
|
+
{"version":3,"file":"Shimmer.types.js","sourceRoot":"","sources":["../src/Shimmer.types.ts"],"names":[],"mappings":";;;AASA,iEAAqD;AAA5C,mHAAA,WAAW,OAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.shimmerName = void 0;
|
|
4
|
-
|
|
4
|
+
const Shimmer_types_shared_1 = require("./Shimmer.types.shared");
|
|
5
5
|
Object.defineProperty(exports, "shimmerName", { enumerable: true, get: function () { return Shimmer_types_shared_1.shimmerName; } });
|
|
6
6
|
//# sourceMappingURL=Shimmer.types.win32.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Shimmer.types.win32.js","sourceRoot":"","sources":["../src/Shimmer.types.win32.ts"],"names":[],"mappings":";;;AAKA
|
|
1
|
+
{"version":3,"file":"Shimmer.types.win32.js","sourceRoot":"","sources":["../src/Shimmer.types.win32.ts"],"names":[],"mappings":";;;AAKA,iEAAqD;AAA5C,mHAAA,WAAW,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Shimmer.win32.d.ts","sourceRoot":"","sources":["../src/Shimmer.win32.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"Shimmer.win32.d.ts","sourceRoot":"","sources":["../src/Shimmer.win32.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH,OAAO,KAAK,EAAuB,YAAY,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC1H,YAAY,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,CAAC;AAoFzD,eAAO,MAAM,OAAO,uOAwElB,CAAC"}
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) Microsoft Corporation.
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
* @format
|
|
6
|
-
*/
|
|
7
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
4
|
};
|
|
10
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
6
|
exports.Shimmer = void 0;
|
|
12
|
-
|
|
13
|
-
/**
|
|
7
|
+
const jsx_runtime_1 = require("@fluentui-react-native/framework-base/jsx-runtime");
|
|
8
|
+
/**
|
|
9
|
+
* Copyright (c) Microsoft Corporation.
|
|
10
|
+
* Licensed under the MIT License.
|
|
11
|
+
* @format
|
|
12
|
+
*/
|
|
13
|
+
/** @jsxImportSource @fluentui-react-native/framework-base */
|
|
14
14
|
const react_native_1 = require("react-native");
|
|
15
15
|
const framework_1 = require("@fluentui-react-native/framework");
|
|
16
|
-
const framework_2 = require("@fluentui-react-native/framework");
|
|
17
16
|
const assert_never_1 = require("assert-never");
|
|
18
17
|
const react_native_svg_1 = require("react-native-svg");
|
|
19
18
|
const Shimmer_styling_win32_1 = require("./Shimmer.styling.win32");
|
|
@@ -34,11 +33,9 @@ const clippingMask = (props) => {
|
|
|
34
33
|
viewBox: '0 0 ' + viewBoxWidth + ' ' + viewBoxHeight,
|
|
35
34
|
preserveAspectRatio: 'xMinYMin slice',
|
|
36
35
|
};
|
|
37
|
-
return (
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
(0, framework_2.withSlots)(react_native_svg_1.Path, { d: props.clipPath, clipRule: "evenodd" }))),
|
|
41
|
-
(0, framework_2.withSlots)(react_native_svg_1.Rect, { width: "100%", height: "100%", fill: backgroundColor, clipPath: "url(#shimmerCuts)" })));
|
|
36
|
+
return (jsx_runtime_1.jsxs(react_native_svg_1.Svg, { ...svgProps, children: [
|
|
37
|
+
jsx_runtime_1.jsx(react_native_svg_1.Defs, { children: jsx_runtime_1.jsx(react_native_svg_1.ClipPath, { id: "shimmerCuts", children: jsx_runtime_1.jsx(react_native_svg_1.Path, { d: props.clipPath, clipRule: "evenodd" }) }) }), jsx_runtime_1.jsx(react_native_svg_1.Rect, { width: "100%", height: "100%", fill: backgroundColor, clipPath: "url(#shimmerCuts)" })
|
|
38
|
+
] }));
|
|
42
39
|
};
|
|
43
40
|
const wave = (props) => {
|
|
44
41
|
const { shimmerColor, shimmerColorOpacity, shimmerWaveColor, shimmerWaveColorOpacity, viewBoxHeight, viewBoxWidth } = props;
|
|
@@ -58,24 +55,22 @@ const wave = (props) => {
|
|
|
58
55
|
*/
|
|
59
56
|
if (typeof (0, react_native_1.processColor)(shimmerWaveColor) !== 'object' && typeof (0, react_native_1.processColor)(shimmerColor) !== 'object') {
|
|
60
57
|
// The typical path where the provided shimmer colors are not OpaqueColorValues.
|
|
61
|
-
return (
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
(0, framework_2.withSlots)(react_native_svg_1.Rect, { width: props.shimmerWaveWidth, height: "100%", fill: "url(#gradient)" })));
|
|
58
|
+
return (jsx_runtime_1.jsxs(react_native_svg_1.Svg, { ...svgProps, children: [
|
|
59
|
+
jsx_runtime_1.jsxs(react_native_svg_1.LinearGradient, { id: "gradient", children: [
|
|
60
|
+
jsx_runtime_1.jsx(react_native_svg_1.Stop, { stopColor: shimmerColor, stopOpacity: shimmerColorOpacity }), jsx_runtime_1.jsx(react_native_svg_1.Stop, { offset: "20%", stopColor: shimmerWaveColor, stopOpacity: shimmerWaveColorOpacity }), jsx_runtime_1.jsx(react_native_svg_1.Stop, { offset: "40%", stopColor: shimmerColor, stopOpacity: shimmerColorOpacity })
|
|
61
|
+
] }), jsx_runtime_1.jsx(react_native_svg_1.Rect, { width: props.shimmerWaveWidth, height: "100%", fill: "url(#gradient)" })
|
|
62
|
+
] }));
|
|
67
63
|
}
|
|
68
64
|
else {
|
|
69
65
|
// The unexpected path where either of the provided shimmer colors are OpaqueColorValues.
|
|
70
66
|
// scaleX is used to mimic the gradient occupying 40% of the fill since we don't know the provided width of the
|
|
71
67
|
// shimmer wave.
|
|
72
|
-
return (
|
|
73
|
-
(0, framework_2.withSlots)(react_native_svg_1.Rect, { width: props.shimmerWaveWidth, height: "100%", fill: shimmerWaveColor, fillOpacity: shimmerWaveColorOpacity, scaleX: "0.4" })));
|
|
68
|
+
return (jsx_runtime_1.jsx(react_native_svg_1.Svg, { ...svgProps, children: jsx_runtime_1.jsx(react_native_svg_1.Rect, { width: props.shimmerWaveWidth, height: "100%", fill: shimmerWaveColor, fillOpacity: shimmerWaveColorOpacity, scaleX: "0.4" }) }));
|
|
74
69
|
}
|
|
75
70
|
};
|
|
76
71
|
const waveContainer = (props) => {
|
|
77
72
|
const { shimmerColor, viewBoxHeight, viewBoxWidth } = props;
|
|
78
|
-
return (
|
|
73
|
+
return (jsx_runtime_1.jsx(Win32ShimmerNativeComponent_1.default, { ...props, style: { backgroundColor: shimmerColor, height: viewBoxHeight, width: viewBoxWidth, overflow: 'hidden' } }));
|
|
79
74
|
};
|
|
80
75
|
exports.Shimmer = (0, framework_1.compose)({
|
|
81
76
|
displayName: Shimmer_types_shared_1.shimmerName,
|
|
@@ -131,10 +126,9 @@ exports.Shimmer = (0, framework_1.compose)({
|
|
|
131
126
|
* instead of "clipped around," generating the visual we desire with the linear gradient below the mask.
|
|
132
127
|
*/
|
|
133
128
|
const mergedClipPath = clipPathsAsMask.join(' ').concat('M 0 0 h ' + xMax + ' v ' + yMax + ' h -' + xMax + ' z ');
|
|
134
|
-
return (
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
(0, framework_2.withSlots)(Slots.clippingMask, { clipPath: mergedClipPath, viewBoxHeight: yMax, viewBoxWidth: xMax })));
|
|
129
|
+
return (jsx_runtime_1.jsxs(Slots.root, { ...mergedProps, children: [
|
|
130
|
+
jsx_runtime_1.jsx(Slots.shimmerWaveContainer, { viewBoxHeight: yMax, viewBoxWidth: xMax, children: jsx_runtime_1.jsx(Slots.shimmerWave, { viewBoxHeight: yMax, viewBoxWidth: xMax }) }), jsx_runtime_1.jsx(Slots.clippingMask, { clipPath: mergedClipPath, viewBoxHeight: yMax, viewBoxWidth: xMax })
|
|
131
|
+
] }));
|
|
138
132
|
};
|
|
139
133
|
},
|
|
140
134
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Shimmer.win32.js","sourceRoot":"","sources":["../src/Shimmer.win32.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Shimmer.win32.js","sourceRoot":"","sources":["../src/Shimmer.win32.tsx"],"names":[],"mappings":";;;;;;;AAAA;;;;GAIG;AAEH,6DAA6D;AAC7D,+CAAkD;AAGlD,gEAAuE;AACvE,+CAA2C;AAE3C,uDAAyF;AAEzF,mEAA0D;AAG1D,iEAAqD;AAErD,qDAAgF;AAChF,gGAAqE;AAErE,MAAM,YAAY,GAA+C,CAAC,KAAwB,EAAE,EAAE,CAAC;IAC7F;;;;;;OAMG;IACH,MAAM,EAAE,eAAe,EAAE,aAAa,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;IAC/D,MAAM,QAAQ,GAAa;QACzB,KAAK,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,YAAY,EAAE;QAC3E,OAAO,EAAE,MAAM,GAAG,YAAY,GAAG,GAAG,GAAG,aAAa;QACpD,mBAAmB,EAAE,gBAAgB;KACtC,CAAC;IACF,OAAO,CACL,mBAAC,sBAAG,OAAK,QAAQ;YACf,kBAAC,uBAAI,cACH,kBAAC,2BAAQ,IAAC,EAAE,EAAC,aAAa,YACxB,kBAAC,uBAAI,IAAC,CAAC,EAAE,KAAK,CAAC,QAAQ,EAAE,QAAQ,EAAC,SAAS,GAAG,GACrC,GACN,EAEP,kBAAC,uBAAI,IAAC,KAAK,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,EAAC,IAAI,EAAE,eAAsB,EAAE,QAAQ,EAAC,mBAAmB,GAAG;YAC1F,CACP,CAAC;AAAA,CACH,CAAC;AAEF,MA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L,mBAAC,KAAK,CAAC,IAAI,OAAK,WAAW;oBACzB,kBAAC,KAAK,CAAC,oBAAoB,IAAC,aAAa,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,YACjE,kBAAC,KAAK,CAAC,WAAW,IAAC,aAAa,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,GAAI,GACnC,EAC7B,kBAAC,KAAK,CAAC,YAAY,IAAC,QAAQ,EAAE,cAAc,EAAE,aAAa,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,GAAI;oBAC9E,CACd,CAAC;QAAA,CACH,CAAC;IAAA,CACH;CACF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShimmerTokens.android.js","sourceRoot":"","sources":["../src/ShimmerTokens.android.ts"],"names":[],"mappings":";;;AAGA,qCAA4F;AAGrF,MAAM,oBAAoB,GAAwC,CAAC,KAAY,EAAE,EAAE,CACxF,CAAC;IACC,KAAK,EAAE,4BAAmB;IAC1B,KAAK,EAAE,4BAAmB;IAC1B,QAAQ,EAAE,+BAAsB;IAChC,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,eAAe;IAC1C,mBAAmB,EAAE,CAAC;IACtB,gBAAgB,EAAE,KAAK,CAAC,MAAM,CAAC,eAAe;IAC9C,uBAAuB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"ShimmerTokens.android.js","sourceRoot":"","sources":["../src/ShimmerTokens.android.ts"],"names":[],"mappings":";;;AAGA,qCAA4F;AAGrF,MAAM,oBAAoB,GAAwC,CAAC,KAAY,EAAE,EAAE,CACxF,CAAC;IACC,KAAK,EAAE,4BAAmB;IAC1B,KAAK,EAAE,4BAAmB;IAC1B,QAAQ,EAAE,+BAAsB;IAChC,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,eAAe;IAC1C,mBAAmB,EAAE,CAAC;IACtB,gBAAgB,EAAE,KAAK,CAAC,MAAM,CAAC,eAAe;IAC9C,uBAAuB,EAAE,CAAC;CAC3B,CAAkB,CAAC;AATT,QAAA,oBAAoB,GAApB,oBAAoB,CASX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShimmerTokens.ios.js","sourceRoot":"","sources":["../src/ShimmerTokens.ios.ts"],"names":[],"mappings":";;;AAGA,qCAA4F;AAGrF,MAAM,oBAAoB,GAAwC,CAAC,KAAY,EAAE,EAAE,CACxF,CAAC;IACC,KAAK,EAAE,4BAAmB;IAC1B,KAAK,EAAE,4BAAmB;IAC1B,QAAQ,EAAE,+BAAsB;IAChC,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,eAAe;IAC1C,mBAAmB,EAAE,CAAC;IACtB,gBAAgB,EAAE,KAAK,CAAC,MAAM,CAAC,eAAe;IAC9C,uBAAuB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"ShimmerTokens.ios.js","sourceRoot":"","sources":["../src/ShimmerTokens.ios.ts"],"names":[],"mappings":";;;AAGA,qCAA4F;AAGrF,MAAM,oBAAoB,GAAwC,CAAC,KAAY,EAAE,EAAE,CACxF,CAAC;IACC,KAAK,EAAE,4BAAmB;IAC1B,KAAK,EAAE,4BAAmB;IAC1B,QAAQ,EAAE,+BAAsB;IAChC,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,eAAe;IAC1C,mBAAmB,EAAE,CAAC;IACtB,gBAAgB,EAAE,KAAK,CAAC,MAAM,CAAC,eAAe;IAC9C,uBAAuB,EAAE,CAAC;CAC3B,CAAkB,CAAC;AATT,QAAA,oBAAoB,GAApB,oBAAoB,CASX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShimmerTokens.js","sourceRoot":"","sources":["../src/ShimmerTokens.ts"],"names":[],"mappings":";;;AACA,wEAA4E;AAG5E,qCAA4F;AAGrF,MAAM,oBAAoB,GAAwC,CAAC,KAAY,EAAE,EAAE,CACxF,CAAC;IACC,KAAK,EAAE,4BAAmB;IAC1B,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,qBAAqB;IACnD,KAAK,EAAE,4BAAmB;IAC1B,QAAQ,EAAE,+BAAsB;IAChC,YAAY,EAAE,IAAA,oCAAoB,EAAC,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;IACtG,mBAAmB,EAAE,CAAC;IACtB,gBAAgB,EAAE,IAAA,oCAAoB,EAAC,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO;IACtG,uBAAuB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"ShimmerTokens.js","sourceRoot":"","sources":["../src/ShimmerTokens.ts"],"names":[],"mappings":";;;AACA,wEAA4E;AAG5E,qCAA4F;AAGrF,MAAM,oBAAoB,GAAwC,CAAC,KAAY,EAAE,EAAE,CACxF,CAAC;IACC,KAAK,EAAE,4BAAmB;IAC1B,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,qBAAqB;IACnD,KAAK,EAAE,4BAAmB;IAC1B,QAAQ,EAAE,+BAAsB;IAChC,YAAY,EAAE,IAAA,oCAAoB,EAAC,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;IACtG,mBAAmB,EAAE,CAAC;IACtB,gBAAgB,EAAE,IAAA,oCAAoB,EAAC,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO;IACtG,uBAAuB,EAAE,CAAC;CAC3B,CAAkB,CAAC;AAVT,QAAA,oBAAoB,GAApB,oBAAoB,CAUX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShimmerTokens.win32.js","sourceRoot":"","sources":["../src/ShimmerTokens.win32.ts"],"names":[],"mappings":";;;AAGA,qCAA4F;AAGrF,MAAM,oBAAoB,GAAwC,CAAC,KAAY,EAAE,EAAE,CACxF,CAAC;IACC,KAAK,EAAE,4BAAmB;IAC1B,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,UAAU;IACxC,KAAK,EAAE,4BAAmB;IAC1B,QAAQ,EAAE,+BAAsB;IAChC,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,gBAAgB;IAC3C,mBAAmB,EAAE,CAAC;IACtB,gBAAgB,EAAE,SAAS;IAC3B,uBAAuB,EAAE,CAAC;IAC1B,gBAAgB,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"ShimmerTokens.win32.js","sourceRoot":"","sources":["../src/ShimmerTokens.win32.ts"],"names":[],"mappings":";;;AAGA,qCAA4F;AAGrF,MAAM,oBAAoB,GAAwC,CAAC,KAAY,EAAE,EAAE,CACxF,CAAC;IACC,KAAK,EAAE,4BAAmB;IAC1B,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,UAAU;IACxC,KAAK,EAAE,4BAAmB;IAC1B,QAAQ,EAAE,+BAAsB;IAChC,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,gBAAgB;IAC3C,mBAAmB,EAAE,CAAC;IACtB,gBAAgB,EAAE,SAAS;IAC3B,uBAAuB,EAAE,CAAC;IAC1B,gBAAgB,EAAE,MAAM;CACzB,CAAkB,CAAC;AAXT,QAAA,oBAAoB,GAApB,oBAAoB,CAWX"}
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
* as we only support rounded rects and circles, with a circle being a rounded rect of borderRadius=length/2=width/2.
|
|
15
15
|
*/
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
17
|
+
exports.convertRectToSvgPath = convertRectToSvgPath;
|
|
18
|
+
exports.convertCircleToSvgPath = convertCircleToSvgPath;
|
|
18
19
|
// Note for explicit clarity: length and width represent the full length and width of the rect, and not
|
|
19
20
|
// the straight edge segments (i.e. length - 2*borderRadius).
|
|
20
21
|
// borderRadius[X|Y] cannot be larger than [length/2 or width]/2; it would not be able to connect to the edge
|
|
@@ -140,10 +141,8 @@ function convertRectToSvgPath(rectShape) {
|
|
|
140
141
|
// Extract necessary args and generate the corresponding path for the shape.
|
|
141
142
|
return convertRoundedRectToSvgPath(rectShape.x ? rectShape.x : 0, rectShape.y ? rectShape.y : 0, rectShape.borderRadiusX ? rectShape.borderRadiusX : 0, rectShape.borderRadiusX ? rectShape.borderRadiusY : 0, rectShape.width ? rectShape.width : 100, rectShape.height ? rectShape.height : 16);
|
|
142
143
|
}
|
|
143
|
-
exports.convertRectToSvgPath = convertRectToSvgPath;
|
|
144
144
|
function convertCircleToSvgPath(circleShape) {
|
|
145
145
|
const radius = circleShape.radius ? circleShape.radius : 12;
|
|
146
146
|
return convertRoundedRectToSvgPath(circleShape.cx ? circleShape.cx - circleShape.radius : 12, circleShape.cy ? circleShape.cy - circleShape.radius : 12, radius, radius, radius * 2, radius * 2);
|
|
147
147
|
}
|
|
148
|
-
exports.convertCircleToSvgPath = convertCircleToSvgPath;
|
|
149
148
|
//# sourceMappingURL=SvgShapeToPath.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SvgShapeToPath.js","sourceRoot":"","sources":["../src/SvgShapeToPath.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG
|
|
1
|
+
{"version":3,"file":"SvgShapeToPath.js","sourceRoot":"","sources":["../src/SvgShapeToPath.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;AAIH,uGAAuG;AACvG,6DAA6D;AAE7D,6GAA6G;AAC7G,qFAAqF;AACrF,SAAS,2BAA2B,CAClC,CAAS,EACT,CAAS,EACT,aAAqB,EACrB,aAAqB,EACrB,KAAa,EACb,MAAc,EACN;IACR,6CAA6C;IAC7C,IAAI,aAAa,GAAG,CAAC,GAAG,KAAK,EAAE,CAAC;QAC9B,aAAa,G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CAAuC,WAAiC,EAAU;IAChF,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IAE5D,OAAO,2BAA2B,CAChC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EACzD,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EACzD,MAAM,EACN,MAAM,EACN,MAAM,GAAG,CAAC,EACV,MAAM,GAAG,CAAC,CACX,CAAC;AAAA,CACH"}
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
* @format
|
|
5
5
|
*/
|
|
6
|
-
import type {
|
|
6
|
+
import type { ViewProps } from 'react-native';
|
|
7
7
|
import type { Double } from 'react-native/Libraries/Types/CodegenTypes';
|
|
8
8
|
export interface NativeProps extends ViewProps {
|
|
9
9
|
delay?: Double;
|
|
10
10
|
duration?: Double;
|
|
11
11
|
}
|
|
12
|
-
declare const _default: HostComponent<NativeProps>;
|
|
12
|
+
declare const _default: import("react-native").HostComponent<NativeProps>;
|
|
13
13
|
export default _default;
|
|
14
14
|
//# sourceMappingURL=Win32ShimmerNativeComponent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Win32ShimmerNativeComponent.d.ts","sourceRoot":"","sources":["../src/Win32ShimmerNativeComponent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Win32ShimmerNativeComponent.d.ts","sourceRoot":"","sources":["../src/Win32ShimmerNativeComponent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAGxE,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;;AAED,wBAA+E"}
|
|
@@ -4,10 +4,7 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
* @format
|
|
6
6
|
*/
|
|
7
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
|
-
};
|
|
10
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
const
|
|
12
|
-
exports.default = (0,
|
|
8
|
+
const react_native_1 = require("react-native");
|
|
9
|
+
exports.default = (0, react_native_1.requireNativeComponent)('RCTNativeAnimatedShimmer');
|
|
13
10
|
//# sourceMappingURL=Win32ShimmerNativeComponent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Win32ShimmerNativeComponent.js","sourceRoot":"","sources":["../src/Win32ShimmerNativeComponent.ts"],"names":[],"mappings":";AAAA;;;;GAIG
|
|
1
|
+
{"version":3,"file":"Win32ShimmerNativeComponent.js","sourceRoot":"","sources":["../src/Win32ShimmerNativeComponent.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAKH,+CAAsD;kBAOvC,IAAA,qCAAsB,EAAc,0BAA0B,CAAC"}
|
package/lib-commonjs/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.shimmerDefaultDuration = exports.shimmerDefaultDelay = exports.shimmerDefaultAngle = exports.shimmerName = exports.Shimmer = void 0;
|
|
4
|
-
|
|
4
|
+
const Shimmer_1 = require("./Shimmer");
|
|
5
5
|
Object.defineProperty(exports, "Shimmer", { enumerable: true, get: function () { return Shimmer_1.Shimmer; } });
|
|
6
|
-
|
|
6
|
+
const Shimmer_types_1 = require("./Shimmer.types");
|
|
7
7
|
Object.defineProperty(exports, "shimmerName", { enumerable: true, get: function () { return Shimmer_types_1.shimmerName; } });
|
|
8
|
-
|
|
8
|
+
const consts_1 = require("./consts");
|
|
9
9
|
Object.defineProperty(exports, "shimmerDefaultAngle", { enumerable: true, get: function () { return consts_1.shimmerDefaultAngle; } });
|
|
10
10
|
Object.defineProperty(exports, "shimmerDefaultDelay", { enumerable: true, get: function () { return consts_1.shimmerDefaultDelay; } });
|
|
11
11
|
Object.defineProperty(exports, "shimmerDefaultDuration", { enumerable: true, get: function () { return consts_1.shimmerDefaultDuration; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,uCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,mDAA8C;AAArC,4GAAA,WAAW,OAAA;AAUpB,qCAA4F;AAAnF,6GAAA,mBAAmB,OAAA;AAAE,6GAAA,mBAAmB,OAAA;AAAE,gHAAA,sBAAsB,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,82 +1,92 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui-react-native/experimental-shimmer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.1",
|
|
4
4
|
"description": "A cross-platform Fluent Shimmer component",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/microsoft/fluentui-react-native.git",
|
|
10
|
+
"directory": "packages/experimental/Shimmer"
|
|
11
|
+
},
|
|
5
12
|
"main": "lib-commonjs/index.js",
|
|
6
13
|
"module": "lib/index.js",
|
|
7
|
-
"
|
|
14
|
+
"types": "lib/index.d.ts",
|
|
8
15
|
"exports": {
|
|
9
16
|
".": {
|
|
17
|
+
"types": "./lib/index.d.ts",
|
|
10
18
|
"import": "./lib/index.js",
|
|
11
19
|
"require": "./lib-commonjs/index.js",
|
|
12
|
-
"
|
|
20
|
+
"default": "./src/index.ts"
|
|
13
21
|
}
|
|
14
22
|
},
|
|
15
|
-
"typings": "lib/index.d.ts",
|
|
16
23
|
"scripts": {
|
|
17
24
|
"build": "fluentui-scripts build",
|
|
18
|
-
"
|
|
25
|
+
"build-cjs": "tsgo --outDir lib-commonjs",
|
|
26
|
+
"build-core": "tsgo --outDir lib --module esnext --moduleResolution bundler",
|
|
19
27
|
"clean": "fluentui-scripts clean",
|
|
20
28
|
"depcheck": "fluentui-scripts depcheck",
|
|
21
29
|
"lint": "fluentui-scripts eslint",
|
|
30
|
+
"lint-package": "fluentui-scripts lint-package",
|
|
31
|
+
"format": "fluentui-scripts format",
|
|
22
32
|
"test": "fluentui-scripts jest",
|
|
23
|
-
"update-snapshots": "fluentui-scripts jest -u"
|
|
24
|
-
"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"
|
|
33
|
+
"update-snapshots": "fluentui-scripts jest -u"
|
|
31
34
|
},
|
|
32
35
|
"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.
|
|
36
|
+
"@fluentui-react-native/framework": "0.15.1",
|
|
37
|
+
"@fluentui-react-native/theming-utils": "0.27.1",
|
|
38
|
+
"@fluentui-react-native/tokens": "0.24.1",
|
|
39
|
+
"@fluentui-react-native/use-styling": "0.14.1",
|
|
37
40
|
"assert-never": "^1.2.1"
|
|
38
41
|
},
|
|
39
42
|
"devDependencies": {
|
|
40
43
|
"@babel/core": "^7.20.0",
|
|
41
44
|
"@fluentui-react-native/babel-config": "0.1.1",
|
|
42
|
-
"@fluentui-react-native/eslint-config-rules": "0.1.
|
|
43
|
-
"@fluentui-react-native/
|
|
44
|
-
"@fluentui-react-native/
|
|
45
|
-
"@react-native/
|
|
46
|
-
"@react-native/
|
|
47
|
-
"@
|
|
48
|
-
"@
|
|
49
|
-
"react": "
|
|
50
|
-
"react-native": "^0.
|
|
51
|
-
"react-native-
|
|
52
|
-
"react
|
|
53
|
-
"react-
|
|
54
|
-
"react
|
|
45
|
+
"@fluentui-react-native/eslint-config-rules": "0.1.2",
|
|
46
|
+
"@fluentui-react-native/framework-base": "0.3.1",
|
|
47
|
+
"@fluentui-react-native/jest-config": "0.1.0",
|
|
48
|
+
"@fluentui-react-native/kit-config": "0.1.2",
|
|
49
|
+
"@fluentui-react-native/scripts": "0.1.0",
|
|
50
|
+
"@react-native-community/cli": "^20.0.0",
|
|
51
|
+
"@react-native-community/cli-platform-android": "^20.0.0",
|
|
52
|
+
"@react-native-community/cli-platform-ios": "^20.0.0",
|
|
53
|
+
"@react-native/babel-preset": "^0.81.0",
|
|
54
|
+
"@react-native/metro-config": "^0.81.0",
|
|
55
|
+
"@types/react": "~19.1.0",
|
|
56
|
+
"@types/react-test-renderer": "^19.1.0",
|
|
57
|
+
"react": "19.1.0",
|
|
58
|
+
"react-native": "^0.81.0",
|
|
59
|
+
"react-native-macos": "^0.81.0",
|
|
60
|
+
"react-native-svg": "^15.12.1",
|
|
61
|
+
"react-native-windows": "^0.81.0",
|
|
62
|
+
"react-test-renderer": "19.1.0"
|
|
55
63
|
},
|
|
56
64
|
"peerDependencies": {
|
|
57
65
|
"@office-iss/react-native-win32": "^0.74.0",
|
|
58
|
-
"react": "18.2.0",
|
|
59
|
-
"react
|
|
60
|
-
"react-native
|
|
61
|
-
"react-native-
|
|
62
|
-
"react-native-
|
|
66
|
+
"@types/react": "~18.2.0 || ~19.0.0 || ~19.1.0",
|
|
67
|
+
"react": "18.2.0 || 19.0.0 || 19.1.0",
|
|
68
|
+
"react-native": "^0.73.0 || ^0.74.0 || ^0.78.0 || ^0.81.0",
|
|
69
|
+
"react-native-macos": "^0.73.0 || ^0.74.0 || ^0.78.0 || ^0.81.0",
|
|
70
|
+
"react-native-svg": ">=15.0.0 <15.13.0 || >=15.4.0 <15.13.0 || ^15.11.2 || ^15.12.1",
|
|
71
|
+
"react-native-windows": "^0.73.0 || ^0.74.0 || ^0.78.0 || ^0.81.0"
|
|
72
|
+
},
|
|
73
|
+
"peerDependenciesMeta": {
|
|
74
|
+
"@office-iss/react-native-win32": {
|
|
75
|
+
"optional": true
|
|
76
|
+
},
|
|
77
|
+
"@types/react": {
|
|
78
|
+
"optional": true
|
|
79
|
+
},
|
|
80
|
+
"react-native-macos": {
|
|
81
|
+
"optional": true
|
|
82
|
+
},
|
|
83
|
+
"react-native-windows": {
|
|
84
|
+
"optional": true
|
|
85
|
+
}
|
|
63
86
|
},
|
|
64
|
-
"author": "",
|
|
65
|
-
"license": "MIT",
|
|
66
87
|
"rnx-kit": {
|
|
67
88
|
"kitType": "library",
|
|
68
89
|
"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
90
|
"capabilities": [
|
|
81
91
|
"babel-preset-react-native",
|
|
82
92
|
"core",
|
|
@@ -84,20 +94,12 @@
|
|
|
84
94
|
"core-ios",
|
|
85
95
|
"core-macos",
|
|
86
96
|
"core-windows",
|
|
97
|
+
"react-test-renderer",
|
|
87
98
|
"svg",
|
|
88
|
-
"
|
|
99
|
+
"tools-core",
|
|
100
|
+
"tools-jest"
|
|
89
101
|
]
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
"peerDependenciesMeta": {
|
|
93
|
-
"@office-iss/react-native-win32": {
|
|
94
|
-
"optional": true
|
|
95
102
|
},
|
|
96
|
-
"react-native-
|
|
97
|
-
"optional": true
|
|
98
|
-
},
|
|
99
|
-
"react-native-windows": {
|
|
100
|
-
"optional": true
|
|
101
|
-
}
|
|
103
|
+
"extends": "@fluentui-react-native/kit-config"
|
|
102
104
|
}
|
|
103
|
-
}
|
|
105
|
+
}
|
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,13 +21,13 @@ 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(
|
|
29
28
|
() => ({
|
|
30
29
|
angle: props.angle ? props.angle : tokens['angle'],
|
|
31
|
-
backgroundColor: props?.style?.['backgroundColor'] ? props?.style['backgroundColor'] : tokens['backgroundColor'] ?? 'transparent',
|
|
30
|
+
backgroundColor: props?.style?.['backgroundColor'] ? props?.style['backgroundColor'] : (tokens['backgroundColor'] ?? 'transparent'),
|
|
32
31
|
containerBorderRadius: props?.style?.['borderRadius'] ? props?.style['borderRadius'] : 0,
|
|
33
32
|
containerWidth: props?.style?.['width'] ? props?.style['width'] : '100%',
|
|
34
33
|
containerHeight: props?.style?.['height'] ? props?.style['height'] : '100%',
|