@fluentui-react-native/use-styling 0.13.11 → 0.14.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.
- package/CHANGELOG.json +15 -0
- package/CHANGELOG.md +46 -1
- package/README.md +1 -1
- package/babel.config.js +1 -1
- package/lib/buildProps.d.ts +14 -6
- package/lib/buildProps.js +28 -24
- package/lib/buildProps.js.map +1 -1
- package/lib/buildProps.test.d.ts +1 -1
- package/lib/buildProps.test.js +28 -28
- package/lib/buildProps.test.js.map +1 -1
- package/lib/buildUseStyling.d.ts +30 -27
- package/lib/buildUseStyling.js +30 -31
- package/lib/buildUseStyling.js.map +1 -1
- package/lib/buildUseStyling.test.d.ts +1 -1
- package/lib/buildUseStyling.test.js +67 -64
- package/lib/buildUseStyling.test.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/useStyling.samples.test.d.ts +1 -1
- package/lib/useStyling.samples.test.js +171 -148
- package/lib/useStyling.samples.test.js.map +1 -1
- package/lib-commonjs/buildProps.d.ts +14 -6
- package/lib-commonjs/buildProps.js +32 -29
- package/lib-commonjs/buildProps.js.map +1 -1
- package/lib-commonjs/buildProps.test.d.ts +1 -1
- package/lib-commonjs/buildProps.test.js +32 -32
- package/lib-commonjs/buildProps.test.js.map +1 -1
- package/lib-commonjs/buildUseStyling.d.ts +30 -27
- package/lib-commonjs/buildUseStyling.js +35 -37
- package/lib-commonjs/buildUseStyling.js.map +1 -1
- package/lib-commonjs/buildUseStyling.test.d.ts +1 -1
- package/lib-commonjs/buildUseStyling.test.js +72 -69
- package/lib-commonjs/buildUseStyling.test.js.map +1 -1
- package/lib-commonjs/index.d.ts +1 -1
- package/lib-commonjs/index.js +30 -10
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/useStyling.samples.test.d.ts +1 -1
- package/lib-commonjs/useStyling.samples.test.js +227 -155
- package/lib-commonjs/useStyling.samples.test.js.map +1 -1
- package/package.json +50 -44
- package/src/buildProps.ts +2 -2
- package/src/useStyling.samples.test.tsx +23 -14
|
@@ -1,23 +1,73 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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;
|
|
41
|
+
};
|
|
42
|
+
return ownKeys(o);
|
|
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
|
+
const jsx_runtime_1 = require('react/jsx-runtime');
|
|
54
|
+
const react_1 = require('react');
|
|
55
|
+
const react_native_1 = require('react-native');
|
|
56
|
+
const renderer = __importStar(require('react-test-renderer'));
|
|
57
|
+
const buildProps_1 = require('./buildProps');
|
|
58
|
+
const buildUseStyling_1 = require('./buildUseStyling');
|
|
9
59
|
/**
|
|
10
60
|
* The default/base theme just contains base values
|
|
11
61
|
*/
|
|
12
62
|
const baseTheme = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
63
|
+
globals: {
|
|
64
|
+
backgroundColor: 'white',
|
|
65
|
+
color: 'black',
|
|
66
|
+
borderColor: 'blue',
|
|
67
|
+
fontFamily: 'Arial',
|
|
68
|
+
fontSize: 12,
|
|
69
|
+
},
|
|
70
|
+
components: {},
|
|
21
71
|
};
|
|
22
72
|
const current = { theme: baseTheme };
|
|
23
73
|
/**
|
|
@@ -26,156 +76,178 @@ const current = { theme: baseTheme };
|
|
|
26
76
|
* whatever system they desire
|
|
27
77
|
*/
|
|
28
78
|
const themeHelper = {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
79
|
+
useTheme: () => current.theme,
|
|
80
|
+
getComponentInfo: (theme, name) => theme.components[name],
|
|
81
|
+
setActive: (theme) => {
|
|
82
|
+
current.theme = theme ? { ...baseTheme, ...theme } : baseTheme;
|
|
83
|
+
},
|
|
34
84
|
};
|
|
35
85
|
describe('useStyling samples', () => {
|
|
86
|
+
/**
|
|
87
|
+
* Sample #1 - Themeable text element
|
|
88
|
+
*
|
|
89
|
+
* This adds some default opinions for how a text element should be styled but only allows for customization
|
|
90
|
+
* via theming
|
|
91
|
+
*/
|
|
92
|
+
// now create the styling hook, first the options so they can be reused later
|
|
93
|
+
const sample1StylingOptions = {
|
|
94
|
+
/**
|
|
95
|
+
* tell the styling hook how to build up the tokens
|
|
96
|
+
*/
|
|
97
|
+
tokens: [
|
|
98
|
+
/** first the default values should come from the global theme section */
|
|
99
|
+
(t) => ({
|
|
100
|
+
color: t.globals.color,
|
|
101
|
+
fontFamily: t.globals.fontFamily,
|
|
102
|
+
fontSize: t.globals.fontSize,
|
|
103
|
+
}),
|
|
104
|
+
/** next we should look for a component reference to overlay */
|
|
105
|
+
'Sample1',
|
|
106
|
+
],
|
|
36
107
|
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* This adds some default opinions for how a text element should be styled but only allows for customization
|
|
40
|
-
* via theming
|
|
108
|
+
* Now provide the recipe for how to build props for the sub-components given the tokens
|
|
41
109
|
*/
|
|
42
|
-
|
|
43
|
-
|
|
110
|
+
slotProps: {
|
|
111
|
+
/** only one sub-component, a Text element called content, as a result this needs to build up TextProps */
|
|
112
|
+
content: (0, buildProps_1.buildProps)(
|
|
44
113
|
/**
|
|
45
|
-
*
|
|
114
|
+
* first input for buildProps is a function which takes tokens and a theme and returns props
|
|
46
115
|
*/
|
|
47
|
-
tokens:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
fontSize: t.globals.fontSize,
|
|
53
|
-
}),
|
|
54
|
-
/** next we should look for a component reference to overlay */
|
|
55
|
-
'Sample1',
|
|
56
|
-
],
|
|
116
|
+
(tokens /*, theme: Theme */) => {
|
|
117
|
+
return {
|
|
118
|
+
style: { ...tokens },
|
|
119
|
+
};
|
|
120
|
+
},
|
|
57
121
|
/**
|
|
58
|
-
*
|
|
122
|
+
* The second input are the tokens used as inputs for the above function. This is similar to the way the useEffect hook
|
|
123
|
+
* works in react.
|
|
59
124
|
*/
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
125
|
+
['color', 'fontFamily', 'fontSize'],
|
|
126
|
+
),
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
// now build the actual hook from the options and theme helper
|
|
130
|
+
const useStylingSample1 = (0, buildUseStyling_1.buildUseStyling)(sample1StylingOptions, themeHelper);
|
|
131
|
+
// now the sample 1 component becomes simple to build, just merge the styled props with the input props
|
|
132
|
+
const Sample1Text = (props) => {
|
|
133
|
+
const styledProps = useStylingSample1(props).content;
|
|
134
|
+
const merged = { ...props, ...styledProps };
|
|
135
|
+
return jsx_runtime_1.jsx(react_native_1.Text, { ...merged, children: props.children });
|
|
136
|
+
};
|
|
137
|
+
/** first render the component with no updates */
|
|
138
|
+
it('Sample1Text rendering with no overrides', () => {
|
|
139
|
+
let component;
|
|
140
|
+
(0, react_1.act)(() => {
|
|
141
|
+
component = renderer.create(jsx_runtime_1.jsx(Sample1Text, { children: 'Sample1a' }));
|
|
142
|
+
});
|
|
143
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
144
|
+
});
|
|
145
|
+
/** now re-theme the component via the components in the theme */
|
|
146
|
+
it('Sample1Text rendering with some custom settings in the theme', () => {
|
|
147
|
+
themeHelper.setActive({
|
|
148
|
+
components: {
|
|
149
|
+
Sample1: {
|
|
150
|
+
color: 'pink',
|
|
151
|
+
fontSize: 24,
|
|
76
152
|
},
|
|
77
|
-
|
|
78
|
-
// now build the actual hook from the options and theme helper
|
|
79
|
-
const useStylingSample1 = (0, buildUseStyling_1.buildUseStyling)(sample1StylingOptions, themeHelper);
|
|
80
|
-
// now the sample 1 component becomes simple to build, just merge the styled props with the input props
|
|
81
|
-
const Sample1Text = (props) => {
|
|
82
|
-
const styledProps = useStylingSample1(props).content;
|
|
83
|
-
const merged = { ...props, ...styledProps };
|
|
84
|
-
return React.createElement(react_native_1.Text, { ...merged }, props.children);
|
|
85
|
-
};
|
|
86
|
-
/** first render the component with no updates */
|
|
87
|
-
it('Sample1Text rendering with no overrides', () => {
|
|
88
|
-
const tree = renderer.create(React.createElement(Sample1Text, null, "Sample1a")).toJSON();
|
|
89
|
-
expect(tree).toMatchSnapshot();
|
|
153
|
+
},
|
|
90
154
|
});
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
components: {
|
|
95
|
-
Sample1: {
|
|
96
|
-
color: 'pink',
|
|
97
|
-
fontSize: 24,
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
});
|
|
101
|
-
const tree = renderer.create(React.createElement(Sample1Text, null, "Sample1b")).toJSON();
|
|
102
|
-
expect(tree).toMatchSnapshot();
|
|
155
|
+
let component;
|
|
156
|
+
(0, react_1.act)(() => {
|
|
157
|
+
component = renderer.create(jsx_runtime_1.jsx(Sample1Text, { children: 'Sample1b' }));
|
|
103
158
|
});
|
|
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
|
-
|
|
157
|
-
|
|
159
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
160
|
+
});
|
|
161
|
+
/**
|
|
162
|
+
* Build the styling hook for sample2. Because this isn't being recombined this is being specified inline rather
|
|
163
|
+
* than using a separate options object. Both are fine.
|
|
164
|
+
*/
|
|
165
|
+
const useStylingSample2 = (0, buildUseStyling_1.buildUseStyling)(
|
|
166
|
+
{
|
|
167
|
+
/**
|
|
168
|
+
* This just starts with the baseline styling from sample1, in particular we are using the recipes of how to turn
|
|
169
|
+
* token values into the props for the internal sub-components. While this example is not super complex, for real-world
|
|
170
|
+
* components, re-using these can be extremely valuable.
|
|
171
|
+
*
|
|
172
|
+
* With that in mind, this copies over the recipes for how to turn tokens into props, the customizations that
|
|
173
|
+
* will be made are about how to ensure the tokens are set up correctly.
|
|
174
|
+
*/
|
|
175
|
+
...sample1StylingOptions,
|
|
176
|
+
/**
|
|
177
|
+
* In sample1 tokens are set to defaults from the global theme section, then patched with any values looked up with
|
|
178
|
+
* the string 'Sample1'
|
|
179
|
+
*
|
|
180
|
+
* We want to maintain the logic of setting up the globals, but add an additional lookup for 'Sample2'. This might correspond
|
|
181
|
+
* to saying that if we were making a variant of a 'Text' component called 'HeaderText', we might want to look up
|
|
182
|
+
* customizations from 'Text' first, then override those customizations with those from 'HeaderText'
|
|
183
|
+
*
|
|
184
|
+
* If we didn't want to add the extra 'Sample2' lookup this line would be omitted. If we didn't want to look up 'Sample1' first
|
|
185
|
+
* that could be filtered out of the array that is being copied
|
|
186
|
+
*/
|
|
187
|
+
tokens: [...sample1StylingOptions.tokens, 'Sample2'],
|
|
188
|
+
/**
|
|
189
|
+
* This is the final bit of magic. The tokens will already have values set from the global theme, they will then be patched with
|
|
190
|
+
* any customizations set into Sample1 and/or Sample2.
|
|
191
|
+
*
|
|
192
|
+
* If this value was omitted then the tokens would be passed to the slotProps recipies as is. To have those values patched from
|
|
193
|
+
* the component props we add a list of the props which need to be passed into tokens. If all props should be spread into the
|
|
194
|
+
* tokens then this value can be set to 'all'. If none should be passed it can be omitted or set to 'none'
|
|
195
|
+
*/
|
|
196
|
+
tokensThatAreAlsoProps: ['color'],
|
|
197
|
+
},
|
|
198
|
+
themeHelper,
|
|
199
|
+
);
|
|
200
|
+
// the Sample2Text component is built the same way as sample1, just using the new hook that has been created
|
|
201
|
+
const Sample2Text = (props) => {
|
|
202
|
+
const styledProps = useStylingSample2(props).content;
|
|
203
|
+
const merged = { ...props, ...styledProps };
|
|
204
|
+
// delete the color key to not pass it through to the text props, could be done via destructuring, filtering, or any number of ways
|
|
205
|
+
delete merged.color;
|
|
206
|
+
// render the text
|
|
207
|
+
return jsx_runtime_1.jsx(react_native_1.Text, { ...merged, children: props.children });
|
|
208
|
+
};
|
|
209
|
+
/** rendering the Sample2 component with the base theme */
|
|
210
|
+
it('Sample2Text rendering with defaults and a color override', () => {
|
|
211
|
+
themeHelper.setActive();
|
|
212
|
+
let component;
|
|
213
|
+
(0, react_1.act)(() => {
|
|
214
|
+
component = renderer.create(
|
|
215
|
+
jsx_runtime_1.jsxs(react_native_1.View, {
|
|
216
|
+
children: [
|
|
217
|
+
jsx_runtime_1.jsx(Sample2Text, { children: 'Sample2 with defaults' }),
|
|
218
|
+
jsx_runtime_1.jsx(Sample2Text, { color: 'green', children: 'Sample2 with color override via prop' }),
|
|
219
|
+
],
|
|
220
|
+
}),
|
|
221
|
+
);
|
|
158
222
|
});
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
223
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
224
|
+
});
|
|
225
|
+
/** now re-theme the component via the components in the theme */
|
|
226
|
+
it('Sample2Text rendering with some custom settings in the theme', () => {
|
|
227
|
+
themeHelper.setActive({
|
|
228
|
+
components: {
|
|
229
|
+
Sample1: {
|
|
230
|
+
color: 'pink',
|
|
231
|
+
fontSize: 24,
|
|
232
|
+
},
|
|
233
|
+
Sample2: {
|
|
234
|
+
fontSize: 18,
|
|
235
|
+
fontFamily: 'Helvetica',
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
});
|
|
239
|
+
let component;
|
|
240
|
+
(0, react_1.act)(() => {
|
|
241
|
+
component = renderer.create(
|
|
242
|
+
jsx_runtime_1.jsxs(react_native_1.View, {
|
|
243
|
+
children: [
|
|
244
|
+
jsx_runtime_1.jsx(Sample2Text, { children: 'Sample2 with theme overrides set' }),
|
|
245
|
+
jsx_runtime_1.jsx(Sample2Text, { color: 'purple', children: 'Sample2 with theme and color prop override' }),
|
|
246
|
+
],
|
|
247
|
+
}),
|
|
248
|
+
);
|
|
179
249
|
});
|
|
250
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
251
|
+
});
|
|
180
252
|
});
|
|
181
|
-
//# sourceMappingURL=useStyling.samples.test.js.map
|
|
253
|
+
//# sourceMappingURL=useStyling.samples.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStyling.samples.test.js","sourceRoot":"","sources":["../src/useStyling.samples.test.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useStyling.samples.test.js","sourceRoot":"","sources":["../src/useStyling.samples.test.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,iCAA4B;AAE5B,+CAA0C;AAE1C,MAAY,QAAQ,gDAA4B;AAEhD,6CAA0C;AAE1C,uDA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D,EAAE,GAAG,EAAE,CAAC;QACvE,WAAW,CAAC,SAAS,CAAC;YACpB,UAAU,EAAE;gBACV,OAAO,EAAE;oBACP,KAAK,EAAE,MAAM;oBACb,QAAQ,EAAE,EAAE;iBACb;gBACD,OAAO,EAAE;oBACP,QAAQ,EAAE,EAAE;oBACZ,UAAU,EAAE,WAAW;iBACxB;aACF;SACF,CAAC,CAAC;QACH,IAAI,SAAqC,CAAC;QAC1C,IAAA,WAAG,EAAC,GAAG,EAAE,CAAC;YACR,SAAS,GAAG,QAAQ,CAAC,MAAM,CACzB,mBAAC,mBAAI;oBACH,kBAAC,WAAW,mDAA+C,EAC3D,kBAAC,WAAW,IAAC,KAAK,EAAC,QAAQ,2DAAyD;oBAC/E,CACR,CAAC;QAAA,CACH,CAAC,CAAC;QACH,MAAM,CAAC,SAAU,CAAC,MAAM,EAAE,CAAC,CAAC,eAAe,EAAE,CAAC;IAAA,CAC/C,CAAC,CAAC;AAAA,CACJ,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,78 +1,84 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui-react-native/use-styling",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "Opinionated use styling hook implementation",
|
|
5
|
+
"keywords": [],
|
|
5
6
|
"repository": {
|
|
6
7
|
"type": "git",
|
|
7
8
|
"url": "https://github.com/microsoft/fluentui-react-native",
|
|
8
9
|
"directory": "packages/framework/use-styling"
|
|
9
10
|
},
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"react-native": "src/index.ts",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"author": "",
|
|
13
13
|
"exports": {
|
|
14
14
|
".": {
|
|
15
|
+
"types": "./lib/index.d.ts",
|
|
15
16
|
"import": "./lib/index.js",
|
|
16
|
-
"require": "./lib-commonjs/index.js"
|
|
17
|
-
"types": "./lib/index.d.ts"
|
|
17
|
+
"require": "./lib-commonjs/index.js"
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
|
-
"
|
|
20
|
+
"main": "lib-commonjs/index.js",
|
|
21
|
+
"module": "lib/index.js",
|
|
22
|
+
"types": "lib/index.d.ts",
|
|
21
23
|
"scripts": {
|
|
22
24
|
"build": "fluentui-scripts build",
|
|
25
|
+
"build-cjs": "tsgo --outDir lib-commonjs",
|
|
26
|
+
"build-esm": "tsgo --outDir lib --module esnext --moduleResolution bundler",
|
|
23
27
|
"clean": "fluentui-scripts clean",
|
|
24
28
|
"depcheck": "fluentui-scripts depcheck",
|
|
25
|
-
"just": "fluentui-scripts",
|
|
26
29
|
"lint": "fluentui-scripts eslint",
|
|
30
|
+
"lint-package": "fluentui-scripts lint-package",
|
|
31
|
+
"prettier": "fluentui-scripts prettier",
|
|
27
32
|
"start": "fluentui-scripts dev",
|
|
28
33
|
"start-test": "fluentui-scripts jest-watch",
|
|
29
34
|
"test": "fluentui-scripts jest",
|
|
30
|
-
"update-snapshots": "fluentui-scripts jest -u"
|
|
31
|
-
"prettier": "fluentui-scripts prettier",
|
|
32
|
-
"prettier-fix": "fluentui-scripts prettier --fix true"
|
|
35
|
+
"update-snapshots": "fluentui-scripts jest -u"
|
|
33
36
|
},
|
|
34
|
-
"keywords": [],
|
|
35
|
-
"author": "",
|
|
36
|
-
"license": "MIT",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@fluentui-react-native/framework-base": "0.
|
|
39
|
-
"@fluentui-react-native/use-tokens": "0.
|
|
40
|
-
"tslib": "^2.3.1"
|
|
38
|
+
"@fluentui-react-native/framework-base": "0.3.0",
|
|
39
|
+
"@fluentui-react-native/use-tokens": "0.7.0"
|
|
41
40
|
},
|
|
42
41
|
"devDependencies": {
|
|
43
42
|
"@babel/core": "^7.20.0",
|
|
44
|
-
"@fluentui-react-native/
|
|
45
|
-
"@react-native/
|
|
46
|
-
"@react-native/
|
|
43
|
+
"@fluentui-react-native/babel-config": "0.1.1",
|
|
44
|
+
"@fluentui-react-native/eslint-config-rules": "0.1.1",
|
|
45
|
+
"@fluentui-react-native/jest-config": "0.1.1",
|
|
46
|
+
"@fluentui-react-native/kit-config": "0.1.2",
|
|
47
|
+
"@fluentui-react-native/scripts": "0.1.2",
|
|
48
|
+
"@react-native-community/cli": "^20.0.0",
|
|
49
|
+
"@react-native-community/cli-platform-android": "^20.0.0",
|
|
50
|
+
"@react-native-community/cli-platform-ios": "^20.0.0",
|
|
51
|
+
"@react-native/babel-preset": "^0.81.0",
|
|
52
|
+
"@react-native/metro-config": "^0.81.0",
|
|
47
53
|
"@types/jest": "^29.0.0",
|
|
48
|
-
"react": "
|
|
49
|
-
"react-
|
|
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-test-renderer": "19.1.0"
|
|
59
|
+
},
|
|
60
|
+
"peerDependencies": {
|
|
61
|
+
"@types/react": "~18.2.0 || ~19.0.0 || ~19.1.0",
|
|
62
|
+
"react": "18.2.0 || 19.0.0 || 19.1.0"
|
|
63
|
+
},
|
|
64
|
+
"peerDependenciesMeta": {
|
|
65
|
+
"@types/react": {
|
|
66
|
+
"optional": true
|
|
67
|
+
}
|
|
50
68
|
},
|
|
51
69
|
"rnx-kit": {
|
|
52
70
|
"kitType": "library",
|
|
53
71
|
"alignDeps": {
|
|
54
|
-
"presets": [
|
|
55
|
-
"microsoft/react-native"
|
|
56
|
-
],
|
|
57
|
-
"requirements": {
|
|
58
|
-
"development": [
|
|
59
|
-
"react-native@0.74"
|
|
60
|
-
],
|
|
61
|
-
"production": [
|
|
62
|
-
"react-native@0.73 || 0.74"
|
|
63
|
-
]
|
|
64
|
-
},
|
|
65
72
|
"capabilities": [
|
|
66
|
-
"
|
|
67
|
-
"core",
|
|
68
|
-
"core-
|
|
69
|
-
"
|
|
70
|
-
"react"
|
|
73
|
+
"core-android-dev-only",
|
|
74
|
+
"core-dev-only",
|
|
75
|
+
"core-ios-dev-only",
|
|
76
|
+
"react",
|
|
77
|
+
"react-test-renderer",
|
|
78
|
+
"tools-core",
|
|
79
|
+
"tools-jest"
|
|
71
80
|
]
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
"peerDependencies": {
|
|
75
|
-
"react": "18.2.0",
|
|
76
|
-
"react-native": "^0.73.0 || ^0.74.0"
|
|
81
|
+
},
|
|
82
|
+
"extends": "@fluentui-react-native/kit-config"
|
|
77
83
|
}
|
|
78
|
-
}
|
|
84
|
+
}
|
package/src/buildProps.ts
CHANGED
|
@@ -97,10 +97,10 @@ export function refinePropsFunctions<TSlotProps, TTokens, TTheme>(
|
|
|
97
97
|
mask: TokensThatAreAlsoProps<TTokens>,
|
|
98
98
|
): BuildSlotProps<TSlotProps, TTokens, TTheme> {
|
|
99
99
|
const result = {};
|
|
100
|
-
Object.keys(styles)
|
|
100
|
+
for (const key of Object.keys(styles)) {
|
|
101
101
|
const refine =
|
|
102
102
|
typeof styles[key] === 'function' && (styles[key] as RefinableBuildPropsBase<TSlotProps[keyof TSlotProps], TTokens, TTheme>).refine;
|
|
103
103
|
result[key] = refine ? refine(mask) : styles[key];
|
|
104
|
-
}
|
|
104
|
+
}
|
|
105
105
|
return result;
|
|
106
106
|
}
|