@fluentui-react-native/experimental-shadow 0.7.0 → 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 +13 -0
- package/lib/Shadow.d.ts +2 -2
- package/lib/Shadow.js +70 -106
- package/lib/Shadow.types.d.ts +5 -5
- package/lib/Shadow.types.js +1 -1
- package/lib/__tests__/Shadow.test.d.ts +1 -1
- package/lib/__tests__/Shadow.test.js +131 -143
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/shadowStyle.d.ts +17 -17
- package/lib/shadowStyle.js +29 -29
- package/lib-commonjs/Shadow.d.ts +2 -2
- package/lib-commonjs/Shadow.js +106 -159
- package/lib-commonjs/Shadow.types.d.ts +5 -5
- package/lib-commonjs/Shadow.types.js +3 -3
- package/lib-commonjs/__tests__/Shadow.test.d.ts +1 -1
- package/lib-commonjs/__tests__/Shadow.test.js +168 -203
- package/lib-commonjs/index.d.ts +1 -1
- package/lib-commonjs/index.js +7 -17
- package/lib-commonjs/shadowStyle.d.ts +17 -17
- package/lib-commonjs/shadowStyle.js +33 -36
- package/package.json +18 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Change Log - @fluentui-react-native/experimental-shadow
|
|
2
2
|
|
|
3
|
+
## 0.7.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 0d6e9c1: chore: migrate to `oxfmt`
|
|
8
|
+
- ac6e7af: Ensure packages have a default export that references the typescript entrypoint and clean up build dependency ordering
|
|
9
|
+
- Updated dependencies [0d6e9c1]
|
|
10
|
+
- Updated dependencies [ac6e7af]
|
|
11
|
+
- @fluentui-react-native/pressable@0.13.1
|
|
12
|
+
- @fluentui-react-native/framework@0.15.1
|
|
13
|
+
- @fluentui-react-native/theme-types@0.44.1
|
|
14
|
+
- @fluentui-react-native/framework-base@0.3.1
|
|
15
|
+
|
|
3
16
|
## 0.7.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
package/lib/Shadow.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ShadowProps } from './Shadow.types';
|
|
2
|
-
export declare const Shadow: import(
|
|
2
|
+
export declare const Shadow: import("@fluentui-react-native/framework-base").FunctionComponent<ShadowProps>;
|
|
3
3
|
export default Shadow;
|
|
4
|
-
//# sourceMappingURL=Shadow.d.ts.map
|
|
4
|
+
//# sourceMappingURL=Shadow.d.ts.map
|
package/lib/Shadow.js
CHANGED
|
@@ -1,123 +1,87 @@
|
|
|
1
|
-
import { Fragment as _Fragment, jsx as _jsx } from
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { View } from 'react-native';
|
|
4
4
|
import { memoize, mergeProps, phasedComponent, directComponent } from '@fluentui-react-native/framework-base';
|
|
5
5
|
import { shadowName } from './Shadow.types';
|
|
6
6
|
import { getShadowTokenStyleSet } from './shadowStyle';
|
|
7
7
|
export const Shadow = phasedComponent((props) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
8
|
+
return directComponent((final) => {
|
|
9
|
+
const { children, ...rest } = final;
|
|
10
|
+
if (!props.shadowToken) {
|
|
11
|
+
return _jsx(_Fragment, { children: children });
|
|
12
|
+
}
|
|
13
|
+
const { style: childStyle, ...restOfChildProps } = children.props;
|
|
14
|
+
const shadowViewStyleProps = getStylePropsForShadowViews(childStyle, props.shadowToken);
|
|
15
|
+
const innerShadowViewProps = mergeProps(restOfChildProps, shadowViewStyleProps.inner);
|
|
16
|
+
const outerShadowViewProps = mergeProps(rest, shadowViewStyleProps.outer);
|
|
17
|
+
const childWithInnerShadow = React.cloneElement(children, innerShadowViewProps);
|
|
18
|
+
return _jsx(View, { ...outerShadowViewProps, children: childWithInnerShadow });
|
|
19
|
+
});
|
|
20
20
|
});
|
|
21
21
|
const getStylePropsForShadowViews = memoize(getStylePropsForShadowViewsWorker);
|
|
22
22
|
function getStylePropsForShadowViewsWorker(childStyleProps = {}, shadowToken) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
const shadowTokenStyleSet = getShadowTokenStyleSet(shadowToken);
|
|
24
|
+
if (__DEV__) {
|
|
25
|
+
if (!childStyleProps.backgroundColor) {
|
|
26
|
+
console.warn('The View that the Shadow is set on must have a background color set');
|
|
27
|
+
}
|
|
27
28
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
borderTopWidth,
|
|
75
|
-
borderWidth,
|
|
76
|
-
padding,
|
|
77
|
-
paddingBottom,
|
|
78
|
-
paddingEnd,
|
|
79
|
-
paddingHorizontal,
|
|
80
|
-
paddingLeft,
|
|
81
|
-
paddingRight,
|
|
82
|
-
paddingStart,
|
|
83
|
-
paddingTop,
|
|
84
|
-
paddingVertical,
|
|
85
|
-
alignItems,
|
|
86
|
-
flexWrap,
|
|
87
|
-
flexDirection,
|
|
88
|
-
...shadowTokenStyleSet.key,
|
|
89
|
-
...restOfChildStyleProps,
|
|
90
|
-
});
|
|
91
|
-
const outerStyle = removeUndefinedProperties({
|
|
92
|
-
margin,
|
|
93
|
-
marginBottom,
|
|
94
|
-
marginEnd,
|
|
95
|
-
marginHorizontal,
|
|
96
|
-
marginLeft,
|
|
97
|
-
marginRight,
|
|
98
|
-
marginStart,
|
|
99
|
-
marginTop,
|
|
100
|
-
marginVertical,
|
|
101
|
-
start,
|
|
102
|
-
end,
|
|
103
|
-
left,
|
|
104
|
-
right,
|
|
105
|
-
top,
|
|
106
|
-
bottom,
|
|
107
|
-
...shadowTokenStyleSet.ambient,
|
|
108
|
-
...restOfChildStyleProps,
|
|
109
|
-
});
|
|
110
|
-
return { inner: { style: innerStyle }, outer: { style: outerStyle } };
|
|
29
|
+
const { borderBottomWidth, borderEndWidth, borderLeftWidth, borderRightWidth, borderStartWidth, borderTopWidth, borderWidth, margin, marginBottom, marginEnd, marginHorizontal, marginLeft, marginRight, marginStart, marginTop, marginVertical, padding, paddingBottom, paddingEnd, paddingHorizontal, paddingLeft, paddingRight, paddingStart, paddingTop, paddingVertical, alignItems, flexWrap, flexDirection, start, end, left, right, top, bottom, ...restOfChildStyleProps } = childStyleProps;
|
|
30
|
+
// Remove undefined properties, otherwise every prop will be added and be set to
|
|
31
|
+
// undefined, which can cause unexpected behaviour with some of the styles
|
|
32
|
+
const innerStyle = removeUndefinedProperties({
|
|
33
|
+
borderBottomWidth,
|
|
34
|
+
borderEndWidth,
|
|
35
|
+
borderLeftWidth,
|
|
36
|
+
borderRightWidth,
|
|
37
|
+
borderStartWidth,
|
|
38
|
+
borderTopWidth,
|
|
39
|
+
borderWidth,
|
|
40
|
+
padding,
|
|
41
|
+
paddingBottom,
|
|
42
|
+
paddingEnd,
|
|
43
|
+
paddingHorizontal,
|
|
44
|
+
paddingLeft,
|
|
45
|
+
paddingRight,
|
|
46
|
+
paddingStart,
|
|
47
|
+
paddingTop,
|
|
48
|
+
paddingVertical,
|
|
49
|
+
alignItems,
|
|
50
|
+
flexWrap,
|
|
51
|
+
flexDirection,
|
|
52
|
+
...shadowTokenStyleSet.key,
|
|
53
|
+
...restOfChildStyleProps,
|
|
54
|
+
});
|
|
55
|
+
const outerStyle = removeUndefinedProperties({
|
|
56
|
+
margin,
|
|
57
|
+
marginBottom,
|
|
58
|
+
marginEnd,
|
|
59
|
+
marginHorizontal,
|
|
60
|
+
marginLeft,
|
|
61
|
+
marginRight,
|
|
62
|
+
marginStart,
|
|
63
|
+
marginTop,
|
|
64
|
+
marginVertical,
|
|
65
|
+
start,
|
|
66
|
+
end,
|
|
67
|
+
left,
|
|
68
|
+
right,
|
|
69
|
+
top,
|
|
70
|
+
bottom,
|
|
71
|
+
...shadowTokenStyleSet.ambient,
|
|
72
|
+
...restOfChildStyleProps,
|
|
73
|
+
});
|
|
74
|
+
return { inner: { style: innerStyle }, outer: { style: outerStyle } };
|
|
111
75
|
}
|
|
112
76
|
function withObjectAssign(object, [key, value]) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
77
|
+
if (value !== undefined) {
|
|
78
|
+
return Object.assign(object, { [key]: value });
|
|
79
|
+
}
|
|
80
|
+
return object;
|
|
117
81
|
}
|
|
118
82
|
const removeUndefinedProperties = (object) => {
|
|
119
|
-
|
|
83
|
+
return Object.entries(object).reduce(withObjectAssign, {});
|
|
120
84
|
};
|
|
121
85
|
Shadow.displayName = shadowName;
|
|
122
86
|
export default Shadow;
|
|
123
|
-
//# sourceMappingURL=Shadow.js.map
|
|
87
|
+
//# sourceMappingURL=Shadow.js.map
|
package/lib/Shadow.types.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { ViewProps } from 'react-native';
|
|
3
3
|
import type { ShadowToken } from '@fluentui-react-native/theme-types';
|
|
4
|
-
export declare const shadowName =
|
|
4
|
+
export declare const shadowName = "Shadow";
|
|
5
5
|
export interface ShadowProps extends ViewProps {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
shadowToken?: ShadowToken;
|
|
7
|
+
/** Exactly one child */
|
|
8
|
+
children: React.ReactElement;
|
|
9
9
|
}
|
|
10
|
-
//# sourceMappingURL=Shadow.types.d.ts.map
|
|
10
|
+
//# sourceMappingURL=Shadow.types.d.ts.map
|
package/lib/Shadow.types.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const shadowName = 'Shadow';
|
|
2
|
-
//# sourceMappingURL=Shadow.types.js.map
|
|
2
|
+
//# sourceMappingURL=Shadow.types.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export {};
|
|
2
|
-
//# sourceMappingURL=Shadow.test.d.ts.map
|
|
2
|
+
//# sourceMappingURL=Shadow.test.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { act } from 'react';
|
|
3
3
|
import { Text, View } from 'react-native';
|
|
4
4
|
import { mergeStyles, useFluentTheme } from '@fluentui-react-native/framework';
|
|
@@ -7,152 +7,140 @@ import * as renderer from 'react-test-renderer';
|
|
|
7
7
|
import { Shadow } from '../Shadow';
|
|
8
8
|
const backgroundColor = { backgroundColor: 'red' };
|
|
9
9
|
const TestShadow = (props) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
shadowToken: theme.shadows[props.depth],
|
|
13
|
-
children: _jsx(View, { style: backgroundColor, children: _jsx(Text, { children: props.displayText }) }),
|
|
14
|
-
});
|
|
10
|
+
const theme = useFluentTheme();
|
|
11
|
+
return (_jsx(Shadow, { shadowToken: theme.shadows[props.depth], children: _jsx(View, { style: backgroundColor, children: _jsx(Text, { children: props.displayText }) }) }));
|
|
15
12
|
};
|
|
16
13
|
const TestPressableWithAndWithoutShadow = () => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
_jsx(View, { children: _jsx(Pressable, { style: backgroundColor }) }),
|
|
22
|
-
],
|
|
23
|
-
});
|
|
14
|
+
const theme = useFluentTheme();
|
|
15
|
+
return (_jsxs(View, { children: [
|
|
16
|
+
_jsx(Shadow, { shadowToken: theme.shadows['shadow16'], children: _jsx(Pressable, { style: backgroundColor }) }), _jsx(View, { children: _jsx(Pressable, { style: backgroundColor }) })
|
|
17
|
+
] }));
|
|
24
18
|
};
|
|
25
19
|
const TestShadowOnChildViewWithProps = (props) => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
shadowToken: theme.shadows['shadow16'],
|
|
29
|
-
children: _jsx(View, {
|
|
30
|
-
style: mergeStyles(props.childViewStyleProps, backgroundColor),
|
|
31
|
-
children: _jsx(Text, { children: JSON.stringify(props.childViewStyleProps) }),
|
|
32
|
-
}),
|
|
33
|
-
});
|
|
20
|
+
const theme = useFluentTheme();
|
|
21
|
+
return (_jsx(Shadow, { shadowToken: theme.shadows['shadow16'], children: _jsx(View, { style: mergeStyles(props.childViewStyleProps, backgroundColor), children: _jsx(Text, { children: JSON.stringify(props.childViewStyleProps) }) }) }));
|
|
34
22
|
};
|
|
35
23
|
describe('Shadow component tests', () => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
24
|
+
beforeAll(() => {
|
|
25
|
+
jest.mock('react-native/Libraries/Utilities/Platform', () => ({
|
|
26
|
+
OS: 'macos',
|
|
27
|
+
select: () => null,
|
|
28
|
+
}));
|
|
29
|
+
});
|
|
30
|
+
it('Shadow (depth=2)', () => {
|
|
31
|
+
let component;
|
|
32
|
+
act(() => {
|
|
33
|
+
component = renderer.create(_jsx(TestShadow, { displayText: "Shadow (depth=2)", depth: "shadow2" }));
|
|
34
|
+
});
|
|
35
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
36
|
+
});
|
|
37
|
+
it('Shadow (depth=4)', () => {
|
|
38
|
+
let component;
|
|
39
|
+
act(() => {
|
|
40
|
+
component = renderer.create(_jsx(TestShadow, { displayText: "Shadow (depth=4)", depth: "shadow4" }));
|
|
41
|
+
});
|
|
42
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
43
|
+
});
|
|
44
|
+
it('Shadow (depth=8)', () => {
|
|
45
|
+
let component;
|
|
46
|
+
act(() => {
|
|
47
|
+
component = renderer.create(_jsx(TestShadow, { displayText: "Shadow (depth=8)", depth: "shadow8" }));
|
|
48
|
+
});
|
|
49
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
50
|
+
});
|
|
51
|
+
it('Shadow (depth=16)', () => {
|
|
52
|
+
let component;
|
|
53
|
+
act(() => {
|
|
54
|
+
component = renderer.create(_jsx(TestShadow, { displayText: "Shadow (depth=16)", depth: "shadow16" }));
|
|
55
|
+
});
|
|
56
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
57
|
+
});
|
|
58
|
+
it('Shadow (depth=28)', () => {
|
|
59
|
+
let component;
|
|
60
|
+
act(() => {
|
|
61
|
+
component = renderer.create(_jsx(TestShadow, { displayText: "Shadow (depth=28)", depth: "shadow28" }));
|
|
62
|
+
});
|
|
63
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
64
|
+
});
|
|
65
|
+
it('Shadow (depth=64)', () => {
|
|
66
|
+
let component;
|
|
67
|
+
act(() => {
|
|
68
|
+
component = renderer.create(_jsx(TestShadow, { displayText: "Shadow (depth=64)", depth: "shadow64" }));
|
|
69
|
+
});
|
|
70
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
71
|
+
});
|
|
72
|
+
it('Brand shadow (depth=2)', () => {
|
|
73
|
+
let component;
|
|
74
|
+
act(() => {
|
|
75
|
+
component = renderer.create(_jsx(TestShadow, { displayText: "Brand shadow (depth=2)", depth: "shadow2brand" }));
|
|
76
|
+
});
|
|
77
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
78
|
+
});
|
|
79
|
+
it('Brand shadow (depth=4)', () => {
|
|
80
|
+
let component;
|
|
81
|
+
act(() => {
|
|
82
|
+
component = renderer.create(_jsx(TestShadow, { displayText: "Brand shadow (depth=4)", depth: "shadow4brand" }));
|
|
83
|
+
});
|
|
84
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
85
|
+
});
|
|
86
|
+
it('Brand shadow (depth=8)', () => {
|
|
87
|
+
let component;
|
|
88
|
+
act(() => {
|
|
89
|
+
component = renderer.create(_jsx(TestShadow, { displayText: "Brand shadow (depth=8)", depth: "shadow8brand" }));
|
|
90
|
+
});
|
|
91
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
92
|
+
});
|
|
93
|
+
it('Brand shadow (depth=16)', () => {
|
|
94
|
+
let component;
|
|
95
|
+
act(() => {
|
|
96
|
+
component = renderer.create(_jsx(TestShadow, { displayText: "Brand shadow (depth=16)", depth: "shadow16brand" }));
|
|
97
|
+
});
|
|
98
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
99
|
+
});
|
|
100
|
+
it('Brand shadow (depth=28)', () => {
|
|
101
|
+
let component;
|
|
102
|
+
act(() => {
|
|
103
|
+
component = renderer.create(_jsx(TestShadow, { displayText: "Brand shadow (depth=28)", depth: "shadow28brand" }));
|
|
104
|
+
});
|
|
105
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
106
|
+
});
|
|
107
|
+
it('Brand shadow (depth=64)', () => {
|
|
108
|
+
let component;
|
|
109
|
+
act(() => {
|
|
110
|
+
component = renderer.create(_jsx(TestShadow, { displayText: "Brand shadow (depth=64)", depth: "shadow64brand" }));
|
|
111
|
+
});
|
|
112
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
113
|
+
});
|
|
114
|
+
it('Pressable that has a shadow vs. pressable without shadow', () => {
|
|
115
|
+
let component;
|
|
116
|
+
act(() => {
|
|
117
|
+
component = renderer.create(_jsx(TestPressableWithAndWithoutShadow, {}));
|
|
118
|
+
});
|
|
119
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
120
|
+
});
|
|
121
|
+
it('Shadow on a child with margin and padding', () => {
|
|
122
|
+
let component;
|
|
123
|
+
act(() => {
|
|
124
|
+
component = renderer.create(_jsx(TestShadowOnChildViewWithProps, { childViewStyleProps: { margin: 2, padding: 2 } }));
|
|
125
|
+
});
|
|
126
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
127
|
+
});
|
|
128
|
+
it('Shadow on a child with border radius', () => {
|
|
129
|
+
let component;
|
|
130
|
+
act(() => {
|
|
131
|
+
component = renderer.create(_jsx(TestShadowOnChildViewWithProps, { childViewStyleProps: { borderRadius: 2 } }));
|
|
132
|
+
});
|
|
133
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
134
|
+
});
|
|
135
|
+
it('Shadow on a child with border width', () => {
|
|
136
|
+
let component;
|
|
137
|
+
act(() => {
|
|
138
|
+
component = renderer.create(_jsx(TestShadowOnChildViewWithProps, { childViewStyleProps: { borderWidth: 2 } }));
|
|
139
|
+
});
|
|
140
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
141
|
+
});
|
|
142
|
+
afterAll(() => {
|
|
143
|
+
jest.unmock('react-native/Libraries/Utilities/Platform');
|
|
144
|
+
});
|
|
157
145
|
});
|
|
158
|
-
//# sourceMappingURL=Shadow.test.js.map
|
|
146
|
+
//# sourceMappingURL=Shadow.test.js.map
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
package/lib/shadowStyle.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import type { ShadowToken } from '@fluentui-react-native/theme-types';
|
|
2
2
|
export declare const getShadowTokenStyleSet: typeof getShadowTokenStyleSetWorker;
|
|
3
3
|
declare function getShadowTokenStyleSetWorker(shadowToken: ShadowToken): {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
key: {
|
|
5
|
+
shadowColor: string;
|
|
6
|
+
shadowOpacity: number;
|
|
7
|
+
shadowRadius: number;
|
|
8
|
+
shadowOffset: {
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
};
|
|
11
12
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
ambient: {
|
|
14
|
+
shadowColor: string;
|
|
15
|
+
shadowOpacity: number;
|
|
16
|
+
shadowRadius: number;
|
|
17
|
+
shadowOffset: {
|
|
18
|
+
width: number;
|
|
19
|
+
height: number;
|
|
20
|
+
};
|
|
20
21
|
};
|
|
21
|
-
};
|
|
22
22
|
};
|
|
23
23
|
export {};
|
|
24
|
-
//# sourceMappingURL=shadowStyle.d.ts.map
|
|
24
|
+
//# sourceMappingURL=shadowStyle.d.ts.map
|