@fluentui-react-native/use-slots 0.10.3 → 0.10.5

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 CHANGED
@@ -2,7 +2,48 @@
2
2
  "name": "@fluentui-react-native/use-slots",
3
3
  "entries": [
4
4
  {
5
- "date": "Thu, 12 Jun 2025 03:17:16 GMT",
5
+ "date": "Fri, 11 Jul 2025 19:50:39 GMT",
6
+ "version": "0.10.5",
7
+ "tag": "@fluentui-react-native/use-slots_v0.10.5",
8
+ "comments": {
9
+ "none": [
10
+ {
11
+ "author": "ruaraki@microsoft.com",
12
+ "package": "@fluentui-react-native/use-slots",
13
+ "commit": "a245202877ef7f2be9ab5f0e1356b2270957e693",
14
+ "comment": "Run bump-versions"
15
+ },
16
+ {
17
+ "author": "4123478+tido64@users.noreply.github.com",
18
+ "package": "@fluentui-react-native/use-slots",
19
+ "commit": "79bb06f6bbfd0a36f9d2ef371f4857be9660f027",
20
+ "comment": "Fixed `align-deps` warnings"
21
+ },
22
+ {
23
+ "author": "sanajmi@microsoft.com",
24
+ "package": "@fluentui-react-native/use-slots",
25
+ "commit": "405ca368dc3f2963bfc252a1952b1e14ff503499",
26
+ "comment": "fix: run `beachball sync` to sync package versions with NPM"
27
+ },
28
+ {
29
+ "author": "jasonmo@microsoft.com",
30
+ "package": "@fluentui-react-native/use-slots",
31
+ "commit": "54087dca787180bbf34630470cd0d06e88366b30",
32
+ "comment": "update eslint to 9.x and use new flat config format with security rules"
33
+ }
34
+ ],
35
+ "patch": [
36
+ {
37
+ "author": "jasonmo@microsoft.com",
38
+ "package": "@fluentui-react-native/use-slots",
39
+ "commit": "479b93cea460a26df70c55b5d3335927ed374713",
40
+ "comment": "update builds to use node16 settings and modern export maps"
41
+ }
42
+ ]
43
+ }
44
+ },
45
+ {
46
+ "date": "Thu, 10 Jul 2025 19:20:14 GMT",
6
47
  "version": "0.10.3",
7
48
  "tag": "@fluentui-react-native/use-slots_v0.10.3",
8
49
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,20 @@
1
1
  # Change Log - @fluentui-react-native/use-slots
2
2
 
3
- <!-- This log was last generated on Thu, 12 Jun 2025 03:17:16 GMT and should not be manually modified. -->
3
+ <!-- This log was last generated on Fri, 11 Jul 2025 19:50:39 GMT and should not be manually modified. -->
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 0.10.5
8
+
9
+ Fri, 11 Jul 2025 19:50:39 GMT
10
+
11
+ ### Patches
12
+
13
+ - update builds to use node16 settings and modern export maps (jasonmo@microsoft.com)
14
+
7
15
  ## 0.10.3
8
16
 
9
- Thu, 12 Jun 2025 03:17:16 GMT
17
+ Thu, 10 Jul 2025 19:20:14 GMT
10
18
 
11
19
  ### Patches
12
20
 
@@ -0,0 +1,3 @@
1
+ const baseConfig = require('@fluentui-react-native/eslint-config-rules');
2
+
3
+ module.exports = baseConfig;
@@ -1,18 +1,14 @@
1
1
  import { useSlot } from '@fluentui-react-native/use-slot';
2
2
  export function buildUseSlots(options) {
3
- var slots = options.slots, _a = options.filters, filters = _a === void 0 ? {} : _a, useStyling = options.useStyling;
4
- return function () {
5
- var args = [];
6
- for (var _i = 0; _i < arguments.length; _i++) {
7
- args[_i] = arguments[_i];
8
- }
3
+ const { slots, filters = {}, useStyling } = options;
4
+ return (...args) => {
9
5
  // get the baseline slot props to render with the slots
10
6
  // eslint-disable-next-line @typescript-eslint/ban-types
11
- var slotProps = typeof useStyling === 'function' ? useStyling.apply(void 0, args) : (useStyling || {});
7
+ const slotProps = typeof useStyling === 'function' ? useStyling(...args) : (useStyling || {});
12
8
  // build up a set of slots closures and store them in props
13
- var builtSlots = {};
9
+ const builtSlots = {};
14
10
  // for each slot go through and either cache the slot props or call part one render if it is staged
15
- Object.keys(slots).forEach(function (slotName) {
11
+ Object.keys(slots).forEach((slotName) => {
16
12
  builtSlots[slotName] = useSlot(slots[slotName], slotProps[slotName], filters[slotName]);
17
13
  });
18
14
  // return the prebuilt closures, these will have internal references to state.results
@@ -1 +1 @@
1
- {"version":3,"file":"buildUseSlots.js","sourceRoot":"","sources":["../src/buildUseSlots.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAgB1D,MAAM,UAAU,aAAa,CAAa,OAAmC;IACnE,IAAA,KAAK,GAA+B,OAAO,MAAtC,EAAE,KAA6B,OAAO,QAAxB,EAAZ,OAAO,mBAAG,EAAE,KAAA,EAAE,UAAU,GAAK,OAAO,WAAZ,CAAa;IACpD,OAAO;QAAC,cAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,yBAAc;;QACpB,uDAAuD;QACvD,wDAAwD;QACxD,IAAM,SAAS,GAAe,OAAO,UAAU,KAAK,UAAU,CAAC,CAAC,CAAE,UAAuB,eAAI,IAAI,EAAE,CAAC,CAAE,CAAC,UAAU,IAAI,EAAE,CAAgB,CAAC;QAExI,2DAA2D;QAC3D,IAAM,UAAU,GAAsB,EAAuB,CAAC;QAE9D,mGAAmG;QACnG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,UAAC,QAAQ;YAClC,UAAU,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC1F,CAAC,CAAC,CAAC;QAEH,qFAAqF;QACrF,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"buildUseSlots.js","sourceRoot":"","sources":["../src/buildUseSlots.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAgB1D,MAAM,UAAU,aAAa,CAAa,OAAmC;IAC3E,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IACpD,OAAO,CAAC,GAAG,IAAW,EAAE,EAAE;QACxB,uDAAuD;QACvD,wDAAwD;QACxD,MAAM,SAAS,GAAe,OAAO,UAAU,KAAK,UAAU,CAAC,CAAC,CAAE,UAAuB,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAE,CAAC,UAAU,IAAI,EAAE,CAAgB,CAAC;QAExI,2DAA2D;QAC3D,MAAM,UAAU,GAAsB,EAAuB,CAAC;QAE9D,mGAAmG;QACnG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;YACtC,UAAU,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC1F,CAAC,CAAC,CAAC;QAEH,qFAAqF;QACrF,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC"}
@@ -1,37 +1,26 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
1
  import { View, Text } from 'react-native';
13
2
  import { withSlots, stagedComponent } from '@fluentui-react-native/use-slot';
14
3
  import * as renderer from 'react-test-renderer';
15
4
  import { buildUseSlots } from './buildUseSlots';
16
- var useSlotsBase = buildUseSlots({
5
+ const useSlotsBase = buildUseSlots({
17
6
  slots: {
18
7
  outer: View,
19
8
  inner: View,
20
9
  content: Text,
21
10
  },
22
11
  });
23
- var CompBase = stagedComponent(function (props) {
24
- var Slots = useSlotsBase(props);
25
- return function (extra) {
26
- var merged = __assign(__assign({}, props), extra);
27
- return (withSlots(Slots.outer, __assign({}, merged),
12
+ const CompBase = stagedComponent((props) => {
13
+ const Slots = useSlotsBase(props);
14
+ return (extra) => {
15
+ const merged = { ...props, ...extra };
16
+ return (withSlots(Slots.outer, { ...merged },
28
17
  withSlots(Slots.inner, { style: { backgroundColor: 'blue', width: 20, height: 10 } },
29
18
  withSlots(Slots.content, null, "Hello"))));
30
19
  };
31
20
  });
32
- describe('buildUseSlots test suite', function () {
33
- it('Simple component render', function () {
34
- var tree = renderer.create(withSlots(CompBase, { style: { width: 30, height: 20, borderColor: 'green', borderWidth: 1 } })).toJSON();
21
+ describe('buildUseSlots test suite', () => {
22
+ it('Simple component render', () => {
23
+ const tree = renderer.create(withSlots(CompBase, { style: { width: 30, height: 20, borderColor: 'green', borderWidth: 1 } })).toJSON();
35
24
  expect(tree).toMatchSnapshot();
36
25
  });
37
26
  });
@@ -1 +1 @@
1
- {"version":3,"file":"buildUseSlots.test.js","sourceRoot":"","sources":["../src/buildUseSlots.test.tsx"],"names":[],"mappings":";;;;;;;;;;;AAGA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAQhD,IAAM,YAAY,GAAG,aAAa,CAAa;IAC7C,KAAK,EAAE;QACL,KAAK,EAAE,IAAI;QACX,KAAK,EAAE,IAAI;QACX,OAAO,EAAE,IAAI;KACd;CACF,CAAC,CAAC;AAEH,IAAM,QAAQ,GAAG,eAAe,CAAC,UAAC,KAAgB;IAChD,IAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IAClC,OAAO,UAAC,KAAgB;QACtB,IAAM,MAAM,yBAAQ,KAAK,GAAK,KAAK,CAAE,CAAC;QACtC,OAAO,CACL,UAAC,KAAK,CAAC,KAAK,eAAK,MAAM;YACrB,UAAC,KAAK,CAAC,KAA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AG,KAAK,EAAE,GAAG,KAAK,EAAE,CAAC;QACtC,OAAO,CACL,UAAC,KAAK,CAAC,KAAK,OAAK,MAAM;YACrB,UAAC,KAAK,CAAC,KAAK,IAAC,KAAK,EAAE,EAAE,eAAe,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;gBACpE,UAAC,KAAK,CAAC,OAAO,gBAAsB,CACxB,CACF,CACf,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACxC,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACjC,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,UAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,EAAE,GAAI,CAAC,CAAC,MAAM,EAAE,CAAC;QAC5H,MAAM,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;IACjC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,25 +1,3 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- var __rest = (this && this.__rest) || function (s, e) {
13
- var t = {};
14
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
- t[p] = s[p];
16
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
- t[p[i]] = s[p[i]];
20
- }
21
- return t;
22
- };
23
1
  import { mergeProps } from '@fluentui-react-native/merge-props';
24
2
  import { withSlots, stagedComponent } from '@fluentui-react-native/use-slot';
25
3
  import * as renderer from 'react-test-renderer';
@@ -28,7 +6,7 @@ import { buildUseSlots } from './buildUseSlots';
28
6
  * This file contains samples and description to help explain what the useSlots hook does and why it is useful
29
7
  * for building components.
30
8
  */
31
- describe('useSlots sample code test suite', function () {
9
+ describe('useSlots sample code test suite', () => {
32
10
  /**
33
11
  * The first mechanism to understand is the stagedComponent mechanic. This allows a component to be written, separating
34
12
  * hook calls and component rendering. This allows it to be safely called as a function by a higher order component, even conditionally.
@@ -39,20 +17,20 @@ describe('useSlots sample code test suite', function () {
39
17
  * First we are going to create a wrapped text component that bolds all text. One component will be authored as a staged
40
18
  * component and one as a regular component.
41
19
  */
42
- var boldBaseProps = { style: { fontWeight: 900 } };
20
+ const boldBaseProps = { style: { fontWeight: 900 } };
43
21
  /**
44
22
  * First create the bold text in the standard way. This is just a function component.
45
23
  */
46
- var BoldTextStandard = function (props) {
24
+ const BoldTextStandard = (props) => {
47
25
  /**
48
26
  * Pick out the children to pass them on to the child Text element
49
27
  */
50
- var children = props.children, rest = __rest(props, ["children"]);
28
+ const { children, ...rest } = props;
51
29
  /**
52
30
  * Now render the text, merging the baseProps with the style updates with the rest param. Note that this leverages the fact
53
31
  * that mergeProps will reliably produce style objects with the same reference, given the same inputs.
54
32
  */
55
- return withSlots("span", __assign({}, mergeProps(boldBaseProps, rest)), children);
33
+ return withSlots("span", { ...mergeProps(boldBaseProps, rest) }, children);
56
34
  };
57
35
  BoldTextStandard.displayName = 'BoldTextStandard';
58
36
  /**
@@ -61,26 +39,26 @@ describe('useSlots sample code test suite', function () {
61
39
  *
62
40
  * The stagedComponent function takes an input function of this form and wraps it in a function component that react knows how to render
63
41
  */
64
- var BoldTextStaged = stagedComponent(function (props) {
42
+ const BoldTextStaged = stagedComponent((props) => {
65
43
  /**
66
44
  * This section would be where hook/styling code would go, props here would include everything coming in from the base react tree with the
67
45
  * exception of children, which will be passed in stage 2.
68
46
  */
69
- return function (extra, children) {
47
+ return (extra, children) => {
70
48
  /**
71
49
  * extra are additional props that may be filled in by a higher order component. They should not include styling and are only props the
72
50
  * enclosing component are passing to the JSX elements
73
51
  */
74
- return withSlots("span", __assign({}, mergeProps(boldBaseProps, props, extra)), children);
52
+ return withSlots("span", { ...mergeProps(boldBaseProps, props, extra) }, children);
75
53
  };
76
54
  });
77
55
  BoldTextStaged.displayName = 'BoldTextStaged';
78
- it('renders sample 1 - the two types of basic bold text components', function () {
79
- var styleToMerge = { color: 'black' };
56
+ it('renders sample 1 - the two types of basic bold text components', () => {
57
+ const styleToMerge = { color: 'black' };
80
58
  /**
81
59
  * First render the staged component. This invokes the wrapper that was built by the stagedComponent function
82
60
  */
83
- var wrapper = renderer
61
+ const wrapper = renderer
84
62
  .create(withSlots("div", null,
85
63
  withSlots(BoldTextStaged, { style: styleToMerge }, "Staged component at one level"),
86
64
  withSlots(BoldTextStandard, { style: styleToMerge }, "Standard component of a single level")))
@@ -93,16 +71,16 @@ describe('useSlots sample code test suite', function () {
93
71
  * Next we will build a layer on top of the previously authored components to turn the bold text components into header components. This is
94
72
  * to illustrate the way in which components can be commonly built on top of other simpler components.
95
73
  */
96
- var headerBaseProps = { style: { fontSize: 20 } };
74
+ const headerBaseProps = { style: { fontSize: 20 } };
97
75
  /**
98
76
  * The standard way of doing things is a repeat of what happens above. Grab the children, pass them on, merge the rest of the props with
99
77
  * base props.
100
78
  *
101
79
  * This again leverages style merging via mergeProps to avoid changing the references of the style objects on every render
102
80
  */
103
- var HeaderStandard = function (props) {
104
- var children = props.children, rest = __rest(props, ["children"]);
105
- return withSlots(BoldTextStandard, __assign({}, mergeProps(headerBaseProps, rest)), children);
81
+ const HeaderStandard = (props) => {
82
+ const { children, ...rest } = props;
83
+ return withSlots(BoldTextStandard, { ...mergeProps(headerBaseProps, rest) }, children);
106
84
  };
107
85
  HeaderStandard.displayName = 'HeaderStandard';
108
86
  /**
@@ -112,11 +90,11 @@ describe('useSlots sample code test suite', function () {
112
90
  *
113
91
  * This should be built once, and consumed by the component, not built on the fly inside
114
92
  */
115
- var useHeaderSlots = buildUseSlots({ slots: { text: BoldTextStaged } });
93
+ const useHeaderSlots = buildUseSlots({ slots: { text: BoldTextStaged } });
116
94
  /**
117
95
  * Now author the staged component using the slot hook
118
96
  */
119
- var HeaderStaged = stagedComponent(function (props) {
97
+ const HeaderStaged = stagedComponent((props) => {
120
98
  /**
121
99
  * Call the slots hook (or any hook) outside of the inner closure. The useSlots hook will return an object with each slot as a renderable
122
100
  * function. The hooks for sub-components will be called as part of this call. Props passed in at this point will be the props that appear
@@ -124,9 +102,9 @@ describe('useSlots sample code test suite', function () {
124
102
  *
125
103
  * Note that while we are passing in props, in the simple usage case it isn't used and could be omitted if desired
126
104
  * */
127
- var BoldText = useHeaderSlots(props).text;
105
+ const BoldText = useHeaderSlots(props).text;
128
106
  /** Now the inner closure, pretty much the same as before */
129
- return function (extra, children) {
107
+ return (extra, children) => {
130
108
  /**
131
109
  * Instead of rendering the <BoldTextStageed> component directly we render using the slot. If this is a staged component it will call the
132
110
  * inner closure directly, without going through createElement. Entries passed into the JSX, including children, are what appear in the
@@ -135,7 +113,7 @@ describe('useSlots sample code test suite', function () {
135
113
  * NOTE: this requires using the withSlots helper via the jsx directive. This knows how to pick apart the entries and just call the second
136
114
  * part of the function
137
115
  */
138
- return withSlots(BoldText, __assign({}, mergeProps(headerBaseProps, props, extra)), children);
116
+ return withSlots(BoldText, { ...mergeProps(headerBaseProps, props, extra) }, children);
139
117
  };
140
118
  });
141
119
  HeaderStaged.displayName = 'HeaderStaged';
@@ -143,12 +121,12 @@ describe('useSlots sample code test suite', function () {
143
121
  * Look at the snapshots to compare the rendered output. The staged component will skip the intermediate levels of the react hieararchy while
144
122
  * still rendering to the correct primitives.
145
123
  */
146
- it('renders sample 2 = the two types of two level header components', function () {
147
- var styleToMerge = { color: 'black' };
124
+ it('renders sample 2 = the two types of two level header components', () => {
125
+ const styleToMerge = { color: 'black' };
148
126
  /**
149
127
  * First render the staged component. This invokes the wrapper that was built by the stagedComponent function
150
128
  */
151
- var wrapper = renderer
129
+ const wrapper = renderer
152
130
  .create(withSlots("div", null,
153
131
  withSlots(HeaderStaged, { style: styleToMerge }, "Staged component with two levels"),
154
132
  withSlots(HeaderStandard, { style: styleToMerge }, "Standard component with two levels")))
@@ -156,13 +134,13 @@ describe('useSlots sample code test suite', function () {
156
134
  expect(wrapper).toMatchSnapshot();
157
135
  });
158
136
  /** standard props for the container */
159
- var containerProps = { style: { display: 'flex', flexDirection: 'column' } };
137
+ const containerProps = { style: { display: 'flex', flexDirection: 'column' } };
160
138
  /**
161
139
  * add a quick cache to ensure that we don't thrash the styles. This is a danger any time a value from a style is added as
162
140
  * a prop on a component
163
141
  */
164
- var colorProps = {};
165
- var getColorProps = function (value) {
142
+ const colorProps = {};
143
+ const getColorProps = (value) => {
166
144
  if (value !== undefined) {
167
145
  colorProps[value] = colorProps[value] || { style: { color: value } };
168
146
  return colorProps[value];
@@ -172,19 +150,19 @@ describe('useSlots sample code test suite', function () {
172
150
  /**
173
151
  * now just create the component like a standard react functional component
174
152
  */
175
- var CaptionedHeaderStandard = function (props) {
176
- var headerColor = props.headerColor, captionColor = props.captionColor, captionText = props.captionText, children = props.children, rest = __rest(props, ["headerColor", "captionColor", "captionText", "children"]);
177
- var headerColorProps = getColorProps(headerColor);
178
- var captionColorProps = getColorProps(captionColor);
179
- return (withSlots("div", __assign({}, mergeProps(containerProps, rest)),
180
- withSlots(HeaderStandard, __assign({}, headerColorProps), children),
181
- captionText && withSlots(BoldTextStandard, __assign({}, captionColorProps), captionText)));
153
+ const CaptionedHeaderStandard = (props) => {
154
+ const { headerColor, captionColor, captionText, children, ...rest } = props;
155
+ const headerColorProps = getColorProps(headerColor);
156
+ const captionColorProps = getColorProps(captionColor);
157
+ return (withSlots("div", { ...mergeProps(containerProps, rest) },
158
+ withSlots(HeaderStandard, { ...headerColorProps }, children),
159
+ captionText && withSlots(BoldTextStandard, { ...captionColorProps }, captionText)));
182
160
  };
183
- CaptionedHeaderStandard.displayName = "CaptionedHeaderStandard';";
161
+ CaptionedHeaderStandard.displayName = `CaptionedHeaderStandard';`;
184
162
  /**
185
163
  * now build the same component using slots hook. This will also add use of the style injection pattern
186
164
  */
187
- var useCaptionedHeaderSlots = buildUseSlots({
165
+ const useCaptionedHeaderSlots = buildUseSlots({
188
166
  /** Slots are just like above, this component will have three sub-components */
189
167
  slots: {
190
168
  container: 'div',
@@ -192,37 +170,37 @@ describe('useSlots sample code test suite', function () {
192
170
  caption: BoldTextStaged,
193
171
  },
194
172
  /** useStyling is an optional function that turns props into props for the sub-components */
195
- useStyling: function (props) { return ({
173
+ useStyling: (props) => ({
196
174
  container: containerProps,
197
175
  header: getColorProps(props.headerColor),
198
176
  caption: getColorProps(props.captionColor),
199
- }); },
177
+ }),
200
178
  });
201
179
  /** a mask to clear props that we don't want to pass to the inner view */
202
- var clearCustomProps = { headerColor: undefined, captionColor: undefined };
180
+ const clearCustomProps = { headerColor: undefined, captionColor: undefined };
203
181
  /**
204
182
  * now use the hook to implement it as a staged component
205
183
  */
206
- var CaptionedHeaderStaged = stagedComponent(function (props) {
184
+ const CaptionedHeaderStaged = stagedComponent((props) => {
207
185
  // At the point where this is called the slots are initialized with the initial prop values from useStyling above
208
- var Slots = useCaptionedHeaderSlots(props);
209
- return function (extra, children) {
186
+ const Slots = useCaptionedHeaderSlots(props);
187
+ return (extra, children) => {
210
188
  // merge the props together, picking out the caption text and clearing any custom values we don't want forwarded to the view
211
- var _a = mergeProps(props, extra, clearCustomProps), captionText = _a.captionText, rest = __rest(_a, ["captionText"]);
189
+ const { captionText, ...rest } = mergeProps(props, extra, clearCustomProps);
212
190
  // now render using the slots. Any values passed in via JSX will be merged with values from the slot hook above
213
- return (withSlots(Slots.container, __assign({}, rest),
191
+ return (withSlots(Slots.container, { ...rest },
214
192
  withSlots(Slots.header, null, children),
215
193
  captionText && withSlots(Slots.caption, null, captionText)));
216
194
  };
217
195
  });
218
196
  CaptionedHeaderStaged.displayName = 'CaptionedHeaderStaged';
219
- it('renders sample 3 - the two types of higher order header components', function () {
220
- var styleToMerge = { backgroundColor: 'gray', borderColor: 'purple', borderWidth: 1 };
197
+ it('renders sample 3 - the two types of higher order header components', () => {
198
+ const styleToMerge = { backgroundColor: 'gray', borderColor: 'purple', borderWidth: 1 };
221
199
  /**
222
200
  * Render the two sets of components. Note in the snapshots how the render tree layers for the standard approach are starting
223
201
  * to add up.
224
202
  */
225
- var wrapper = renderer
203
+ const wrapper = renderer
226
204
  .create(withSlots("div", null,
227
205
  withSlots("span", null, "--- SIMPLE USAGE COMPARISON ---"),
228
206
  withSlots(CaptionedHeaderStandard, { style: styleToMerge }, "Standard HOC"),
@@ -1 +1 @@
1
- {"version":3,"file":"useSlots.samples.test.js","sourceRoot":"","sources":["../src/useSlots.samples.test.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAQhD;;;GAGG;AAEH,QAAQ,CAAC,iCAAiC,EAAE;IAC1C;;;OAGG;IAEH;;;;;OAKG;IAEH,IAAM,aAAa,GAAc,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,EAAE,CAAC;IAEhE;;OAEG;IACH,IAAM,gBAAgB,GAAgE,UAAC,KAAyC;QAC9H;;WAEG;QACK,IAAA,QAAQ,GAAc,KAAK,SAAnB,EAAK,IAAI,UAAK,KAAK,EAA7B,YAAqB,CAAF,CAAW;QAEpC;;;WAGG;QACH,OAAO,+BAAU,UAAU,CAAC,aAAa,EA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,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.buildUseSlots = void 0;
4
- var use_slot_1 = require("@fluentui-react-native/use-slot");
4
+ const use_slot_1 = require("@fluentui-react-native/use-slot");
5
5
  function buildUseSlots(options) {
6
- var slots = options.slots, _a = options.filters, filters = _a === void 0 ? {} : _a, useStyling = options.useStyling;
7
- return function () {
8
- var args = [];
9
- for (var _i = 0; _i < arguments.length; _i++) {
10
- args[_i] = arguments[_i];
11
- }
6
+ const { slots, filters = {}, useStyling } = options;
7
+ return (...args) => {
12
8
  // get the baseline slot props to render with the slots
13
9
  // eslint-disable-next-line @typescript-eslint/ban-types
14
- var slotProps = typeof useStyling === 'function' ? useStyling.apply(void 0, args) : (useStyling || {});
10
+ const slotProps = typeof useStyling === 'function' ? useStyling(...args) : (useStyling || {});
15
11
  // build up a set of slots closures and store them in props
16
- var builtSlots = {};
12
+ const builtSlots = {};
17
13
  // for each slot go through and either cache the slot props or call part one render if it is staged
18
- Object.keys(slots).forEach(function (slotName) {
14
+ Object.keys(slots).forEach((slotName) => {
19
15
  builtSlots[slotName] = (0, use_slot_1.useSlot)(slots[slotName], slotProps[slotName], filters[slotName]);
20
16
  });
21
17
  // return the prebuilt closures, these will have internal references to state.results
@@ -1 +1 @@
1
- {"version":3,"file":"buildUseSlots.js","sourceRoot":"","sources":["../src/buildUseSlots.ts"],"names":[],"mappings":";;;AACA,4DAA0D;AAgB1D,SAAgB,aAAa,CAAa,OAAmC;IACnE,IAAA,KAAK,GAA+B,OAAO,MAAtC,EAAE,KAA6B,OAAO,QAAxB,EAAZ,OAAO,mBAAG,EAAE,KAAA,EAAE,UAAU,GAAK,OAAO,WAAZ,CAAa;IACpD,OAAO;QAAC,cAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,yBAAc;;QACpB,uDAAuD;QACvD,wDAAwD;QACxD,IAAM,SAAS,GAAe,OAAO,UAAU,KAAK,UAAU,CAAC,CAAC,CA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AAC;QAC1F,CAAC,CAAC,CAAC;QAEH,qFAAqF;QACrF,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC;AAlBD,sCAkBC"}
@@ -1,15 +1,4 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
3
  if (k2 === undefined) k2 = k;
15
4
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -34,29 +23,29 @@ var __importStar = (this && this.__importStar) || function (mod) {
34
23
  return result;
35
24
  };
36
25
  Object.defineProperty(exports, "__esModule", { value: true });
37
- var react_native_1 = require("react-native");
38
- var use_slot_1 = require("@fluentui-react-native/use-slot");
39
- var renderer = __importStar(require("react-test-renderer"));
40
- var buildUseSlots_1 = require("./buildUseSlots");
41
- var useSlotsBase = (0, buildUseSlots_1.buildUseSlots)({
26
+ const react_native_1 = require("react-native");
27
+ const use_slot_1 = require("@fluentui-react-native/use-slot");
28
+ const renderer = __importStar(require("react-test-renderer"));
29
+ const buildUseSlots_1 = require("./buildUseSlots");
30
+ const useSlotsBase = (0, buildUseSlots_1.buildUseSlots)({
42
31
  slots: {
43
32
  outer: react_native_1.View,
44
33
  inner: react_native_1.View,
45
34
  content: react_native_1.Text,
46
35
  },
47
36
  });
48
- var CompBase = (0, use_slot_1.stagedComponent)(function (props) {
49
- var Slots = useSlotsBase(props);
50
- return function (extra) {
51
- var merged = __assign(__assign({}, props), extra);
52
- return ((0, use_slot_1.withSlots)(Slots.outer, __assign({}, merged),
37
+ const CompBase = (0, use_slot_1.stagedComponent)((props) => {
38
+ const Slots = useSlotsBase(props);
39
+ return (extra) => {
40
+ const merged = { ...props, ...extra };
41
+ return ((0, use_slot_1.withSlots)(Slots.outer, { ...merged },
53
42
  (0, use_slot_1.withSlots)(Slots.inner, { style: { backgroundColor: 'blue', width: 20, height: 10 } },
54
43
  (0, use_slot_1.withSlots)(Slots.content, null, "Hello"))));
55
44
  };
56
45
  });
57
- describe('buildUseSlots test suite', function () {
58
- it('Simple component render', function () {
59
- var tree = renderer.create((0, use_slot_1.withSlots)(CompBase, { style: { width: 30, height: 20, borderColor: 'green', borderWidth: 1 } })).toJSON();
46
+ describe('buildUseSlots test suite', () => {
47
+ it('Simple component render', () => {
48
+ const tree = renderer.create((0, use_slot_1.withSlots)(CompBase, { style: { width: 30, height: 20, borderColor: 'green', borderWidth: 1 } })).toJSON();
60
49
  expect(tree).toMatchSnapshot();
61
50
  });
62
51
  });
@@ -1 +1 @@
1
- {"version":3,"file":"buildUseSlots.test.js","sourceRoot":"","sources":["../src/buildUseSlots.test.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,6CAA0C;AAE1C,4DAA6E;AAC7E,4DAAgD;AAEhD,iDAAgD;AAQhD,IAAM,YAAY,GAAG,IAAA,6BAAa,EAAa;IAC7C,KAAK,EAAE;QACL,KAAK,EAAE,mBAAI;QACX,KAAK,EAAE,mBAAI;QACX,OAAO,EAAE,mBAAI;KACd;CACF,CAAC,CAAC;AAEH,IAAM,QAAQ,GAAG,IAAA,0BAAe,EAAC,UAAC,KAAgB;IAChD,IAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IAClC,OAAO,UAAC,KAAgB;QACtB,IAAM,MAAM,yBAAQ,KAAK,GAAK,KAAK,CAAE,CAAC;QACtC,OAAO,CACL,0BAAC,KAAK,CAAC,KAAK,eAAK,MAAM;YACrB,0BAAC,KAAK,CAAC,KAAK,IAAC,KAAK,EAAE,EAAE,eAAe,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;g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AE,EAAE;gBACpE,0BAAC,KAAK,CAAC,OAAO,gBAAsB,CACxB,CACF,CACf,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACxC,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACjC,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,0BAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,EAAE,GAAI,CAAC,CAAC,MAAM,EAAE,CAAC;QAC5H,MAAM,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;IACjC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,15 +1,4 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
3
  if (k2 === undefined) k2 = k;
15
4
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -33,27 +22,16 @@ var __importStar = (this && this.__importStar) || function (mod) {
33
22
  __setModuleDefault(result, mod);
34
23
  return result;
35
24
  };
36
- var __rest = (this && this.__rest) || function (s, e) {
37
- var t = {};
38
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
39
- t[p] = s[p];
40
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
41
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
42
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
43
- t[p[i]] = s[p[i]];
44
- }
45
- return t;
46
- };
47
25
  Object.defineProperty(exports, "__esModule", { value: true });
48
- var merge_props_1 = require("@fluentui-react-native/merge-props");
49
- var use_slot_1 = require("@fluentui-react-native/use-slot");
50
- var renderer = __importStar(require("react-test-renderer"));
51
- var buildUseSlots_1 = require("./buildUseSlots");
26
+ const merge_props_1 = require("@fluentui-react-native/merge-props");
27
+ const use_slot_1 = require("@fluentui-react-native/use-slot");
28
+ const renderer = __importStar(require("react-test-renderer"));
29
+ const buildUseSlots_1 = require("./buildUseSlots");
52
30
  /**
53
31
  * This file contains samples and description to help explain what the useSlots hook does and why it is useful
54
32
  * for building components.
55
33
  */
56
- describe('useSlots sample code test suite', function () {
34
+ describe('useSlots sample code test suite', () => {
57
35
  /**
58
36
  * The first mechanism to understand is the stagedComponent mechanic. This allows a component to be written, separating
59
37
  * hook calls and component rendering. This allows it to be safely called as a function by a higher order component, even conditionally.
@@ -64,20 +42,20 @@ describe('useSlots sample code test suite', function () {
64
42
  * First we are going to create a wrapped text component that bolds all text. One component will be authored as a staged
65
43
  * component and one as a regular component.
66
44
  */
67
- var boldBaseProps = { style: { fontWeight: 900 } };
45
+ const boldBaseProps = { style: { fontWeight: 900 } };
68
46
  /**
69
47
  * First create the bold text in the standard way. This is just a function component.
70
48
  */
71
- var BoldTextStandard = function (props) {
49
+ const BoldTextStandard = (props) => {
72
50
  /**
73
51
  * Pick out the children to pass them on to the child Text element
74
52
  */
75
- var children = props.children, rest = __rest(props, ["children"]);
53
+ const { children, ...rest } = props;
76
54
  /**
77
55
  * Now render the text, merging the baseProps with the style updates with the rest param. Note that this leverages the fact
78
56
  * that mergeProps will reliably produce style objects with the same reference, given the same inputs.
79
57
  */
80
- return (0, use_slot_1.withSlots)("span", __assign({}, (0, merge_props_1.mergeProps)(boldBaseProps, rest)), children);
58
+ return (0, use_slot_1.withSlots)("span", { ...(0, merge_props_1.mergeProps)(boldBaseProps, rest) }, children);
81
59
  };
82
60
  BoldTextStandard.displayName = 'BoldTextStandard';
83
61
  /**
@@ -86,26 +64,26 @@ describe('useSlots sample code test suite', function () {
86
64
  *
87
65
  * The stagedComponent function takes an input function of this form and wraps it in a function component that react knows how to render
88
66
  */
89
- var BoldTextStaged = (0, use_slot_1.stagedComponent)(function (props) {
67
+ const BoldTextStaged = (0, use_slot_1.stagedComponent)((props) => {
90
68
  /**
91
69
  * This section would be where hook/styling code would go, props here would include everything coming in from the base react tree with the
92
70
  * exception of children, which will be passed in stage 2.
93
71
  */
94
- return function (extra, children) {
72
+ return (extra, children) => {
95
73
  /**
96
74
  * extra are additional props that may be filled in by a higher order component. They should not include styling and are only props the
97
75
  * enclosing component are passing to the JSX elements
98
76
  */
99
- return (0, use_slot_1.withSlots)("span", __assign({}, (0, merge_props_1.mergeProps)(boldBaseProps, props, extra)), children);
77
+ return (0, use_slot_1.withSlots)("span", { ...(0, merge_props_1.mergeProps)(boldBaseProps, props, extra) }, children);
100
78
  };
101
79
  });
102
80
  BoldTextStaged.displayName = 'BoldTextStaged';
103
- it('renders sample 1 - the two types of basic bold text components', function () {
104
- var styleToMerge = { color: 'black' };
81
+ it('renders sample 1 - the two types of basic bold text components', () => {
82
+ const styleToMerge = { color: 'black' };
105
83
  /**
106
84
  * First render the staged component. This invokes the wrapper that was built by the stagedComponent function
107
85
  */
108
- var wrapper = renderer
86
+ const wrapper = renderer
109
87
  .create((0, use_slot_1.withSlots)("div", null,
110
88
  (0, use_slot_1.withSlots)(BoldTextStaged, { style: styleToMerge }, "Staged component at one level"),
111
89
  (0, use_slot_1.withSlots)(BoldTextStandard, { style: styleToMerge }, "Standard component of a single level")))
@@ -118,16 +96,16 @@ describe('useSlots sample code test suite', function () {
118
96
  * Next we will build a layer on top of the previously authored components to turn the bold text components into header components. This is
119
97
  * to illustrate the way in which components can be commonly built on top of other simpler components.
120
98
  */
121
- var headerBaseProps = { style: { fontSize: 20 } };
99
+ const headerBaseProps = { style: { fontSize: 20 } };
122
100
  /**
123
101
  * The standard way of doing things is a repeat of what happens above. Grab the children, pass them on, merge the rest of the props with
124
102
  * base props.
125
103
  *
126
104
  * This again leverages style merging via mergeProps to avoid changing the references of the style objects on every render
127
105
  */
128
- var HeaderStandard = function (props) {
129
- var children = props.children, rest = __rest(props, ["children"]);
130
- return (0, use_slot_1.withSlots)(BoldTextStandard, __assign({}, (0, merge_props_1.mergeProps)(headerBaseProps, rest)), children);
106
+ const HeaderStandard = (props) => {
107
+ const { children, ...rest } = props;
108
+ return (0, use_slot_1.withSlots)(BoldTextStandard, { ...(0, merge_props_1.mergeProps)(headerBaseProps, rest) }, children);
131
109
  };
132
110
  HeaderStandard.displayName = 'HeaderStandard';
133
111
  /**
@@ -137,11 +115,11 @@ describe('useSlots sample code test suite', function () {
137
115
  *
138
116
  * This should be built once, and consumed by the component, not built on the fly inside
139
117
  */
140
- var useHeaderSlots = (0, buildUseSlots_1.buildUseSlots)({ slots: { text: BoldTextStaged } });
118
+ const useHeaderSlots = (0, buildUseSlots_1.buildUseSlots)({ slots: { text: BoldTextStaged } });
141
119
  /**
142
120
  * Now author the staged component using the slot hook
143
121
  */
144
- var HeaderStaged = (0, use_slot_1.stagedComponent)(function (props) {
122
+ const HeaderStaged = (0, use_slot_1.stagedComponent)((props) => {
145
123
  /**
146
124
  * Call the slots hook (or any hook) outside of the inner closure. The useSlots hook will return an object with each slot as a renderable
147
125
  * function. The hooks for sub-components will be called as part of this call. Props passed in at this point will be the props that appear
@@ -149,9 +127,9 @@ describe('useSlots sample code test suite', function () {
149
127
  *
150
128
  * Note that while we are passing in props, in the simple usage case it isn't used and could be omitted if desired
151
129
  * */
152
- var BoldText = useHeaderSlots(props).text;
130
+ const BoldText = useHeaderSlots(props).text;
153
131
  /** Now the inner closure, pretty much the same as before */
154
- return function (extra, children) {
132
+ return (extra, children) => {
155
133
  /**
156
134
  * Instead of rendering the <BoldTextStageed> component directly we render using the slot. If this is a staged component it will call the
157
135
  * inner closure directly, without going through createElement. Entries passed into the JSX, including children, are what appear in the
@@ -160,7 +138,7 @@ describe('useSlots sample code test suite', function () {
160
138
  * NOTE: this requires using the withSlots helper via the jsx directive. This knows how to pick apart the entries and just call the second
161
139
  * part of the function
162
140
  */
163
- return (0, use_slot_1.withSlots)(BoldText, __assign({}, (0, merge_props_1.mergeProps)(headerBaseProps, props, extra)), children);
141
+ return (0, use_slot_1.withSlots)(BoldText, { ...(0, merge_props_1.mergeProps)(headerBaseProps, props, extra) }, children);
164
142
  };
165
143
  });
166
144
  HeaderStaged.displayName = 'HeaderStaged';
@@ -168,12 +146,12 @@ describe('useSlots sample code test suite', function () {
168
146
  * Look at the snapshots to compare the rendered output. The staged component will skip the intermediate levels of the react hieararchy while
169
147
  * still rendering to the correct primitives.
170
148
  */
171
- it('renders sample 2 = the two types of two level header components', function () {
172
- var styleToMerge = { color: 'black' };
149
+ it('renders sample 2 = the two types of two level header components', () => {
150
+ const styleToMerge = { color: 'black' };
173
151
  /**
174
152
  * First render the staged component. This invokes the wrapper that was built by the stagedComponent function
175
153
  */
176
- var wrapper = renderer
154
+ const wrapper = renderer
177
155
  .create((0, use_slot_1.withSlots)("div", null,
178
156
  (0, use_slot_1.withSlots)(HeaderStaged, { style: styleToMerge }, "Staged component with two levels"),
179
157
  (0, use_slot_1.withSlots)(HeaderStandard, { style: styleToMerge }, "Standard component with two levels")))
@@ -181,13 +159,13 @@ describe('useSlots sample code test suite', function () {
181
159
  expect(wrapper).toMatchSnapshot();
182
160
  });
183
161
  /** standard props for the container */
184
- var containerProps = { style: { display: 'flex', flexDirection: 'column' } };
162
+ const containerProps = { style: { display: 'flex', flexDirection: 'column' } };
185
163
  /**
186
164
  * add a quick cache to ensure that we don't thrash the styles. This is a danger any time a value from a style is added as
187
165
  * a prop on a component
188
166
  */
189
- var colorProps = {};
190
- var getColorProps = function (value) {
167
+ const colorProps = {};
168
+ const getColorProps = (value) => {
191
169
  if (value !== undefined) {
192
170
  colorProps[value] = colorProps[value] || { style: { color: value } };
193
171
  return colorProps[value];
@@ -197,19 +175,19 @@ describe('useSlots sample code test suite', function () {
197
175
  /**
198
176
  * now just create the component like a standard react functional component
199
177
  */
200
- var CaptionedHeaderStandard = function (props) {
201
- var headerColor = props.headerColor, captionColor = props.captionColor, captionText = props.captionText, children = props.children, rest = __rest(props, ["headerColor", "captionColor", "captionText", "children"]);
202
- var headerColorProps = getColorProps(headerColor);
203
- var captionColorProps = getColorProps(captionColor);
204
- return ((0, use_slot_1.withSlots)("div", __assign({}, (0, merge_props_1.mergeProps)(containerProps, rest)),
205
- (0, use_slot_1.withSlots)(HeaderStandard, __assign({}, headerColorProps), children),
206
- captionText && (0, use_slot_1.withSlots)(BoldTextStandard, __assign({}, captionColorProps), captionText)));
178
+ const CaptionedHeaderStandard = (props) => {
179
+ const { headerColor, captionColor, captionText, children, ...rest } = props;
180
+ const headerColorProps = getColorProps(headerColor);
181
+ const captionColorProps = getColorProps(captionColor);
182
+ return ((0, use_slot_1.withSlots)("div", { ...(0, merge_props_1.mergeProps)(containerProps, rest) },
183
+ (0, use_slot_1.withSlots)(HeaderStandard, { ...headerColorProps }, children),
184
+ captionText && (0, use_slot_1.withSlots)(BoldTextStandard, { ...captionColorProps }, captionText)));
207
185
  };
208
- CaptionedHeaderStandard.displayName = "CaptionedHeaderStandard';";
186
+ CaptionedHeaderStandard.displayName = `CaptionedHeaderStandard';`;
209
187
  /**
210
188
  * now build the same component using slots hook. This will also add use of the style injection pattern
211
189
  */
212
- var useCaptionedHeaderSlots = (0, buildUseSlots_1.buildUseSlots)({
190
+ const useCaptionedHeaderSlots = (0, buildUseSlots_1.buildUseSlots)({
213
191
  /** Slots are just like above, this component will have three sub-components */
214
192
  slots: {
215
193
  container: 'div',
@@ -217,37 +195,37 @@ describe('useSlots sample code test suite', function () {
217
195
  caption: BoldTextStaged,
218
196
  },
219
197
  /** useStyling is an optional function that turns props into props for the sub-components */
220
- useStyling: function (props) { return ({
198
+ useStyling: (props) => ({
221
199
  container: containerProps,
222
200
  header: getColorProps(props.headerColor),
223
201
  caption: getColorProps(props.captionColor),
224
- }); },
202
+ }),
225
203
  });
226
204
  /** a mask to clear props that we don't want to pass to the inner view */
227
- var clearCustomProps = { headerColor: undefined, captionColor: undefined };
205
+ const clearCustomProps = { headerColor: undefined, captionColor: undefined };
228
206
  /**
229
207
  * now use the hook to implement it as a staged component
230
208
  */
231
- var CaptionedHeaderStaged = (0, use_slot_1.stagedComponent)(function (props) {
209
+ const CaptionedHeaderStaged = (0, use_slot_1.stagedComponent)((props) => {
232
210
  // At the point where this is called the slots are initialized with the initial prop values from useStyling above
233
- var Slots = useCaptionedHeaderSlots(props);
234
- return function (extra, children) {
211
+ const Slots = useCaptionedHeaderSlots(props);
212
+ return (extra, children) => {
235
213
  // merge the props together, picking out the caption text and clearing any custom values we don't want forwarded to the view
236
- var _a = (0, merge_props_1.mergeProps)(props, extra, clearCustomProps), captionText = _a.captionText, rest = __rest(_a, ["captionText"]);
214
+ const { captionText, ...rest } = (0, merge_props_1.mergeProps)(props, extra, clearCustomProps);
237
215
  // now render using the slots. Any values passed in via JSX will be merged with values from the slot hook above
238
- return ((0, use_slot_1.withSlots)(Slots.container, __assign({}, rest),
216
+ return ((0, use_slot_1.withSlots)(Slots.container, { ...rest },
239
217
  (0, use_slot_1.withSlots)(Slots.header, null, children),
240
218
  captionText && (0, use_slot_1.withSlots)(Slots.caption, null, captionText)));
241
219
  };
242
220
  });
243
221
  CaptionedHeaderStaged.displayName = 'CaptionedHeaderStaged';
244
- it('renders sample 3 - the two types of higher order header components', function () {
245
- var styleToMerge = { backgroundColor: 'gray', borderColor: 'purple', borderWidth: 1 };
222
+ it('renders sample 3 - the two types of higher order header components', () => {
223
+ const styleToMerge = { backgroundColor: 'gray', borderColor: 'purple', borderWidth: 1 };
246
224
  /**
247
225
  * Render the two sets of components. Note in the snapshots how the render tree layers for the standard approach are starting
248
226
  * to add up.
249
227
  */
250
- var wrapper = renderer
228
+ const wrapper = renderer
251
229
  .create((0, use_slot_1.withSlots)("div", null,
252
230
  (0, use_slot_1.withSlots)("span", null, "--- SIMPLE USAGE COMPARISON ---"),
253
231
  (0, use_slot_1.withSlots)(CaptionedHeaderStandard, { style: styleToMerge }, "Standard HOC"),
@@ -1 +1 @@
1
- {"version":3,"file":"useSlots.samples.test.js","sourceRoot":"","sources":["../src/useSlots.samples.test.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,kEAAgE;AAChE,4DAA6E;AAC7E,4DAAgD;AAEhD,iDAAgD;AAQhD;;;GAGG;AAEH,QAAQ,CAAC,iCAAiC,EAAE;IAC1C;;;OAGG;IAEH;;;;;OAKG;IAEH,IAAM,aAAa,GAAc,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,EAAE,CAAC;IAEhE;;OAEG;IACH,IAAM,gBAAgB,GAAgE,UAAC,KAAyC;QAC9H;;WAEG;QACK,IAAA,QAAQ,GAAc,KAAK,SAAnB,EAAK,IAAI,UAAK,KAAK,EAA7B,YAAqB,CAAF,CAAW;QAEpC;;;WAGG;QACH,OAAO,+CAAU,IAAA,wBAAU,EAAC,aAAa,EAAE,IAAI,CAAC,GAAG,QAAQ,CAAQ,CAAC;IACtE,CAAC,CAAC;IACF,gBAAgB,CAAC,WAAW,GAAG,kBAAkB,CAAC;IAElD;;;;;OAKG;IACH,IAAM,cAAc,GAAG,IAAA,0BAAe,EAAC,UAAC,KAAyC;QAC/E;;;WAGG;QACH,OAAO,UAAC,KAAgB,EAAE,QAAyB;YACjD;;;eAGG;YACH,OAAO,+CAAU,IAAA,wBAAU,EAAC,aAAa,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,QAAQ,CAAQ,CAAC;QAC9E,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,cAAc,CAAC,WAAW,GAAG,gBAAgB,CAAC;IAE9C,EAAE,CAAC,gEAAgE,EAAE;QACnE,IAAM,YAAY,GAAc,EAAE,KAAK,EAAE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AC,EAAE,CAAC;QAEnG;;;WAGG;QACH,MAAM,OAAO,GAAG,QAAQ;aACrB,MAAM,CACL;YACE,0EAA4C;YAC5C,0BAAC,uBAAuB,IAAC,KAAK,EAAE,YAAY,mBAAwC;YACpF,0BAAC,qBAAqB,IAAC,KAAK,EAAE,YAAY,iBAAoC;YAC9E,2EAA6C;YAC7C,0BAAC,uBAAuB,IAAC,KAAK,EAAE,YAAY,EAAE,WAAW,EAAC,cAAc,gCAE9C;YAC1B,0BAAC,qBAAqB,IAAC,KAAK,EAAE,YAAY,EAAE,WAAW,EAAC,cAAc,8BAE9C;YACxB,8FAAgE;YAChE,0BAAC,uBAAuB,IAAC,KAAK,EAAE,YAAY,EAAE,WAAW,EAAC,cAAc,EAAC,YAAY,EAAC,QAAQ,EAAC,WAAW,EAAC,KAAK,mDAEtF;YAC1B,0BAAC,qBAAqB,IAAC,KAAK,EAAE,YAAY,EAAE,WAAW,EAAC,cAAc,EAAC,YAAY,EAAC,QAAQ,EAAC,WAAW,EAAC,KAAK,iDAEtF,CACpB,CACP;aACA,MAAM,EAAE,CAAC;QACZ,MAAM,CAAC,OAAO,CAAC,CAAC,eAAe,EAAE,CAAC;IACpC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui-react-native/use-slots",
3
- "version": "0.10.3",
3
+ "version": "0.10.5",
4
4
  "description": "Hook function to return styled slots",
5
5
  "repository": {
6
6
  "type": "git",
@@ -9,6 +9,13 @@
9
9
  },
10
10
  "main": "lib-commonjs/index.js",
11
11
  "module": "lib/index.js",
12
+ "exports": {
13
+ ".": {
14
+ "import": "./lib/index.js",
15
+ "require": "./lib-commonjs/index.js",
16
+ "types": "./lib/index.d.ts"
17
+ }
18
+ },
12
19
  "typings": "lib/index.d.ts",
13
20
  "scripts": {
14
21
  "build": "fluentui-scripts build",
@@ -27,11 +34,11 @@
27
34
  "author": "",
28
35
  "license": "MIT",
29
36
  "dependencies": {
30
- "@fluentui-react-native/use-slot": "0.6.3"
37
+ "@fluentui-react-native/use-slot": "0.6.5"
31
38
  },
32
39
  "devDependencies": {
33
40
  "@babel/core": "^7.20.0",
34
- "@fluentui-react-native/merge-props": "0.9.2",
41
+ "@fluentui-react-native/merge-props": "0.9.4",
35
42
  "@fluentui-react-native/scripts": "0.1.1",
36
43
  "@react-native/babel-preset": "^0.74.0",
37
44
  "@react-native/metro-config": "^0.74.0",
@@ -57,6 +64,7 @@
57
64
  ]
58
65
  },
59
66
  "capabilities": [
67
+ "babel-preset-react-native",
60
68
  "core",
61
69
  "core-android",
62
70
  "core-ios",
package/.eslintrc.js DELETED
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- extends: ['@fluentui-react-native/eslint-config-rules'],
3
- };