@fluentui-react-native/experimental-shadow 0.6.19 → 0.7.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 +1 -1
- package/lib/Shadow.d.ts +1 -1
- package/lib/Shadow.d.ts.map +1 -1
- package/lib/Shadow.js +11 -17
- package/lib/Shadow.js.map +1 -1
- package/lib/Shadow.types.d.ts +3 -0
- package/lib/Shadow.types.d.ts.map +1 -1
- package/lib/Shadow.types.js.map +1 -1
- package/lib/__tests__/Shadow.test.js +87 -44
- package/lib/__tests__/Shadow.test.js.map +1 -1
- package/lib/shadowStyle.js.map +1 -1
- package/lib-commonjs/Shadow.d.ts +1 -1
- package/lib-commonjs/Shadow.d.ts.map +1 -1
- package/lib-commonjs/Shadow.js +30 -26
- package/lib-commonjs/Shadow.js.map +1 -1
- package/lib-commonjs/Shadow.types.d.ts +3 -0
- package/lib-commonjs/Shadow.types.d.ts.map +1 -1
- package/lib-commonjs/Shadow.types.js.map +1 -1
- package/lib-commonjs/__tests__/Shadow.test.js +104 -51
- package/lib-commonjs/__tests__/Shadow.test.js.map +1 -1
- package/lib-commonjs/index.js +2 -2
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/shadowStyle.js.map +1 -1
- package/package.json +61 -59
- package/src/Shadow.tsx +8 -17
- package/src/Shadow.types.ts +4 -0
- package/src/__tests__/Shadow.test.tsx +83 -34
- package/src/__tests__/__snapshots__/Shadow.test.tsx.snap +0 -4
|
@@ -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 react_native_1 = require("react-native");
|
|
28
39
|
const framework_1 = require("@fluentui-react-native/framework");
|
|
29
40
|
const pressable_1 = require("@fluentui-react-native/pressable");
|
|
@@ -32,23 +43,17 @@ const Shadow_1 = require("../Shadow");
|
|
|
32
43
|
const backgroundColor = { backgroundColor: 'red' };
|
|
33
44
|
const TestShadow = (props) => {
|
|
34
45
|
const theme = (0, framework_1.useFluentTheme)();
|
|
35
|
-
return (
|
|
36
|
-
React.createElement(react_native_1.View, { style: backgroundColor },
|
|
37
|
-
React.createElement(react_native_1.Text, null, props.displayText))));
|
|
46
|
+
return (jsx_runtime_1.jsx(Shadow_1.Shadow, { shadowToken: theme.shadows[props.depth], children: jsx_runtime_1.jsx(react_native_1.View, { style: backgroundColor, children: jsx_runtime_1.jsx(react_native_1.Text, { children: props.displayText }) }) }));
|
|
38
47
|
};
|
|
39
48
|
const TestPressableWithAndWithoutShadow = () => {
|
|
40
49
|
const theme = (0, framework_1.useFluentTheme)();
|
|
41
|
-
return (
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
React.createElement(react_native_1.View, null,
|
|
45
|
-
React.createElement(pressable_1.Pressable, { style: backgroundColor }))));
|
|
50
|
+
return (jsx_runtime_1.jsxs(react_native_1.View, { children: [
|
|
51
|
+
jsx_runtime_1.jsx(Shadow_1.Shadow, { shadowToken: theme.shadows['shadow16'], children: jsx_runtime_1.jsx(pressable_1.Pressable, { style: backgroundColor }) }), jsx_runtime_1.jsx(react_native_1.View, { children: jsx_runtime_1.jsx(pressable_1.Pressable, { style: backgroundColor }) })
|
|
52
|
+
] }));
|
|
46
53
|
};
|
|
47
54
|
const TestShadowOnChildViewWithProps = (props) => {
|
|
48
55
|
const theme = (0, framework_1.useFluentTheme)();
|
|
49
|
-
return (
|
|
50
|
-
React.createElement(react_native_1.View, { style: (0, framework_1.mergeStyles)(props.childViewStyleProps, backgroundColor) },
|
|
51
|
-
React.createElement(react_native_1.Text, null, JSON.stringify(props.childViewStyleProps)))));
|
|
56
|
+
return (jsx_runtime_1.jsx(Shadow_1.Shadow, { shadowToken: theme.shadows['shadow16'], children: jsx_runtime_1.jsx(react_native_1.View, { style: (0, framework_1.mergeStyles)(props.childViewStyleProps, backgroundColor), children: jsx_runtime_1.jsx(react_native_1.Text, { children: JSON.stringify(props.childViewStyleProps) }) }) }));
|
|
52
57
|
};
|
|
53
58
|
describe('Shadow component tests', () => {
|
|
54
59
|
beforeAll(() => {
|
|
@@ -58,68 +63,116 @@ describe('Shadow component tests', () => {
|
|
|
58
63
|
}));
|
|
59
64
|
});
|
|
60
65
|
it('Shadow (depth=2)', () => {
|
|
61
|
-
|
|
62
|
-
|
|
66
|
+
let component;
|
|
67
|
+
(0, react_1.act)(() => {
|
|
68
|
+
component = renderer.create(jsx_runtime_1.jsx(TestShadow, { displayText: "Shadow (depth=2)", depth: "shadow2" }));
|
|
69
|
+
});
|
|
70
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
63
71
|
});
|
|
64
72
|
it('Shadow (depth=4)', () => {
|
|
65
|
-
|
|
66
|
-
|
|
73
|
+
let component;
|
|
74
|
+
(0, react_1.act)(() => {
|
|
75
|
+
component = renderer.create(jsx_runtime_1.jsx(TestShadow, { displayText: "Shadow (depth=4)", depth: "shadow4" }));
|
|
76
|
+
});
|
|
77
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
67
78
|
});
|
|
68
79
|
it('Shadow (depth=8)', () => {
|
|
69
|
-
|
|
70
|
-
|
|
80
|
+
let component;
|
|
81
|
+
(0, react_1.act)(() => {
|
|
82
|
+
component = renderer.create(jsx_runtime_1.jsx(TestShadow, { displayText: "Shadow (depth=8)", depth: "shadow8" }));
|
|
83
|
+
});
|
|
84
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
71
85
|
});
|
|
72
86
|
it('Shadow (depth=16)', () => {
|
|
73
|
-
|
|
74
|
-
|
|
87
|
+
let component;
|
|
88
|
+
(0, react_1.act)(() => {
|
|
89
|
+
component = renderer.create(jsx_runtime_1.jsx(TestShadow, { displayText: "Shadow (depth=16)", depth: "shadow16" }));
|
|
90
|
+
});
|
|
91
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
75
92
|
});
|
|
76
93
|
it('Shadow (depth=28)', () => {
|
|
77
|
-
|
|
78
|
-
|
|
94
|
+
let component;
|
|
95
|
+
(0, react_1.act)(() => {
|
|
96
|
+
component = renderer.create(jsx_runtime_1.jsx(TestShadow, { displayText: "Shadow (depth=28)", depth: "shadow28" }));
|
|
97
|
+
});
|
|
98
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
79
99
|
});
|
|
80
100
|
it('Shadow (depth=64)', () => {
|
|
81
|
-
|
|
82
|
-
|
|
101
|
+
let component;
|
|
102
|
+
(0, react_1.act)(() => {
|
|
103
|
+
component = renderer.create(jsx_runtime_1.jsx(TestShadow, { displayText: "Shadow (depth=64)", depth: "shadow64" }));
|
|
104
|
+
});
|
|
105
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
83
106
|
});
|
|
84
107
|
it('Brand shadow (depth=2)', () => {
|
|
85
|
-
|
|
86
|
-
|
|
108
|
+
let component;
|
|
109
|
+
(0, react_1.act)(() => {
|
|
110
|
+
component = renderer.create(jsx_runtime_1.jsx(TestShadow, { displayText: "Brand shadow (depth=2)", depth: "shadow2brand" }));
|
|
111
|
+
});
|
|
112
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
87
113
|
});
|
|
88
114
|
it('Brand shadow (depth=4)', () => {
|
|
89
|
-
|
|
90
|
-
|
|
115
|
+
let component;
|
|
116
|
+
(0, react_1.act)(() => {
|
|
117
|
+
component = renderer.create(jsx_runtime_1.jsx(TestShadow, { displayText: "Brand shadow (depth=4)", depth: "shadow4brand" }));
|
|
118
|
+
});
|
|
119
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
91
120
|
});
|
|
92
121
|
it('Brand shadow (depth=8)', () => {
|
|
93
|
-
|
|
94
|
-
|
|
122
|
+
let component;
|
|
123
|
+
(0, react_1.act)(() => {
|
|
124
|
+
component = renderer.create(jsx_runtime_1.jsx(TestShadow, { displayText: "Brand shadow (depth=8)", depth: "shadow8brand" }));
|
|
125
|
+
});
|
|
126
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
95
127
|
});
|
|
96
128
|
it('Brand shadow (depth=16)', () => {
|
|
97
|
-
|
|
98
|
-
|
|
129
|
+
let component;
|
|
130
|
+
(0, react_1.act)(() => {
|
|
131
|
+
component = renderer.create(jsx_runtime_1.jsx(TestShadow, { displayText: "Brand shadow (depth=16)", depth: "shadow16brand" }));
|
|
132
|
+
});
|
|
133
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
99
134
|
});
|
|
100
135
|
it('Brand shadow (depth=28)', () => {
|
|
101
|
-
|
|
102
|
-
|
|
136
|
+
let component;
|
|
137
|
+
(0, react_1.act)(() => {
|
|
138
|
+
component = renderer.create(jsx_runtime_1.jsx(TestShadow, { displayText: "Brand shadow (depth=28)", depth: "shadow28brand" }));
|
|
139
|
+
});
|
|
140
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
103
141
|
});
|
|
104
142
|
it('Brand shadow (depth=64)', () => {
|
|
105
|
-
|
|
106
|
-
|
|
143
|
+
let component;
|
|
144
|
+
(0, react_1.act)(() => {
|
|
145
|
+
component = renderer.create(jsx_runtime_1.jsx(TestShadow, { displayText: "Brand shadow (depth=64)", depth: "shadow64brand" }));
|
|
146
|
+
});
|
|
147
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
107
148
|
});
|
|
108
149
|
it('Pressable that has a shadow vs. pressable without shadow', () => {
|
|
109
|
-
|
|
110
|
-
|
|
150
|
+
let component;
|
|
151
|
+
(0, react_1.act)(() => {
|
|
152
|
+
component = renderer.create(jsx_runtime_1.jsx(TestPressableWithAndWithoutShadow, {}));
|
|
153
|
+
});
|
|
154
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
111
155
|
});
|
|
112
156
|
it('Shadow on a child with margin and padding', () => {
|
|
113
|
-
|
|
114
|
-
|
|
157
|
+
let component;
|
|
158
|
+
(0, react_1.act)(() => {
|
|
159
|
+
component = renderer.create(jsx_runtime_1.jsx(TestShadowOnChildViewWithProps, { childViewStyleProps: { margin: 2, padding: 2 } }));
|
|
160
|
+
});
|
|
161
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
115
162
|
});
|
|
116
163
|
it('Shadow on a child with border radius', () => {
|
|
117
|
-
|
|
118
|
-
|
|
164
|
+
let component;
|
|
165
|
+
(0, react_1.act)(() => {
|
|
166
|
+
component = renderer.create(jsx_runtime_1.jsx(TestShadowOnChildViewWithProps, { childViewStyleProps: { borderRadius: 2 } }));
|
|
167
|
+
});
|
|
168
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
119
169
|
});
|
|
120
170
|
it('Shadow on a child with border width', () => {
|
|
121
|
-
|
|
122
|
-
|
|
171
|
+
let component;
|
|
172
|
+
(0, react_1.act)(() => {
|
|
173
|
+
component = renderer.create(jsx_runtime_1.jsx(TestShadowOnChildViewWithProps, { childViewStyleProps: { borderWidth: 2 } }));
|
|
174
|
+
});
|
|
175
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
123
176
|
});
|
|
124
177
|
afterAll(() => {
|
|
125
178
|
jest.unmock('react-native/Libraries/Utilities/Platform');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Shadow.test.js","sourceRoot":"","sources":["../../src/__tests__/Shadow.test.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Shadow.test.js","sourceRoot":"","sources":["../../src/__tests__/Shadow.test.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,iCAA4B;AAC5B,+CAA0D;AAE1D,gEAA+E;AAC/E,gEAA6D;AAC7D,MAAY,QAAQ,gDAA4B;AAEhD,sCAAmC;AAEnC,MAAM,eAAe,GAAG,EAAE,eAAe,EAAE,KAAK,EAAE,CAAC;AAMnD,MAAM,UAAU,GAA6C,CAAC,KAAsB,EAAE,EAAE,CAAC;IACvF,MAAM,KAAK,GAAG,IAAA,0BAAc,GAAE,CAAC;IAC/B,OAAO,CACL,kBAAC,eAAM,IAAC,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,YAC7C,kBAAC,mBAAI,IAAC,KAAK,EAAE,eAAe,YAC1B,kBAAC,mBAAI,cAAE,KAAK,CAAC,WAAW,GAAQ,GAC3B,GACA,CACV,CAAC;AAAA,CACH,CAAC;AAEF,MAAM,iCAAiC,GAA4B,GAAG,EAAE,CAAC;IACvE,MAAM,KAAK,GAAG,IAAA,0BAAc,GAAE,CAAC;IAC/B,OAAO,CACL,mBAAC,mBAAI;YACH,kBAAC,eAAM,IAAC,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,YAC5C,kBAAC,qBAAS,IAAC,KAAK,EAAE,eAAe,GAAI,GAC9B,EACT,kBAAC,mBAAI,cACH,kBAAC,qBAAS,IAAC,KAAK,EAAE,eAAe,GAAI,GAChC;Y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C;IAEH,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE,CAAC;QAC9C,IAAI,SAAqC,CAAC;QAC1C,IAAA,WAAG,EAAC,GAAG,EAAE,CAAC;YACR,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,kBAAC,8BAA8B,IAAC,mBAAmB,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE,GAAI,CAAC,CAAC;QAAA,CAC1G,CAAC,CAAC;QACH,MAAM,CAAC,SAAU,CAAC,MAAM,EAAE,CAAC,CAAC,eAAe,EAAE,CAAC;IAAA,CAC/C,CAAC,CAAC;IAEH,QAAQ,CAAC,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,MAAM,CAAC,2CAA2C,CAAC,CAAC;IAAA,CAC1D,CAAC,CAAC;AAAA,CACJ,CAAC,CAAC"}
|
package/lib-commonjs/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getShadowTokenStyleSet = exports.Shadow = void 0;
|
|
4
|
-
|
|
4
|
+
const Shadow_1 = require("./Shadow");
|
|
5
5
|
Object.defineProperty(exports, "Shadow", { enumerable: true, get: function () { return Shadow_1.Shadow; } });
|
|
6
|
-
|
|
6
|
+
const shadowStyle_1 = require("./shadowStyle");
|
|
7
7
|
Object.defineProperty(exports, "getShadowTokenStyleSet", { enumerable: true, get: function () { return shadowStyle_1.getShadowTokenStyleSet; } });
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -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,qCAAkC;AAAzB,gGAAA,MAAM,OAAA;AAEf,+CAAuD;AAA9C,qHAAA,sBAAsB,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shadowStyle.js","sourceRoot":"","sources":["../src/shadowStyle.ts"],"names":[],"mappings":";;;AACA,+CAAwC;AAExC,gEAA2D;AAG3D;;;;;GAKG;AACH,MAAM,yBAAyB,GAAG,GAAG,CAAC;AACtC,MAAM,2BAA2B,GAAG,CAAC,CAAC;AAEzB,QAAA,sBAAsB,GAAG,IAAA,mBAAO,EAAC,4BAA4B,CAAC,CAAC;AAE5E,SAAS,4BAA4B,CAAC,WAAwB;
|
|
1
|
+
{"version":3,"file":"shadowStyle.js","sourceRoot":"","sources":["../src/shadowStyle.ts"],"names":[],"mappings":";;;AACA,+CAAwC;AAExC,gEAA2D;AAG3D;;;;;GAKG;AACH,MAAM,yBAAyB,GAAG,GAAG,CAAC;AACtC,MAAM,2BAA2B,GAAG,CAAC,CAAC;AAEzB,QAAA,sBAAsB,GAAG,IAAA,mBAAO,EAAC,4BAA4B,CAAC,CAAC;AAE5E,SAAS,4BAA4B,CAAC,WAAwB,EAAE;IAC9D,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,CAAC;IAClC,MAAM,aAAa,GAAG,WAAW,CAAC,OAAO,CAAC;IAC1C,MAAM,oBAAoB,GAAG,uBAAQ,CAAC,EAAE,KAAK,OAAO,IAAI,uBAAQ,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,2BAA2B,CAAC;IAExI,OAAO;QACL,GAAG,EAAE;YACH,WAAW,EAAE,wBAAwB,CAAC,SAAS,CAAC,KAAK,CAAC;YACtD,aAAa,EAAE,0BAA0B,CAAC,SAAS,CAAC,KAAK,CAAC;YAC1D,YAAY,EAAE,SAAS,CAAC,IAAI,GAAG,oBAAoB;YACnD,YAAY,EAAE;gBACZ,KAAK,EAAE,SAAS,CAAC,CAAC;gBAClB,MAAM,EAAE,SAAS,CAAC,CAAC;aACpB;SACF;QACD,OAAO,EAAE;YACP,WAAW,EAAE,wBAAwB,CAAC,aAAa,CAAC,KAAK,CAAC;YAC1D,aAAa,EAAE,0BAA0B,CAAC,aAAa,CAAC,KAAK,CAAC;YAC9D,YAAY,EAAE,aAAa,CAAC,IAAI,GAAG,oBAAoB;YACvD,YAAY,EAAE;gBACZ,KAAK,EAAE,aAAa,CAAC,CAAC;gBACtB,MAAM,EAAE,aAAa,CAAC,CAAC;aACxB;SACF;KACF,CAAC;AAAA,CACH;AAED,MAAM,wBAAwB,GAAG,CAAC,SAAqB,EAAE,EAAE,CAAC;IAC1D,OAAO,SAAS,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAAA,CAC7C,CAAC;AAEF,MAAM,0BAA0B,GAAG,CAAC,SAAqB,EAAE,EAAE,CAAC;IAC5D,MAAM,YAAY,GAAG,IAAI,GAAG,SAAS,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAC9D,MAAM,gBAAgB,GAAG,MAAM,CAAC,YAAY,CAAC,GAAG,KAAK,CAAC;IAEtD,8BAA8B;IAC9B,OAAO,IAAI,CAAC,KAAK,CAAC,gBAAgB,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;AAAA,CACjD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,79 +1,89 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui-react-native/experimental-shadow",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "A cross-platform Shadow component using the Fluent Design System",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/microsoft/fluentui-react-native.git",
|
|
10
|
+
"directory": "packages/experimental/Shadow"
|
|
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",
|
|
25
|
+
"build-cjs": "tsgo --outDir lib-commonjs",
|
|
26
|
+
"build-core": "tsgo --outDir lib --module esnext --moduleResolution bundler",
|
|
18
27
|
"clean": "fluentui-scripts clean",
|
|
19
28
|
"depcheck": "fluentui-scripts depcheck",
|
|
20
|
-
"just": "fluentui-scripts",
|
|
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/Shadow"
|
|
33
|
+
"update-snapshots": "fluentui-scripts jest -u"
|
|
31
34
|
},
|
|
32
35
|
"dependencies": {
|
|
33
|
-
"@fluentui-react-native/framework": "0.
|
|
34
|
-
"@fluentui-react-native/
|
|
35
|
-
"@fluentui-react-native/
|
|
36
|
+
"@fluentui-react-native/framework": "0.15.1",
|
|
37
|
+
"@fluentui-react-native/framework-base": "0.3.1",
|
|
38
|
+
"@fluentui-react-native/pressable": "0.13.1",
|
|
39
|
+
"@fluentui-react-native/theme-types": "0.44.1"
|
|
36
40
|
},
|
|
37
41
|
"devDependencies": {
|
|
38
42
|
"@babel/core": "^7.20.0",
|
|
39
43
|
"@fluentui-react-native/babel-config": "0.1.1",
|
|
40
|
-
"@fluentui-react-native/eslint-config-rules": "0.1.
|
|
41
|
-
"@fluentui-react-native/jest-config": "0.1.
|
|
42
|
-
"@fluentui-react-native/
|
|
43
|
-
"@fluentui-react-native/
|
|
44
|
-
"@react-native/
|
|
45
|
-
"@react-native/
|
|
46
|
-
"@
|
|
47
|
-
"@
|
|
48
|
-
"react": "
|
|
49
|
-
"react-native": "^0.
|
|
50
|
-
"react
|
|
51
|
-
"react-
|
|
52
|
-
"react
|
|
44
|
+
"@fluentui-react-native/eslint-config-rules": "0.1.2",
|
|
45
|
+
"@fluentui-react-native/jest-config": "0.1.0",
|
|
46
|
+
"@fluentui-react-native/kit-config": "0.1.2",
|
|
47
|
+
"@fluentui-react-native/scripts": "0.1.0",
|
|
48
|
+
"@fluentui-react-native/test-tools": "0.1.0",
|
|
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-windows": "^0.81.0",
|
|
60
|
+
"react-test-renderer": "19.1.0"
|
|
53
61
|
},
|
|
54
62
|
"peerDependencies": {
|
|
55
63
|
"@office-iss/react-native-win32": "^0.74.0",
|
|
56
|
-
"react": "18.2.0",
|
|
57
|
-
"react
|
|
58
|
-
"react-native
|
|
59
|
-
"react-native-
|
|
64
|
+
"@types/react": "~18.2.0 || ~19.0.0 || ~19.1.0",
|
|
65
|
+
"react": "18.2.0 || 19.0.0 || 19.1.0",
|
|
66
|
+
"react-native": "^0.73.0 || ^0.74.0 || ^0.78.0 || ^0.81.0",
|
|
67
|
+
"react-native-macos": "^0.73.0 || ^0.74.0 || ^0.78.0 || ^0.81.0",
|
|
68
|
+
"react-native-windows": "^0.73.0 || ^0.74.0 || ^0.78.0 || ^0.81.0"
|
|
69
|
+
},
|
|
70
|
+
"peerDependenciesMeta": {
|
|
71
|
+
"@office-iss/react-native-win32": {
|
|
72
|
+
"optional": true
|
|
73
|
+
},
|
|
74
|
+
"@types/react": {
|
|
75
|
+
"optional": true
|
|
76
|
+
},
|
|
77
|
+
"react-native-macos": {
|
|
78
|
+
"optional": true
|
|
79
|
+
},
|
|
80
|
+
"react-native-windows": {
|
|
81
|
+
"optional": true
|
|
82
|
+
}
|
|
60
83
|
},
|
|
61
|
-
"author": "",
|
|
62
|
-
"license": "MIT",
|
|
63
84
|
"rnx-kit": {
|
|
64
85
|
"kitType": "library",
|
|
65
86
|
"alignDeps": {
|
|
66
|
-
"presets": [
|
|
67
|
-
"microsoft/react-native"
|
|
68
|
-
],
|
|
69
|
-
"requirements": {
|
|
70
|
-
"development": [
|
|
71
|
-
"react-native@0.74"
|
|
72
|
-
],
|
|
73
|
-
"production": [
|
|
74
|
-
"react-native@0.73 || 0.74"
|
|
75
|
-
]
|
|
76
|
-
},
|
|
77
87
|
"capabilities": [
|
|
78
88
|
"babel-preset-react-native",
|
|
79
89
|
"core",
|
|
@@ -82,19 +92,11 @@
|
|
|
82
92
|
"core-macos",
|
|
83
93
|
"core-windows",
|
|
84
94
|
"react",
|
|
85
|
-
"react-test-renderer"
|
|
95
|
+
"react-test-renderer",
|
|
96
|
+
"tools-core",
|
|
97
|
+
"tools-jest"
|
|
86
98
|
]
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
"peerDependenciesMeta": {
|
|
90
|
-
"@office-iss/react-native-win32": {
|
|
91
|
-
"optional": true
|
|
92
99
|
},
|
|
93
|
-
"react-native-
|
|
94
|
-
"optional": true
|
|
95
|
-
},
|
|
96
|
-
"react-native-windows": {
|
|
97
|
-
"optional": true
|
|
98
|
-
}
|
|
100
|
+
"extends": "@fluentui-react-native/kit-config"
|
|
99
101
|
}
|
|
100
|
-
}
|
|
102
|
+
}
|
package/src/Shadow.tsx
CHANGED
|
@@ -2,39 +2,30 @@ import * as React from 'react';
|
|
|
2
2
|
import type { ViewStyle } from 'react-native';
|
|
3
3
|
import { View } from 'react-native';
|
|
4
4
|
|
|
5
|
-
import { mergeProps,
|
|
6
|
-
import { memoize } from '@fluentui-react-native/framework';
|
|
5
|
+
import { memoize, mergeProps, phasedComponent, directComponent } from '@fluentui-react-native/framework-base';
|
|
7
6
|
import type { ShadowToken } from '@fluentui-react-native/theme-types';
|
|
8
7
|
|
|
9
8
|
import type { ShadowProps } from './Shadow.types';
|
|
10
9
|
import { shadowName } from './Shadow.types';
|
|
11
10
|
import { getShadowTokenStyleSet } from './shadowStyle';
|
|
12
11
|
|
|
13
|
-
export const Shadow =
|
|
14
|
-
return (final: ShadowProps
|
|
12
|
+
export const Shadow = phasedComponent((props: ShadowProps) => {
|
|
13
|
+
return directComponent<ShadowProps>((final: ShadowProps) => {
|
|
14
|
+
const { children, ...rest } = final;
|
|
15
15
|
if (!props.shadowToken) {
|
|
16
16
|
return <>{children}</>;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
const
|
|
20
|
-
const child = childrenArray[0];
|
|
21
|
-
|
|
22
|
-
if (__DEV__) {
|
|
23
|
-
if (childrenArray.length !== 1) {
|
|
24
|
-
console.warn('Shadow must only have one child');
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const { style: childStyle, ...restOfChildProps } = child.props;
|
|
19
|
+
const { style: childStyle, ...restOfChildProps } = children.props as { style?: ViewStyle };
|
|
29
20
|
|
|
30
21
|
const shadowViewStyleProps = getStylePropsForShadowViews(childStyle, props.shadowToken);
|
|
31
22
|
const innerShadowViewProps = mergeProps(restOfChildProps, shadowViewStyleProps.inner);
|
|
32
|
-
const outerShadowViewProps = mergeProps(
|
|
23
|
+
const outerShadowViewProps = mergeProps(rest, shadowViewStyleProps.outer);
|
|
33
24
|
|
|
34
|
-
const childWithInnerShadow = React.cloneElement(
|
|
25
|
+
const childWithInnerShadow = React.cloneElement(children, innerShadowViewProps);
|
|
35
26
|
|
|
36
27
|
return <View {...outerShadowViewProps}>{childWithInnerShadow}</View>;
|
|
37
|
-
};
|
|
28
|
+
});
|
|
38
29
|
});
|
|
39
30
|
|
|
40
31
|
const getStylePropsForShadowViews = memoize(getStylePropsForShadowViewsWorker);
|
package/src/Shadow.types.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type React from 'react';
|
|
1
2
|
import type { ViewProps } from 'react-native';
|
|
2
3
|
|
|
3
4
|
import type { ShadowToken } from '@fluentui-react-native/theme-types';
|
|
@@ -6,4 +7,7 @@ export const shadowName = 'Shadow';
|
|
|
6
7
|
|
|
7
8
|
export interface ShadowProps extends ViewProps {
|
|
8
9
|
shadowToken?: ShadowToken;
|
|
10
|
+
|
|
11
|
+
/** Exactly one child */
|
|
12
|
+
children: React.ReactElement;
|
|
9
13
|
}
|