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

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.
@@ -1,216 +1,181 @@
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
- };
15
- }
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;
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 () {
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;
41
24
  };
42
- return ownKeys(o);
25
+ return ownKeys(o);
43
26
  };
44
27
  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;
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;
50
33
  };
51
- })();
52
- Object.defineProperty(exports, '__esModule', { value: true });
53
- const jsx_runtime_1 = require('react/jsx-runtime');
54
- const react_1 = require('react');
55
- const react_native_1 = require('react-native');
56
- const framework_1 = require('@fluentui-react-native/framework');
57
- const pressable_1 = require('@fluentui-react-native/pressable');
58
- const renderer = __importStar(require('react-test-renderer'));
59
- const Shadow_1 = require('../Shadow');
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ const jsx_runtime_1 = require("react/jsx-runtime");
37
+ const react_1 = require("react");
38
+ const react_native_1 = require("react-native");
39
+ const framework_1 = require("@fluentui-react-native/framework");
40
+ const pressable_1 = require("@fluentui-react-native/pressable");
41
+ const renderer = __importStar(require("react-test-renderer"));
42
+ const Shadow_1 = require("../Shadow");
60
43
  const backgroundColor = { backgroundColor: 'red' };
61
44
  const TestShadow = (props) => {
62
- const theme = (0, framework_1.useFluentTheme)();
63
- return jsx_runtime_1.jsx(Shadow_1.Shadow, {
64
- shadowToken: theme.shadows[props.depth],
65
- children: jsx_runtime_1.jsx(react_native_1.View, {
66
- style: backgroundColor,
67
- children: jsx_runtime_1.jsx(react_native_1.Text, { children: props.displayText }),
68
- }),
69
- });
45
+ const theme = (0, framework_1.useFluentTheme)();
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 }) }) }));
70
47
  };
71
48
  const TestPressableWithAndWithoutShadow = () => {
72
- const theme = (0, framework_1.useFluentTheme)();
73
- return jsx_runtime_1.jsxs(react_native_1.View, {
74
- children: [
75
- jsx_runtime_1.jsx(Shadow_1.Shadow, {
76
- shadowToken: theme.shadows['shadow16'],
77
- children: jsx_runtime_1.jsx(pressable_1.Pressable, { style: backgroundColor }),
78
- }),
79
- jsx_runtime_1.jsx(react_native_1.View, { children: jsx_runtime_1.jsx(pressable_1.Pressable, { style: backgroundColor }) }),
80
- ],
81
- });
49
+ const theme = (0, framework_1.useFluentTheme)();
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
+ ] }));
82
53
  };
83
54
  const TestShadowOnChildViewWithProps = (props) => {
84
- const theme = (0, framework_1.useFluentTheme)();
85
- return jsx_runtime_1.jsx(Shadow_1.Shadow, {
86
- shadowToken: theme.shadows['shadow16'],
87
- children: jsx_runtime_1.jsx(react_native_1.View, {
88
- style: (0, framework_1.mergeStyles)(props.childViewStyleProps, backgroundColor),
89
- children: jsx_runtime_1.jsx(react_native_1.Text, { children: JSON.stringify(props.childViewStyleProps) }),
90
- }),
91
- });
55
+ const theme = (0, framework_1.useFluentTheme)();
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) }) }) }));
92
57
  };
