@fluentui-react-native/experimental-shadow 0.6.19 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/SPEC.md +1 -1
  3. package/lib/Shadow.d.ts +2 -2
  4. package/lib/Shadow.d.ts.map +1 -1
  5. package/lib/Shadow.js +108 -78
  6. package/lib/Shadow.js.map +1 -1
  7. package/lib/Shadow.types.d.ts +6 -3
  8. package/lib/Shadow.types.d.ts.map +1 -1
  9. package/lib/Shadow.types.js +1 -1
  10. package/lib/Shadow.types.js.map +1 -1
  11. package/lib/__tests__/Shadow.test.d.ts +1 -1
  12. package/lib/__tests__/Shadow.test.js +144 -89
  13. package/lib/__tests__/Shadow.test.js.map +1 -1
  14. package/lib/index.d.ts +1 -1
  15. package/lib/index.js +1 -1
  16. package/lib/shadowStyle.d.ts +17 -17
  17. package/lib/shadowStyle.js +29 -29
  18. package/lib/shadowStyle.js.map +1 -1
  19. package/lib-commonjs/Shadow.d.ts +2 -2
  20. package/lib-commonjs/Shadow.d.ts.map +1 -1
  21. package/lib-commonjs/Shadow.js +164 -107
  22. package/lib-commonjs/Shadow.js.map +1 -1
  23. package/lib-commonjs/Shadow.types.d.ts +6 -3
  24. package/lib-commonjs/Shadow.types.d.ts.map +1 -1
  25. package/lib-commonjs/Shadow.types.js +3 -3
  26. package/lib-commonjs/Shadow.types.js.map +1 -1
  27. package/lib-commonjs/__tests__/Shadow.test.d.ts +1 -1
  28. package/lib-commonjs/__tests__/Shadow.test.js +207 -119
  29. package/lib-commonjs/__tests__/Shadow.test.js.map +1 -1
  30. package/lib-commonjs/index.d.ts +1 -1
  31. package/lib-commonjs/index.js +17 -7
  32. package/lib-commonjs/index.js.map +1 -1
  33. package/lib-commonjs/shadowStyle.d.ts +17 -17
  34. package/lib-commonjs/shadowStyle.js +36 -33
  35. package/lib-commonjs/shadowStyle.js.map +1 -1
  36. package/package.json +60 -59
  37. package/src/Shadow.tsx +8 -17
  38. package/src/Shadow.types.ts +4 -0
  39. package/src/__tests__/Shadow.test.tsx +83 -34
  40. package/src/__tests__/__snapshots__/Shadow.test.tsx.snap +0 -4
