@fluentui/react-utilities 0.0.0-nightly906d31cfa320211115.1 → 0.0.0-nightly99adff5a9a20211125.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +13 -11
- package/CHANGELOG.md +5 -6
- package/dist/react-utilities.d.ts +25 -3
- package/lib/compose/types.d.ts +2 -3
- package/lib/compose/types.js.map +1 -1
- package/lib/utils/getNativeElementProps.d.ts +22 -0
- package/lib/utils/getNativeElementProps.js +22 -0
- package/lib/utils/getNativeElementProps.js.map +1 -1
- package/lib-commonjs/compose/types.d.ts +2 -3
- package/lib-commonjs/compose/types.js.map +1 -1
- package/lib-commonjs/utils/getNativeElementProps.d.ts +22 -0
- package/lib-commonjs/utils/getNativeElementProps.js +25 -1
- package/lib-commonjs/utils/getNativeElementProps.js.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.json
CHANGED
@@ -2,22 +2,24 @@
|
|
2
2
|
"name": "@fluentui/react-utilities",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "
|
6
|
-
"tag": "@fluentui/react-utilities_v0.0.0-
|
7
|
-
"version": "0.0.0-
|
5
|
+
"date": "Thu, 25 Nov 2021 04:13:57 GMT",
|
6
|
+
"tag": "@fluentui/react-utilities_v0.0.0-nightly99adff5a9a20211125.1",
|
7
|
+
"version": "0.0.0-nightly99adff5a9a20211125.1",
|
8
8
|
"comments": {
|
9
|
-
"
|
9
|
+
"none": [
|
10
10
|
{
|
11
|
-
"author": "
|
11
|
+
"author": "lingfangao@hotmail.com",
|
12
12
|
"package": "@fluentui/react-utilities",
|
13
|
-
"commit": "
|
14
|
-
"comment": "
|
15
|
-
}
|
13
|
+
"commit": "718e63006d8d07d24efab9c32942041963d78dc7",
|
14
|
+
"comment": "Migrate package to use solution style ts-configs"
|
15
|
+
}
|
16
|
+
],
|
17
|
+
"prerelease": [
|
16
18
|
{
|
17
|
-
"author": "
|
19
|
+
"author": "behowell@microsoft.com",
|
18
20
|
"package": "@fluentui/react-utilities",
|
19
|
-
"
|
20
|
-
"
|
21
|
+
"commit": "99adff5a9aab9086e8bc4737040654ab23f0febe",
|
22
|
+
"comment": "Update utility types to support specifying a primary slot other than root"
|
21
23
|
}
|
22
24
|
]
|
23
25
|
}
|
package/CHANGELOG.md
CHANGED
@@ -1,18 +1,17 @@
|
|
1
1
|
# Change Log - @fluentui/react-utilities
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Thu, 25 Nov 2021 04:13:57 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
-
## [0.0.0-
|
7
|
+
## [0.0.0-nightly99adff5a9a20211125.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v0.0.0-nightly99adff5a9a20211125.1)
|
8
8
|
|
9
|
-
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.0.0-beta.3..@fluentui/react-utilities_v0.0.0-
|
9
|
+
Thu, 25 Nov 2021 04:13:57 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.0.0-beta.3..@fluentui/react-utilities_v0.0.0-nightly99adff5a9a20211125.1)
|
11
11
|
|
12
12
|
### Changes
|
13
13
|
|
14
|
-
-
|
15
|
-
- Bump @fluentui/keyboard-keys to v0.0.0-nightly906d31cfa320211115.1 ([commit](https://github.com/microsoft/fluentui/commit/05edacbae8d85aa6b3d4164f9cd7d1465b47f246) by beachball)
|
14
|
+
- Update utility types to support specifying a primary slot other than root ([PR #20617](https://github.com/microsoft/fluentui/pull/20617) by behowell@microsoft.com)
|
16
15
|
|
17
16
|
## [9.0.0-beta.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.0.0-beta.3)
|
18
17
|
|
@@ -75,7 +75,7 @@ export declare const colProperties: Record<string, number>;
|
|
75
75
|
|
76
76
|
export declare type ComponentProps<Shorthands extends ObjectShorthandPropsRecord, Primary extends keyof Shorthands = 'root'> = Omit<{
|
77
77
|
[Key in keyof Shorthands]?: ShorthandProps<NonNullable<Shorthands[Key]>>;
|
78
|
-
}, Primary> & PropsWithoutRef<Shorthands[Primary]>;
|
78
|
+
}, Primary & 'root'> & PropsWithoutRef<Shorthands[Primary]>;
|
79
79
|
|
80
80
|
export declare type ComponentState<Shorthands extends ObjectShorthandPropsRecord> = {
|
81
81
|
components?: {
|
@@ -89,8 +89,7 @@ export declare type ComponentState<Shorthands extends ObjectShorthandPropsRecord
|
|
89
89
|
* This should ONLY be used in type templates as in `extends DefaultObjectShorthandProps`;
|
90
90
|
* it shouldn't be used as the type of a slot.
|
91
91
|
*/
|
92
|
-
export declare type DefaultObjectShorthandProps = ObjectShorthandProps<{
|
93
|
-
children?: React_2.ReactNode;
|
92
|
+
export declare type DefaultObjectShorthandProps = ObjectShorthandProps<Pick<React_2.HTMLAttributes<HTMLElement>, 'children' | 'className' | 'style'> & {
|
94
93
|
as?: keyof JSX.IntrinsicElements;
|
95
94
|
}>;
|
96
95
|
|
@@ -150,6 +149,29 @@ export declare function getNativeElementProps<TAttributes extends React_2.HTMLAt
|
|
150
149
|
*/
|
151
150
|
export declare function getNativeProps<T extends Record<string, any>>(props: Record<string, any>, allowedPropNames: string[] | Record<string, number>, excludedPropNames?: string[]): T;
|
152
151
|
|
152
|
+
/**
|
153
|
+
* Splits the native props into ones that go to the `root` slot, and ones that go to the primary slot.
|
154
|
+
*
|
155
|
+
* This function is only for use with components that have a primary slot other than `root`.
|
156
|
+
* Most components should use {@link getNativeElementProps} for their root slot if it is the primary slot.
|
157
|
+
*
|
158
|
+
* @returns An object containing the native props for the `root` and primary slots.
|
159
|
+
*/
|
160
|
+
export declare const getPartitionedNativeProps: ({ primarySlotTagName, props, excludedPropNames, }: {
|
161
|
+
/** The primary slot's element type (e.g. 'div') */
|
162
|
+
primarySlotTagName: keyof JSX.IntrinsicElements;
|
163
|
+
/** The component's props object */
|
164
|
+
props: Pick<React_2.HTMLAttributes<HTMLElement>, 'style' | 'className'>;
|
165
|
+
/** List of native props to exclude from the returned value */
|
166
|
+
excludedPropNames?: string[] | undefined;
|
167
|
+
}) => {
|
168
|
+
root: {
|
169
|
+
style: React_2.CSSProperties | undefined;
|
170
|
+
className: string | undefined;
|
171
|
+
};
|
172
|
+
primary: React_2.HTMLAttributes<any>;
|
173
|
+
};
|
174
|
+
|
153
175
|
/**
|
154
176
|
* Finds and swaps a provided key for it's right to left format.
|
155
177
|
*/
|
package/lib/compose/types.d.ts
CHANGED
@@ -8,8 +8,7 @@ export declare type ShorthandProps<Props extends DefaultObjectShorthandProps> =
|
|
8
8
|
* This should ONLY be used in type templates as in `extends DefaultObjectShorthandProps`;
|
9
9
|
* it shouldn't be used as the type of a slot.
|
10
10
|
*/
|
11
|
-
export declare type DefaultObjectShorthandProps = ObjectShorthandProps<{
|
12
|
-
children?: React.ReactNode;
|
11
|
+
export declare type DefaultObjectShorthandProps = ObjectShorthandProps<Pick<React.HTMLAttributes<HTMLElement>, 'children' | 'className' | 'style'> & {
|
13
12
|
as?: keyof JSX.IntrinsicElements;
|
14
13
|
}>;
|
15
14
|
/**
|
@@ -78,7 +77,7 @@ export declare type UnionToIntersection<U> = (U extends unknown ? (x: U) => U :
|
|
78
77
|
export declare type PropsWithoutRef<P> = 'ref' extends keyof P ? (P extends unknown ? Omit<P, 'ref'> : P) : P;
|
79
78
|
export declare type ComponentProps<Shorthands extends ObjectShorthandPropsRecord, Primary extends keyof Shorthands = 'root'> = Omit<{
|
80
79
|
[Key in keyof Shorthands]?: ShorthandProps<NonNullable<Shorthands[Key]>>;
|
81
|
-
}, Primary> & PropsWithoutRef<Shorthands[Primary]>;
|
80
|
+
}, Primary & 'root'> & PropsWithoutRef<Shorthands[Primary]>;
|
82
81
|
export declare type ComponentState<Shorthands extends ObjectShorthandPropsRecord> = {
|
83
82
|
components?: {
|
84
83
|
[Key in keyof Shorthands]-?: React.ComponentType<NonNullable<Shorthands[Key]> extends ObjectShorthandProps<infer P> ? P : NonNullable<Shorthands[Key]>> | (NonNullable<Shorthands[Key]> extends AsIntrinsicElement<infer As> ? As : keyof JSX.IntrinsicElements);
|
package/lib/compose/types.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/compose/types.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"sources":["../../src/compose/types.ts"],"names":[],"mappings":"WAgJA;AACA;AACA;AACA;AACA","sourceRoot":""}
|
@@ -7,3 +7,25 @@ import * as React from 'react';
|
|
7
7
|
* @param excludedPropNames - List of props to disallow
|
8
8
|
*/
|
9
9
|
export declare function getNativeElementProps<TAttributes extends React.HTMLAttributes<any>>(tagName: string, props: {}, excludedPropNames?: string[]): TAttributes;
|
10
|
+
/**
|
11
|
+
* Splits the native props into ones that go to the `root` slot, and ones that go to the primary slot.
|
12
|
+
*
|
13
|
+
* This function is only for use with components that have a primary slot other than `root`.
|
14
|
+
* Most components should use {@link getNativeElementProps} for their root slot if it is the primary slot.
|
15
|
+
*
|
16
|
+
* @returns An object containing the native props for the `root` and primary slots.
|
17
|
+
*/
|
18
|
+
export declare const getPartitionedNativeProps: ({ primarySlotTagName, props, excludedPropNames, }: {
|
19
|
+
/** The primary slot's element type (e.g. 'div') */
|
20
|
+
primarySlotTagName: keyof JSX.IntrinsicElements;
|
21
|
+
/** The component's props object */
|
22
|
+
props: Pick<React.HTMLAttributes<HTMLElement>, 'style' | 'className'>;
|
23
|
+
/** List of native props to exclude from the returned value */
|
24
|
+
excludedPropNames?: string[] | undefined;
|
25
|
+
}) => {
|
26
|
+
root: {
|
27
|
+
style: React.CSSProperties | undefined;
|
28
|
+
className: string | undefined;
|
29
|
+
};
|
30
|
+
primary: React.HTMLAttributes<any>;
|
31
|
+
};
|
@@ -35,4 +35,26 @@ export function getNativeElementProps(tagName, props, excludedPropNames) {
|
|
35
35
|
allowedPropNames.as = 1;
|
36
36
|
return getNativeProps(props, allowedPropNames, excludedPropNames);
|
37
37
|
}
|
38
|
+
/**
|
39
|
+
* Splits the native props into ones that go to the `root` slot, and ones that go to the primary slot.
|
40
|
+
*
|
41
|
+
* This function is only for use with components that have a primary slot other than `root`.
|
42
|
+
* Most components should use {@link getNativeElementProps} for their root slot if it is the primary slot.
|
43
|
+
*
|
44
|
+
* @returns An object containing the native props for the `root` and primary slots.
|
45
|
+
*/
|
46
|
+
|
47
|
+
export const getPartitionedNativeProps = ({
|
48
|
+
primarySlotTagName,
|
49
|
+
props,
|
50
|
+
excludedPropNames
|
51
|
+
}) => {
|
52
|
+
return {
|
53
|
+
root: {
|
54
|
+
style: props.style,
|
55
|
+
className: props.className
|
56
|
+
},
|
57
|
+
primary: getNativeElementProps(primarySlotTagName, props, [...(excludedPropNames || []), 'style', 'className'])
|
58
|
+
};
|
59
|
+
};
|
38
60
|
//# sourceMappingURL=getNativeElementProps.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/utils/getNativeElementProps.ts"],"names":[],"mappings":"AACA,SACE,eADF,EAEE,eAFF,EAGE,eAHF,EAIE,YAJF,EAKE,YALF,EAME,gBANF,EAOE,gBAPF,EAQE,eARF,EASE,kBATF,EAUE,gBAVF,EAWE,gBAXF,EAYE,eAZF,EAaE,YAbF,EAcE,YAdF,EAeE,YAfF,EAgBE,kBAhBF,EAiBE,aAjBF,EAkBE,cAlBF,EAmBE,gBAnBF,EAoBE,aApBF,EAqBE,qBArBF,EAsBE,cAtBF,QAuBO,cAvBP;AAyBA,MAAM,gBAAgB,GAA2C;AAC/D,EAAA,KAAK,EAAE,eADwD;AAE/D,EAAA,KAAK,EAAE,eAFwD;AAG/D,EAAA,KAAK,EAAE,eAHwD;AAI/D,EAAA,EAAE,EAAE,YAJ2D;AAK/D,EAAA,EAAE,EAAE,YAL2D;AAM/D,EAAA,CAAC,EAAE,gBAN4D;AAO/D,EAAA,MAAM,EAAE,gBAPuD;AAQ/D,EAAA,KAAK,EAAE,eARwD;AAS/D,EAAA,QAAQ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,GAAP;AAID,CAlBM","sourceRoot":""}
|
@@ -8,8 +8,7 @@ export declare type ShorthandProps<Props extends DefaultObjectShorthandProps> =
|
|
8
8
|
* This should ONLY be used in type templates as in `extends DefaultObjectShorthandProps`;
|
9
9
|
* it shouldn't be used as the type of a slot.
|
10
10
|
*/
|
11
|
-
export declare type DefaultObjectShorthandProps = ObjectShorthandProps<{
|
12
|
-
children?: React.ReactNode;
|
11
|
+
export declare type DefaultObjectShorthandProps = ObjectShorthandProps<Pick<React.HTMLAttributes<HTMLElement>, 'children' | 'className' | 'style'> & {
|
13
12
|
as?: keyof JSX.IntrinsicElements;
|
14
13
|
}>;
|
15
14
|
/**
|
@@ -78,7 +77,7 @@ export declare type UnionToIntersection<U> = (U extends unknown ? (x: U) => U :
|
|
78
77
|
export declare type PropsWithoutRef<P> = 'ref' extends keyof P ? (P extends unknown ? Omit<P, 'ref'> : P) : P;
|
79
78
|
export declare type ComponentProps<Shorthands extends ObjectShorthandPropsRecord, Primary extends keyof Shorthands = 'root'> = Omit<{
|
80
79
|
[Key in keyof Shorthands]?: ShorthandProps<NonNullable<Shorthands[Key]>>;
|
81
|
-
}, Primary> & PropsWithoutRef<Shorthands[Primary]>;
|
80
|
+
}, Primary & 'root'> & PropsWithoutRef<Shorthands[Primary]>;
|
82
81
|
export declare type ComponentState<Shorthands extends ObjectShorthandPropsRecord> = {
|
83
82
|
components?: {
|
84
83
|
[Key in keyof Shorthands]-?: React.ComponentType<NonNullable<Shorthands[Key]> extends ObjectShorthandProps<infer P> ? P : NonNullable<Shorthands[Key]>> | (NonNullable<Shorthands[Key]> extends AsIntrinsicElement<infer As> ? As : keyof JSX.IntrinsicElements);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/compose/types.ts"],"names":[],"mappings":";;;;
|
1
|
+
{"version":3,"sources":["../../src/compose/types.ts"],"names":[],"mappings":";;;;IAgJA;AACA;AACA;AACA;AACA","sourceRoot":""}
|
@@ -7,3 +7,25 @@ import * as React from 'react';
|
|
7
7
|
* @param excludedPropNames - List of props to disallow
|
8
8
|
*/
|
9
9
|
export declare function getNativeElementProps<TAttributes extends React.HTMLAttributes<any>>(tagName: string, props: {}, excludedPropNames?: string[]): TAttributes;
|
10
|
+
/**
|
11
|
+
* Splits the native props into ones that go to the `root` slot, and ones that go to the primary slot.
|
12
|
+
*
|
13
|
+
* This function is only for use with components that have a primary slot other than `root`.
|
14
|
+
* Most components should use {@link getNativeElementProps} for their root slot if it is the primary slot.
|
15
|
+
*
|
16
|
+
* @returns An object containing the native props for the `root` and primary slots.
|
17
|
+
*/
|
18
|
+
export declare const getPartitionedNativeProps: ({ primarySlotTagName, props, excludedPropNames, }: {
|
19
|
+
/** The primary slot's element type (e.g. 'div') */
|
20
|
+
primarySlotTagName: keyof JSX.IntrinsicElements;
|
21
|
+
/** The component's props object */
|
22
|
+
props: Pick<React.HTMLAttributes<HTMLElement>, 'style' | 'className'>;
|
23
|
+
/** List of native props to exclude from the returned value */
|
24
|
+
excludedPropNames?: string[] | undefined;
|
25
|
+
}) => {
|
26
|
+
root: {
|
27
|
+
style: React.CSSProperties | undefined;
|
28
|
+
className: string | undefined;
|
29
|
+
};
|
30
|
+
primary: React.HTMLAttributes<any>;
|
31
|
+
};
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.getNativeElementProps = void 0;
|
6
|
+
exports.getPartitionedNativeProps = exports.getNativeElementProps = void 0;
|
7
7
|
|
8
8
|
const properties_1 = /*#__PURE__*/require("./properties");
|
9
9
|
|
@@ -45,4 +45,28 @@ function getNativeElementProps(tagName, props, excludedPropNames) {
|
|
45
45
|
}
|
46
46
|
|
47
47
|
exports.getNativeElementProps = getNativeElementProps;
|
48
|
+
/**
|
49
|
+
* Splits the native props into ones that go to the `root` slot, and ones that go to the primary slot.
|
50
|
+
*
|
51
|
+
* This function is only for use with components that have a primary slot other than `root`.
|
52
|
+
* Most components should use {@link getNativeElementProps} for their root slot if it is the primary slot.
|
53
|
+
*
|
54
|
+
* @returns An object containing the native props for the `root` and primary slots.
|
55
|
+
*/
|
56
|
+
|
57
|
+
const getPartitionedNativeProps = ({
|
58
|
+
primarySlotTagName,
|
59
|
+
props,
|
60
|
+
excludedPropNames
|
61
|
+
}) => {
|
62
|
+
return {
|
63
|
+
root: {
|
64
|
+
style: props.style,
|
65
|
+
className: props.className
|
66
|
+
},
|
67
|
+
primary: getNativeElementProps(primarySlotTagName, props, [...(excludedPropNames || []), 'style', 'className'])
|
68
|
+
};
|
69
|
+
};
|
70
|
+
|
71
|
+
exports.getPartitionedNativeProps = getPartitionedNativeProps;
|
48
72
|
//# sourceMappingURL=getNativeElementProps.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/utils/getNativeElementProps.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,YAAA,gBAAA,OAAA,CAAA,cAAA,CAAA;;AAyBA,MAAM,gBAAgB,GAA2C;AAC/D,EAAA,KAAK,EAAE,YAAA,CAAA,eADwD;AAE/D,EAAA,KAAK,EAAE,YAAA,CAAA,eAFwD;AAG/D,EAAA,KAAK,EAAE,YAAA,CAAA,eAHwD;AAI/D,EAAA,EAAE,EAAE,YAAA,CAAA,YAJ2D;AAK/D,EAAA,EAAE,EAAE,YAAA,CAAA,YAL2D;AAM/D,EAAA,CAAC,EAAE,YAAA,CAAA,gBAN4D;AAO/D,EAAA,MAAM,EAAE,YAAA,CAAA,gBAPuD;AAQ/D,EAAA,KAAK,EAAE,YAAA,CAAA,eARwD;AAS/D,EAAA,QAAQ,EAAE,YAAA,CAAA,kBATqD;AAU/D,EAAA,MAAM,EAAE,YAAA,CAAA,gBAVuD;AAW/D,EAAA,MAAM,EAAE,YAAA,CAAA,gBAXuD;AAY/D,EAAA,KAAK,EAAE,YAAA,CAAA,eAZwD;AAa/D,EAAA,EAAE,EAAE,YAAA,CAAA,YAb2D;AAc/D,EAAA,EAAE,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wC,WAAxC,CAA5B;AAFzB,GAAP;AAID,CAlBM;;AAAM,OAAA,CAAA,yBAAA,GAAyB,yBAAzB","sourceRoot":""}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-utilities",
|
3
|
-
"version": "0.0.0-
|
3
|
+
"version": "0.0.0-nightly99adff5a9a20211125.1",
|
4
4
|
"description": "A set of general React-specific utilities.",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -20,9 +20,9 @@
|
|
20
20
|
"lint": "just-scripts lint",
|
21
21
|
"test": "jest",
|
22
22
|
"docs": "api-extractor run --config=config/api-extractor.local.json --local",
|
23
|
-
"build:local": "tsc -p . --module esnext --emitDeclarationOnly && node ../../scripts/typescript/normalize-import --output dist/react-utilities/src && yarn docs",
|
24
|
-
"
|
25
|
-
"
|
23
|
+
"build:local": "tsc -p ./tsconfig.lib.json --module esnext --emitDeclarationOnly && node ../../scripts/typescript/normalize-import --output ./dist/packages/react-utilities/src && yarn docs",
|
24
|
+
"start": "yarn storybook",
|
25
|
+
"type-check": "tsc -b tsconfig.json"
|
26
26
|
},
|
27
27
|
"devDependencies": {
|
28
28
|
"@fluentui/eslint-plugin": "*",
|
@@ -37,7 +37,7 @@
|
|
37
37
|
"react-test-renderer": "^16.3.0"
|
38
38
|
},
|
39
39
|
"dependencies": {
|
40
|
-
"@fluentui/keyboard-keys": "0.0.0-
|
40
|
+
"@fluentui/keyboard-keys": "0.0.0-nightly99adff5a9a20211125.0",
|
41
41
|
"tslib": "^2.1.0"
|
42
42
|
},
|
43
43
|
"peerDependencies": {
|