93
58
  describe('Shadow component tests', () => {
94
- beforeAll(() => {
95
- jest.mock('react-native/Libraries/Utilities/Platform', () => ({
96
- OS: 'macos',
97
- select: () => null,
98
- }));
99
- });
100
- it('Shadow (depth=2)', () => {
101
- let component;
102
- (0, react_1.act)(() => {
103
- component = renderer.create(jsx_runtime_1.jsx(TestShadow, { displayText: 'Shadow (depth=2)', depth: 'shadow2' }));
104
- });
105
- expect(component.toJSON()).toMatchSnapshot();
106
- });
107
- it('Shadow (depth=4)', () => {
108
- let component;
109
- (0, react_1.act)(() => {
110
- component = renderer.create(jsx_runtime_1.jsx(TestShadow, { displayText: 'Shadow (depth=4)', depth: 'shadow4' }));
111
- });
112
- expect(component.toJSON()).toMatchSnapshot();
113
- });
114
- it('Shadow (depth=8)', () => {
115
- let component;
116
- (0, react_1.act)(() => {
117
- component = renderer.create(jsx_runtime_1.jsx(TestShadow, { displayText: 'Shadow (depth=8)', depth: 'shadow8' }));
118
- });
119
- expect(component.toJSON()).toMatchSnapshot();
120
- });
121
- it('Shadow (depth=16)', () => {
122
- let component;
123
- (0, react_1.act)(() => {
124
- component = renderer.create(jsx_runtime_1.jsx(TestShadow, { displayText: 'Shadow (depth=16)', depth: 'shadow16' }));
125
- });
126
- expect(component.toJSON()).toMatchSnapshot();
127
- });
128
- it('Shadow (depth=28)', () => {
129
- let component;
130
- (0, react_1.act)(() => {
131
- component = renderer.create(jsx_runtime_1.jsx(TestShadow, { displayText: 'Shadow (depth=28)', depth: 'shadow28' }));
132
- });
133
- expect(component.toJSON()).toMatchSnapshot();
134
- });
135
- it('Shadow (depth=64)', () => {
136
- let component;
137
- (0, react_1.act)(() => {
138
- component = renderer.create(jsx_runtime_1.jsx(TestShadow, { displayText: 'Shadow (depth=64)', depth: 'shadow64' }));
139
- });
140
- expect(component.toJSON()).toMatchSnapshot();
141
- });
142
- it('Brand shadow (depth=2)', () => {
143
- let component;
144
- (0, react_1.act)(() => {
145
- component = renderer.create(jsx_runtime_1.jsx(TestShadow, { displayText: 'Brand shadow (depth=2)', depth: 'shadow2brand' }));
146
- });
147
- expect(component.toJSON()).toMatchSnapshot();
148
- });
149
- it('Brand shadow (depth=4)', () => {
150
- let component;
151
- (0, react_1.act)(() => {
152
- component = renderer.create(jsx_runtime_1.jsx(TestShadow, { displayText: 'Brand shadow (depth=4)', depth: 'shadow4brand' }));
153
- });
154
- expect(component.toJSON()).toMatchSnapshot();
155
- });
156
- it('Brand shadow (depth=8)', () => {
157
- let component;
158
- (0, react_1.act)(() => {
159
- component = renderer.create(jsx_runtime_1.jsx(TestShadow, { displayText: 'Brand shadow (depth=8)', depth: 'shadow8brand' }));
160
- });
161
- expect(component.toJSON()).toMatchSnapshot();
162
- });
163
- it('Brand shadow (depth=16)', () => {
164
- let component;
165
- (0, react_1.act)(() => {
166
- component = renderer.create(jsx_runtime_1.jsx(TestShadow, { displayText: 'Brand shadow (depth=16)', depth: 'shadow16brand' }));
167
- });
168
- expect(component.toJSON()).toMatchSnapshot();
169
- });
170
- it('Brand shadow (depth=28)', () => {
171
- let component;
172
- (0, react_1.act)(() => {
173
- component = renderer.create(jsx_runtime_1.jsx(TestShadow, { displayText: 'Brand shadow (depth=28)', depth: 'shadow28brand' }));
174
- });
175
- expect(component.toJSON()).toMatchSnapshot();
176
- });
177
- it('Brand shadow (depth=64)', () => {
178
- let component;
179
- (0, react_1.act)(() => {
180
- component = renderer.create(jsx_runtime_1.jsx(TestShadow, { displayText: 'Brand shadow (depth=64)', depth: 'shadow64brand' }));
181
- });
182
- expect(component.toJSON()).toMatchSnapshot();
183
- });
184
- it('Pressable that has a shadow vs. pressable without shadow', () => {
185
- let component;
186
- (0, react_1.act)(() => {
187
- component = renderer.create(jsx_runtime_1.jsx(TestPressableWithAndWithoutShadow, {}));
188
- });
189
- expect(component.toJSON()).toMatchSnapshot();
190
- });
191
- it('Shadow on a child with margin and padding', () => {
192
- let component;
193
- (0, react_1.act)(() => {
194
- component = renderer.create(jsx_runtime_1.jsx(TestShadowOnChildViewWithProps, { childViewStyleProps: { margin: 2, padding: 2 } }));
195
- });
196
- expect(component.toJSON()).toMatchSnapshot();
197
- });
198
- it('Shadow on a child with border radius', () => {
199
- let component;
200
- (0, react_1.act)(() => {
201
- component = renderer.create(jsx_runtime_1.jsx(TestShadowOnChildViewWithProps, { childViewStyleProps: { borderRadius: 2 } }));
202
- });
203
- expect(component.toJSON()).toMatchSnapshot();
204
- });
205
- it('Shadow on a child with border width', () => {
206
- let component;
207
- (0, react_1.act)(() => {
208
- component = renderer.create(jsx_runtime_1.jsx(TestShadowOnChildViewWithProps, { childViewStyleProps: { borderWidth: 2 } }));
209
- });
210
- expect(component.toJSON()).toMatchSnapshot();
211
- });
212
- afterAll(() => {
213
- jest.unmock('react-native/Libraries/Utilities/Platform');
214
- });
59
+ beforeAll(() => {
60
+ jest.mock('react-native/Libraries/Utilities/Platform', () => ({
61
+ OS: 'macos',
62
+ select: () => null,
63
+ }));
64
+ });
65
+ it('Shadow (depth=2)', () => {
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();
71
+ });
72
+ it('Shadow (depth=4)', () => {
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();
78
+ });
79
+ it('Shadow (depth=8)', () => {
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();
85
+ });
86
+ it('Shadow (depth=16)', () => {
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();
92
+ });
93
+ it('Shadow (depth=28)', () => {
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();
99
+ });
100
+ it('Shadow (depth=64)', () => {
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();
106
+ });
107
+ it('Brand shadow (depth=2)', () => {
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();
113
+ });
114
+ it('Brand shadow (depth=4)', () => {
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();
120
+ });
121
+ it('Brand shadow (depth=8)', () => {
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();
127
+ });
128
+ it('Brand shadow (depth=16)', () => {
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();
134
+ });
135
+ it('Brand shadow (depth=28)', () => {
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();
141
+ });
142
+ it('Brand shadow (depth=64)', () => {
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();
148
+ });
149
+ it('Pressable that has a shadow vs. pressable without shadow', () => {
150
+ let component;
151
+ (0, react_1.act)(() => {
152
+ component = renderer.create(jsx_runtime_1.jsx(TestPressableWithAndWithoutShadow, {}));
153
+ });
154
+ expect(component.toJSON()).toMatchSnapshot();
155
+ });
156
+ it('Shadow on a child with margin and padding', () => {
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();
162
+ });
163
+ it('Shadow on a child with border radius', () => {
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();
169
+ });
170
+ it('Shadow on a child with border width', () => {
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();
176
+ });
177
+ afterAll(() => {
178
+ jest.unmock('react-native/Libraries/Utilities/Platform');
179
+ });
215
180
  });