@@ -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
- key: {
5
- shadowColor: string;
6
- shadowOpacity: number;
7
- shadowRadius: number;
8
- shadowOffset: {
9
- width: number;
10
- height: number;
11
- };
4
+ key: {
5
+ shadowColor: string;
6
+ shadowOpacity: number;
7
+ shadowRadius: number;
8
+ shadowOffset: {
9
+ width: number;
10
+ height: number;
12
11
  };
13
- ambient: {
14
- shadowColor: string;
15
- shadowOpacity: number;
16
- shadowRadius: number;
17
- shadowOffset: {
18
- width: number;
19
- height: number;
20
- };
12
+ };
13
+ ambient: {
14
+ shadowColor: string;
15
+ shadowOpacity: number;
16
+ shadowRadius: number;
17
+ shadowOffset: {
18
+ width: number;
19
+ height: number;
21
20
  };
21
+ };
22
22
  };
23
23
  export {};
24
- //# sourceMappingURL=shadowStyle.d.ts.map
24
+ //# sourceMappingURL=shadowStyle.d.ts.map
@@ -10,37 +10,37 @@ const appleShadowBlurAdjustment = 0.5;
10
10
  const defaultShadowBlurAdjustment = 1;
11
11
  export const getShadowTokenStyleSet = memoize(getShadowTokenStyleSetWorker);
12
12
  function getShadowTokenStyleSetWorker(shadowToken) {
13
- const keyShadow = shadowToken.key;
14
- const ambientShadow = shadowToken.ambient;
15
- const shadowBlurAdjustment = Platform.OS === 'macos' || Platform.OS === 'ios' ? appleShadowBlurAdjustment : defaultShadowBlurAdjustment;
16
- return {
17
- key: {
18
- shadowColor: shadowColorFromRGBAColor(keyShadow.color),
19
- shadowOpacity: shadowOpacityFromRGBAColor(keyShadow.color),
20
- shadowRadius: keyShadow.blur * shadowBlurAdjustment,
21
- shadowOffset: {
22
- width: keyShadow.x,
23
- height: keyShadow.y,
24
- },
25
- },
26
- ambient: {
27
- shadowColor: shadowColorFromRGBAColor(ambientShadow.color),
28
- shadowOpacity: shadowOpacityFromRGBAColor(ambientShadow.color),
29
- shadowRadius: ambientShadow.blur * shadowBlurAdjustment,
30
- shadowOffset: {
31
- width: ambientShadow.x,
32
- height: ambientShadow.y,
33
- },
34
- },
35
- };
13
+ const keyShadow = shadowToken.key;
14
+ const ambientShadow = shadowToken.ambient;
15
+ const shadowBlurAdjustment = Platform.OS === 'macos' || Platform.OS === 'ios' ? appleShadowBlurAdjustment : defaultShadowBlurAdjustment;
16
+ return {
17
+ key: {
18
+ shadowColor: shadowColorFromRGBAColor(keyShadow.color),
19
+ shadowOpacity: shadowOpacityFromRGBAColor(keyShadow.color),
20
+ shadowRadius: keyShadow.blur * shadowBlurAdjustment,
21
+ shadowOffset: {
22
+ width: keyShadow.x,
23
+ height: keyShadow.y,
24
+ },
25
+ },
26
+ ambient: {
27
+ shadowColor: shadowColorFromRGBAColor(ambientShadow.color),
28
+ shadowOpacity: shadowOpacityFromRGBAColor(ambientShadow.color),
29
+ shadowRadius: ambientShadow.blur * shadowBlurAdjustment,
30
+ shadowOffset: {
31
+ width: ambientShadow.x,
32
+ height: ambientShadow.y,
33
+ },
34
+ },
35
+ };
36
36
  }
37
37
  const shadowColorFromRGBAColor = (rgbaColor) => {
38
- return rgbaColor.toString().substring(0, 7);
38
+ return rgbaColor.toString().substring(0, 7);
39
39
  };
40
40
  const shadowOpacityFromRGBAColor = (rgbaColor) => {
41
- const opacityAsHex = '0x' + rgbaColor.toString().substring(7);
42
- const opacityAsDecimal = Number(opacityAsHex) / 255.0;
43
- // Round to two decimal places
44
- return Math.round(opacityAsDecimal * 100) / 100;
41
+ const opacityAsHex = '0x' + rgbaColor.toString().substring(7);
42
+ const opacityAsDecimal = Number(opacityAsHex) / 255.0;
43
+ // Round to two decimal places
44
+ return Math.round(opacityAsDecimal * 100) / 100;
45
45
  };
46
- //# sourceMappingURL=shadowStyle.js.map
46
+ //# sourceMappingURL=shadowStyle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"shadowStyle.js","sourceRoot":"","sources":["../src/shadowStyle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAG3D;;;;;GAKG;AACH,MAAM,yBAAyB,GAAG,GAAG,CAAC;AACtC,MAAM,2BAA2B,GAAG,CAAC,CAAC;AAEtC,MAAM,CAAC,MAAM,sBAAsB,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;AAE5E,SAAS,4BAA4B,CAAC,WAAwB;IAC5D,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,CAAC;IAClC,MAAM,aAAa,GAAG,WAAW,CAAC,OAAO,CAAC;IAC1C,MAAM,oBAAoB,GAAG,QAAQ,CAAC,EAAE,KAAK,OAAO,IAAI,QAAQ,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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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"}
@@ -1,4 +1,4 @@
1
1
  import type { ShadowProps } from './Shadow.types';
2
- export declare const Shadow: import("@fluentui-react-native/framework").ComposableFunction<ShadowProps>;
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
@@ -1 +1 @@
1
- {"version":3,"file":"Shadow.d.ts","sourceRoot":"","sources":["../src/Shadow.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAIlD,eAAO,MAAM,MAAM,4EAyBjB,CAAC;AA6HH,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"Shadow.d.ts","sourceRoot":"","sources":["../src/Shadow.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAIlD,eAAO,MAAM,MAAM,gFAiBjB,CAAC;AA6HH,eAAe,MAAM,CAAC"}
@@ -1,119 +1,176 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.Shadow = void 0;
27
- const React = __importStar(require("react"));
28
- const react_native_1 = require("react-native");
29
- const framework_1 = require("@fluentui-react-native/framework");
30
- const framework_2 = require("@fluentui-react-native/framework");
31
- const Shadow_types_1 = require("./Shadow.types");
32
- const shadowStyle_1 = require("./shadowStyle");
33
- exports.Shadow = (0, framework_1.stagedComponent)((props) => {
34
- return (final, children) => {
35
- if (!props.shadowToken) {
36
- return React.createElement(React.Fragment, null, children);
37
- }
38
- const childrenArray = React.Children.toArray(children);
39
- const child = childrenArray[0];
40
- if (__DEV__) {
41
- if (childrenArray.length !== 1) {
42
- console.warn('Shadow must only have one child');
43
- }
1
+ 'use strict';
2
+ var __createBinding =
3
+ (this && this.__createBinding) ||
4
+ (Object.create
5
+ ? function (o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = {
10
+ enumerable: true,
11
+ get: function () {
12
+ return m[k];
13
+ },
14
+ };
44
15
  }
45
- const { style: childStyle, ...restOfChildProps } = child.props;
46
- const shadowViewStyleProps = getStylePropsForShadowViews(childStyle, props.shadowToken);
47
- const innerShadowViewProps = (0, framework_1.mergeProps)(restOfChildProps, shadowViewStyleProps.inner);
48
- const outerShadowViewProps = (0, framework_1.mergeProps)(final, shadowViewStyleProps.outer);
49
- const childWithInnerShadow = React.cloneElement(child, innerShadowViewProps);
50
- return React.createElement(react_native_1.View, { ...outerShadowViewProps }, childWithInnerShadow);
16
+ Object.defineProperty(o, k2, desc);
17
+ }
18
+ : function (o, m, k, k2) {
19
+ if (k2 === undefined) k2 = k;
20
+ o[k2] = m[k];
21
+ });
22
+ var __setModuleDefault =
23
+ (this && this.__setModuleDefault) ||
24
+ (Object.create
25
+ ? function (o, v) {
26
+ Object.defineProperty(o, 'default', { enumerable: true, value: v });
27
+ }
28
+ : function (o, v) {
29
+ o['default'] = v;
30
+ });
31
+ var __importStar =
32
+ (this && this.__importStar) ||
33
+ (function () {
34
+ var ownKeys = function (o) {
35
+ ownKeys =
36
+ Object.getOwnPropertyNames ||
37
+ function (o) {
38
+ var ar = [];
39
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
40
+ return ar;
41
+ };
42
+ return ownKeys(o);
51
43
  };
44
+ return function (mod) {
45
+ if (mod && mod.__esModule) return mod;
46
+ var result = {};
47
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== 'default') __createBinding(result, mod, k[i]);
48
+ __setModuleDefault(result, mod);
49
+ return result;
50
+ };
51
+ })();
52
+ Object.defineProperty(exports, '__esModule', { value: true });
53
+ exports.Shadow = void 0;
54
+ const jsx_runtime_1 = require('react/jsx-runtime');
55
+ const React = __importStar(require('react'));
56
+ const react_native_1 = require('react-native');
57
+ const framework_base_1 = require('@fluentui-react-native/framework-base');
58
+ const Shadow_types_1 = require('./Shadow.types');
59
+ const shadowStyle_1 = require('./shadowStyle');
60
+ exports.Shadow = (0, framework_base_1.phasedComponent)((props) => {
61
+ return (0, framework_base_1.directComponent)((final) => {
62
+ const { children, ...rest } = final;
63
+ if (!props.shadowToken) {
64
+ return jsx_runtime_1.jsx(jsx_runtime_1.Fragment, { children: children });
65
+ }
66
+ const { style: childStyle, ...restOfChildProps } = children.props;
67
+ const shadowViewStyleProps = getStylePropsForShadowViews(childStyle, props.shadowToken);
68
+ const innerShadowViewProps = (0, framework_base_1.mergeProps)(restOfChildProps, shadowViewStyleProps.inner);
69
+ const outerShadowViewProps = (0, framework_base_1.mergeProps)(rest, shadowViewStyleProps.outer);
70
+ const childWithInnerShadow = React.cloneElement(children, innerShadowViewProps);
71
+ return jsx_runtime_1.jsx(react_native_1.View, { ...outerShadowViewProps, children: childWithInnerShadow });
72
+ });
52
73
  });
53
- const getStylePropsForShadowViews = (0, framework_2.memoize)(getStylePropsForShadowViewsWorker);
74
+ const getStylePropsForShadowViews = (0, framework_base_1.memoize)(getStylePropsForShadowViewsWorker);
54
75
  function getStylePropsForShadowViewsWorker(childStyleProps = {}, shadowToken) {
55
- const shadowTokenStyleSet = (0, shadowStyle_1.getShadowTokenStyleSet)(shadowToken);
56
- if (__DEV__) {
57
- if (!childStyleProps.backgroundColor) {
58
- console.warn('The View that the Shadow is set on must have a background color set');
59
- }
76
+ const shadowTokenStyleSet = (0, shadowStyle_1.getShadowTokenStyleSet)(shadowToken);
77
+ if (__DEV__) {
78
+ if (!childStyleProps.backgroundColor) {
79
+ console.warn('The View that the Shadow is set on must have a background color set');
60
80
  }
61
- 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;
62
- // Remove undefined properties, otherwise every prop will be added and be set to
63
- // undefined, which can cause unexpected behaviour with some of the styles
64
- const innerStyle = removeUndefinedProperties({
65
- borderBottomWidth,
66
- borderEndWidth,
67
- borderLeftWidth,
68
- borderRightWidth,
69
- borderStartWidth,
70
- borderTopWidth,
71
- borderWidth,
72
- padding,
73
- paddingBottom,
74
- paddingEnd,
75
- paddingHorizontal,
76
- paddingLeft,
77
- paddingRight,
78
- paddingStart,
79
- paddingTop,
80
- paddingVertical,
81
- alignItems,
82
- flexWrap,
83
- flexDirection,
84
- ...shadowTokenStyleSet.key,
85
- ...restOfChildStyleProps,
86
- });
87
- const outerStyle = removeUndefinedProperties({
88
- margin,
89
- marginBottom,
90
- marginEnd,
91
- marginHorizontal,
92
- marginLeft,
93
- marginRight,
94
- marginStart,
95
- marginTop,
96
- marginVertical,
97
- start,
98
- end,
99
- left,
100
- right,
101
- top,
102
- bottom,
103
- ...shadowTokenStyleSet.ambient,
104
- ...restOfChildStyleProps,
105
- });
106
- return { inner: { style: innerStyle }, outer: { style: outerStyle } };
81
+ }
82
+ const {
83
+ borderBottomWidth,
84
+ borderEndWidth,
85
+ borderLeftWidth,
86
+ borderRightWidth,
87
+ borderStartWidth,
88
+ borderTopWidth,
89
+ borderWidth,
90
+ margin,
91
+ marginBottom,
92
+ marginEnd,
93
+ marginHorizontal,
94
+ marginLeft,
95
+ marginRight,
96
+ marginStart,
97
+ marginTop,
98
+ marginVertical,
99
+ padding,
100
+ paddingBottom,
101
+ paddingEnd,
102
+ paddingHorizontal,
103
+ paddingLeft,
104
+ paddingRight,
105
+ paddingStart,
106
+ paddingTop,
107
+ paddingVertical,
108
+ alignItems,
109
+ flexWrap,
110
+ flexDirection,
111
+ start,
112
+ end,
113
+ left,
114
+ right,
115
+ top,
116
+ bottom,
117
+ ...restOfChildStyleProps
118
+ } = childStyleProps;
119
+ // Remove undefined properties, otherwise every prop will be added and be set to
120
+ // undefined, which can cause unexpected behaviour with some of the styles
121
+ const innerStyle = removeUndefinedProperties({
122
+ borderBottomWidth,
123
+ borderEndWidth,
124
+ borderLeftWidth,
125
+ borderRightWidth,
126
+ borderStartWidth,
127
+ borderTopWidth,
128
+ borderWidth,
129
+ padding,
130
+ paddingBottom,
131
+ paddingEnd,
132
+ paddingHorizontal,
133
+ paddingLeft,
134
+ paddingRight,
135
+ paddingStart,
136
+ paddingTop,
137
+ paddingVertical,
138
+ alignItems,
139
+ flexWrap,
140
+ flexDirection,
141
+ ...shadowTokenStyleSet.key,
142
+ ...restOfChildStyleProps,
143
+ });
144
+ const outerStyle = removeUndefinedProperties({
145
+ margin,
146
+ marginBottom,
147
+ marginEnd,
148
+ marginHorizontal,
149
+ marginLeft,
150
+ marginRight,
151
+ marginStart,
152
+ marginTop,
153
+ marginVertical,
154
+ start,
155
+ end,
156
+ left,
157
+ right,
158
+ top,
159
+ bottom,
160
+ ...shadowTokenStyleSet.ambient,
161
+ ...restOfChildStyleProps,
162
+ });
163
+ return { inner: { style: innerStyle }, outer: { style: outerStyle } };
107
164
  }
108
165
  function withObjectAssign(object, [key, value]) {
109
- if (value !== undefined) {
110
- return Object.assign(object, { [key]: value });
111
- }
112
- return object;
166
+ if (value !== undefined) {
167
+ return Object.assign(object, { [key]: value });
168
+ }
169
+ return object;
113
170
  }
114
171
  const removeUndefinedProperties = (object) => {
115
- return Object.entries(object).reduce(withObjectAssign, {});
172
+ return Object.entries(object).reduce(withObjectAssign, {});
116
173
  };
117
174
  exports.Shadow.displayName = Shadow_types_1.shadowName;
118
175
  exports.default = exports.Shadow;
119
- //# sourceMappingURL=Shadow.js.map
176
+ //# sourceMappingURL=Shadow.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Shadow.js","sourceRoot":"","sources":["../src/Shadow.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA+B;AAE/B,+CAAoC;AAEpC,gEAA+E;AAC/E,gEAA2D;AAI3D,iDAA4C;AAC5C,+CAAuD;AAE1C,QAAA,MAAM,GAAG,IAAA,2BAAe,EAAC,CAAC,KAAkB,EAAE,EAAE;IAC3D,OAAO,CAAC,KAAkB,EAAE,QAAyB,EAAE,EAAE;QACvD,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE;YACtB,OAAO,0CAAG,QAAQ,CAAI,CAAC;SACxB;QAED,MAAM,aAAa,GAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAyB,CAAC;QAC/E,MAAM,KAAK,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;QAE/B,IAAI,OAAO,EAAE;YACX,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE;gBAC9B,OAAO,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;aACjD;SACF;QAED,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,gBAAgB,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC;QAE/D,MAAM,oBAAoB,GAAG,2BAA2B,CAAC,UAAU,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;QACxF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B;KACzB,CAAC,CAAC;IAEH,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,CAAC;AAAA,CACvE;AAED,SAAS,gBAAgB,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE;IAC9C,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IACjD,CAAC;IAED,OAAO,MAAM,CAAC;AAAA,CACf;AAED,MAAM,yBAAyB,GAAG,CAAC,MAAiB,EAAE,EAAE,CAAC;IACvD,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;AAAA,CAC5D,CAAC;AAEF,QAAA,MAAM,CAAC,WAAW,GAAG,yBAAU,CAAC;kBAEjB,QAAA,MAAM"}
@@ -1,7 +1,10 @@
1
+ import type React from 'react';
1
2
  import type { ViewProps } from 'react-native';
2
3
  import type { ShadowToken } from '@fluentui-react-native/theme-types';
3
- export declare const shadowName = "Shadow";
4
+ export declare const shadowName = 'Shadow';
4
5
  export interface ShadowProps extends ViewProps {
5
- shadowToken?: ShadowToken;
6
+ shadowToken?: ShadowToken;
7
+ /** Exactly one child */
8
+ children: React.ReactElement;
6
9
  }
7
- //# sourceMappingURL=Shadow.types.d.ts.map
10
+ //# sourceMappingURL=Shadow.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Shadow.types.d.ts","sourceRoot":"","sources":["../src/Shadow.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAEtE,eAAO,MAAM,UAAU,WAAW,CAAC;AAEnC,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B"}
1
+ {"version":3,"file":"Shadow.types.d.ts","sourceRoot":"","sources":["../src/Shadow.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAEtE,eAAO,MAAM,UAAU,WAAW,CAAC;AAEnC,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,WAAW,CAAC,EAAE,WAAW,CAAC;IAE1B,wBAAwB;IACxB,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC;CAC9B"}
@@ -1,5 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
3
3
  exports.shadowName = void 0;
4
4
  exports.shadowName = 'Shadow';
5
- //# sourceMappingURL=Shadow.types.js.map
5
+ //# sourceMappingURL=Shadow.types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Shadow.types.js","sourceRoot":"","sources":["../src/Shadow.types.ts"],"names":[],"mappings":";;;AAIa,QAAA,UAAU,GAAG,QAAQ,CAAC"}
1
+ {"version":3,"file":"Shadow.types.js","sourceRoot":"","sources":["../src/Shadow.types.ts"],"names":[],"mappings":";;;AAKa,QAAA,UAAU,GAAG,QAAQ,CAAC"}
@@ -1,2 +1,2 @@
1
1
  export {};
2
- //# sourceMappingURL=Shadow.test.d.ts.map
2
+ //# sourceMappingURL=Shadow.test.d.ts.map