216
- //# sourceMappingURL=Shadow.test.js.map
181
+ //# sourceMappingURL=Shadow.test.js.map
@@ -1,4 +1,4 @@
1
1
  export { Shadow } from './Shadow';
2
2
  export type { ShadowProps } from './Shadow.types';
3
3
  export { getShadowTokenStyleSet } from './shadowStyle';
4
- //# sourceMappingURL=index.d.ts.map
4
+ //# sourceMappingURL=index.d.ts.map
@@ -1,18 +1,8 @@
1
- 'use strict';
2
- Object.defineProperty(exports, '__esModule', { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getShadowTokenStyleSet = exports.Shadow = void 0;
4
- const Shadow_1 = require('./Shadow');
5
- Object.defineProperty(exports, 'Shadow', {
6
- enumerable: true,
7
- get: function () {
8
- return Shadow_1.Shadow;
9
- },
10
- });
11
- const shadowStyle_1 = require('./shadowStyle');
12
- Object.defineProperty(exports, 'getShadowTokenStyleSet', {
13
- enumerable: true,
14
- get: function () {
15
- return shadowStyle_1.getShadowTokenStyleSet;
16
- },
17
- });
18
- //# sourceMappingURL=index.js.map
4
+ const Shadow_1 = require("./Shadow");
5
+ Object.defineProperty(exports, "Shadow", { enumerable: true, get: function () { return Shadow_1.Shadow; } });
6
+ const shadowStyle_1 = require("./shadowStyle");
7
+ Object.defineProperty(exports, "getShadowTokenStyleSet", { enumerable: true, get: function () { return shadowStyle_1.getShadowTokenStyleSet; } });
8
+ //# sourceMappingURL=index.js.map
@@ -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;
4
+ key: {
5
+ shadowColor: string;
6
+ shadowOpacity: number;
7
+ shadowRadius: number;
8
+ shadowOffset: {
9
+ width: number;
10
+ height: number;
11
+ };
11
12
  };
12
- };
13
- ambient: {
14
- shadowColor: string;
15
- shadowOpacity: number;
16
- shadowRadius: number;
17
- shadowOffset: {
18
- width: number;
19
- height: number;
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
@@ -1,8 +1,8 @@
1
- 'use strict';
2
- Object.defineProperty(exports, '__esModule', { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getShadowTokenStyleSet = void 0;
4
- const react_native_1 = require('react-native');
5
- const framework_1 = require('@fluentui-react-native/framework');
4
+ const react_native_1 = require("react-native");
5
+ const framework_1 = require("@fluentui-react-native/framework");
6
6
  /**
7
7
  * For iOS/macOS, the blur property from the token is not the same as the shadow radius value,
8
8
  * it needs to be divided by 2 to achieve the same effect.
@@ -13,40 +13,37 @@ const appleShadowBlurAdjustment = 0.5;
13
13
  const defaultShadowBlurAdjustment = 1;
14
14
  exports.getShadowTokenStyleSet = (0, framework_1.memoize)(getShadowTokenStyleSetWorker);
15
15
  function getShadowTokenStyleSetWorker(shadowToken) {
16
- const keyShadow = shadowToken.key;
17
- const ambientShadow = shadowToken.ambient;
18
- const shadowBlurAdjustment =
19
- react_native_1.Platform.OS === 'macos' || react_native_1.Platform.OS === 'ios'
20
- ? appleShadowBlurAdjustment
21
- : defaultShadowBlurAdjustment;
22
- return {
23
- key: {
24
- shadowColor: shadowColorFromRGBAColor(keyShadow.color),
25
- shadowOpacity: shadowOpacityFromRGBAColor(keyShadow.color),
26
- shadowRadius: keyShadow.blur * shadowBlurAdjustment,
27
- shadowOffset: {
28
- width: keyShadow.x,
29
- height: keyShadow.y,
30
- },
31
- },
32
- ambient: {
33
- shadowColor: shadowColorFromRGBAColor(ambientShadow.color),
34
- shadowOpacity: shadowOpacityFromRGBAColor(ambientShadow.color),
35
- shadowRadius: ambientShadow.blur * shadowBlurAdjustment,
36
- shadowOffset: {
37
- width: ambientShadow.x,
38
- height: ambientShadow.y,
39
- },
40
- },
41
- };
16
+ const keyShadow = shadowToken.key;
17
+ const ambientShadow = shadowToken.ambient;
18
+ const shadowBlurAdjustment = react_native_1.Platform.OS === 'macos' || react_native_1.Platform.OS === 'ios' ? appleShadowBlurAdjustment : defaultShadowBlurAdjustment;
19
+ return {
20
+ key: {
21
+ shadowColor: shadowColorFromRGBAColor(keyShadow.color),
22
+ shadowOpacity: shadowOpacityFromRGBAColor(keyShadow.color),
23
+ shadowRadius: keyShadow.blur * shadowBlurAdjustment,
24
+ shadowOffset: {
25
+ width: keyShadow.x,
26
+ height: keyShadow.y,
27
+ },
28
+ },
29
+ ambient: {
30
+ shadowColor: shadowColorFromRGBAColor(ambientShadow.color),
31
+ shadowOpacity: shadowOpacityFromRGBAColor(ambientShadow.color),
32
+ shadowRadius: ambientShadow.blur * shadowBlurAdjustment,
33
+ shadowOffset: {
34
+ width: ambientShadow.x,
35
+ height: ambientShadow.y,
36
+ },
37
+ },
38
+ };
42
39
  }
43
40
  const shadowColorFromRGBAColor = (rgbaColor) => {
44
- return rgbaColor.toString().substring(0, 7);
41
+ return rgbaColor.toString().substring(0, 7);
45
42
  };
46
43
  const shadowOpacityFromRGBAColor = (rgbaColor) => {
47
- const opacityAsHex = '0x' + rgbaColor.toString().substring(7);
48
- const opacityAsDecimal = Number(opacityAsHex) / 255.0;
49
- // Round to two decimal places
50
- return Math.round(opacityAsDecimal * 100) / 100;
44
+ const opacityAsHex = '0x' + rgbaColor.toString().substring(7);
45
+ const opacityAsDecimal = Number(opacityAsHex) / 255.0;
46
+ // Round to two decimal places
47
+ return Math.round(opacityAsDecimal * 100) / 100;
51
48
  };
52
- //# sourceMappingURL=shadowStyle.js.map
49
+ //# sourceMappingURL=shadowStyle.js.map
package/package.json CHANGED
@@ -1,68 +1,69 @@
1
1
  {
2
2
  "name": "@fluentui-react-native/experimental-shadow",
3
- "version": "0.7.0",
3
+ "version": "0.7.3",
4
4
  "description": "A cross-platform Shadow component using the Fluent Design System",
5
+ "license": "MIT",
6
+ "author": "",
5
7
  "repository": {
6
8
  "type": "git",
7
9
  "url": "https://github.com/microsoft/fluentui-react-native.git",
8
10
  "directory": "packages/experimental/Shadow"
9
11
  },
10
- "license": "MIT",
11
- "author": "",
12
+ "main": "lib-commonjs/index.js",
13
+ "module": "lib/index.js",
14
+ "types": "lib/index.d.ts",
12
15
  "exports": {
13
16
  ".": {
14
17
  "types": "./lib/index.d.ts",
15
18
  "import": "./lib/index.js",
16
- "require": "./lib-commonjs/index.js"
19
+ "require": "./lib-commonjs/index.js",
20
+ "default": "./src/index.ts"
17
21
  }
18
22
  },
19
- "main": "lib-commonjs/index.js",
20
- "module": "lib/index.js",
21
- "types": "lib/index.d.ts",
22
23
  "scripts": {
23
24
  "build": "fluentui-scripts build",
24
25
  "build-cjs": "tsgo --outDir lib-commonjs",
25
- "build-esm": "tsgo --outDir lib --module esnext --moduleResolution bundler",
26
+ "build-core": "tsgo --outDir lib --module esnext --moduleResolution bundler",
26
27
  "clean": "fluentui-scripts clean",
27
28
  "depcheck": "fluentui-scripts depcheck",
28
- "lint": "fluentui-scripts eslint",
29
+ "format": "fluentui-scripts format",
30
+ "lint": "fluentui-scripts lint",
29
31
  "lint-package": "fluentui-scripts lint-package",
30
- "prettier": "fluentui-scripts prettier",
31
32
  "test": "fluentui-scripts jest",
32
33
  "update-snapshots": "fluentui-scripts jest -u"
33
34
  },
34
35
  "dependencies": {
35
- "@fluentui-react-native/framework": "0.15.0",
36
- "@fluentui-react-native/framework-base": "0.3.0",
37
- "@fluentui-react-native/pressable": "0.13.0",
38
- "@fluentui-react-native/theme-types": "0.44.0"
36
+ "@fluentui-react-native/framework": "0.15.3",
37
+ "@fluentui-react-native/framework-base": "0.3.3",
38
+ "@fluentui-react-native/pressable": "0.13.3",
39
+ "@fluentui-react-native/theme-types": "0.44.3"
39
40
  },
40
41
  "devDependencies": {
41
42
  "@babel/core": "^7.20.0",
42
43
  "@fluentui-react-native/babel-config": "0.1.1",
43
- "@fluentui-react-native/eslint-config-rules": "0.1.1",
44
- "@fluentui-react-native/jest-config": "0.1.1",
44
+ "@fluentui-react-native/jest-config": "0.1.0",
45
45
  "@fluentui-react-native/kit-config": "0.1.2",
46
- "@fluentui-react-native/scripts": "0.1.2",
47
- "@fluentui-react-native/test-tools": "0.1.1",
46
+ "@fluentui-react-native/lint-config-rules": "0.1.3",
47
+ "@fluentui-react-native/scripts": "0.1.0",
48
+ "@fluentui-react-native/test-tools": "0.1.0",
48
49
  "@react-native-community/cli": "^20.0.0",
49
50
  "@react-native-community/cli-platform-android": "^20.0.0",
50
51
  "@react-native-community/cli-platform-ios": "^20.0.0",
51
52
  "@react-native/babel-preset": "^0.81.0",
52
53
  "@react-native/metro-config": "^0.81.0",
53
- "@types/react": "~19.1.0",
54
+ "@types/react": "~19.1.4",
54
55
  "@types/react-test-renderer": "^19.1.0",
55
- "react": "19.1.0",
56
- "react-native": "^0.81.0",
56
+ "react": "19.1.4",
57
+ "react-native": "^0.81.6",
57
58
  "react-native-macos": "^0.81.0",
58
59
  "react-native-windows": "^0.81.0",
59
- "react-test-renderer": "19.1.0"
60
+ "react-test-renderer": "19.1.4"
60
61
  },
61
62
  "peerDependencies": {
62
63
  "@office-iss/react-native-win32": "^0.74.0",
63
- "@types/react": "~18.2.0 || ~19.0.0 || ~19.1.0",
64
- "react": "18.2.0 || 19.0.0 || 19.1.0",
65
- "react-native": "^0.73.0 || ^0.74.0 || ^0.78.0 || ^0.81.0",
64
+ "@types/react": "~18.2.0 || ~19.0.0 || ~19.1.4",
65
+ "react": "18.2.0 || 19.0.0 || 19.1.4",
66
+ "react-native": "^0.73.0 || ^0.74.0 || ^0.78.0 || ^0.81.6",
66
67
  "react-native-macos": "^0.73.0 || ^0.74.0 || ^0.78.0 || ^0.81.0",
67
68
  "react-native-windows": "^0.73.0 || ^0.74.0 || ^0.78.0 || ^0.81.0"
68
69
  },