@fluentui/react-utilities 9.3.0 → 9.3.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 +30 -1
- package/CHANGELOG.md +11 -2
- package/dist/index.d.ts +2 -2
- package/lib/compose/getSlots.js +0 -8
- package/lib/compose/getSlots.js.map +1 -1
- package/lib/compose/isResolvedShorthand.js +0 -1
- package/lib/compose/isResolvedShorthand.js.map +1 -1
- package/lib/compose/resolveShorthand.js +2 -6
- package/lib/compose/resolveShorthand.js.map +1 -1
- package/lib/hooks/useControllableState.js +6 -12
- package/lib/hooks/useControllableState.js.map +1 -1
- package/lib/hooks/useEventCallback.js +0 -1
- package/lib/hooks/useEventCallback.js.map +1 -1
- package/lib/hooks/useFirstMount.js +0 -3
- package/lib/hooks/useFirstMount.js.map +1 -1
- package/lib/hooks/useForceUpdate.js +0 -1
- package/lib/hooks/useForceUpdate.js.map +1 -1
- package/lib/hooks/useId.js +0 -3
- package/lib/hooks/useId.js.map +1 -1
- package/lib/hooks/useIsomorphicLayoutEffect.js +0 -1
- package/lib/hooks/useIsomorphicLayoutEffect.js.map +1 -1
- package/lib/hooks/useMergedRefs.js +2 -3
- package/lib/hooks/useMergedRefs.js.map +1 -1
- package/lib/hooks/useOnClickOutside.js +8 -26
- package/lib/hooks/useOnClickOutside.js.map +1 -1
- package/lib/hooks/useOnScrollOutside.js +0 -4
- package/lib/hooks/useOnScrollOutside.js.map +1 -1
- package/lib/hooks/usePrevious.js +0 -1
- package/lib/hooks/usePrevious.js.map +1 -1
- package/lib/hooks/useTimeout.js +2 -3
- package/lib/hooks/useTimeout.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/ssr/SSRContext.js +4 -11
- package/lib/ssr/SSRContext.js.map +1 -1
- package/lib/ssr/canUseDOM.js +2 -1
- package/lib/ssr/canUseDOM.js.map +1 -1
- package/lib/trigger/applyTriggerPropsToChildren.js +2 -6
- package/lib/trigger/applyTriggerPropsToChildren.js.map +1 -1
- package/lib/trigger/getTriggerChild.js +2 -3
- package/lib/trigger/getTriggerChild.js.map +1 -1
- package/lib/trigger/isFluentTrigger.js.map +1 -1
- package/lib/utils/getNativeElementProps.js +0 -2
- package/lib/utils/getNativeElementProps.js.map +1 -1
- package/lib/utils/getRTLSafeKey.js +0 -2
- package/lib/utils/getRTLSafeKey.js.map +1 -1
- package/lib/utils/getReactCallbackName.js +0 -3
- package/lib/utils/getReactCallbackName.js.map +1 -1
- package/lib/utils/isHTMLElement.js +2 -2
- package/lib/utils/isHTMLElement.js.map +1 -1
- package/lib/utils/isInteractiveHTMLElement.js +0 -4
- package/lib/utils/isInteractiveHTMLElement.js.map +1 -1
- package/lib/utils/mergeCallbacks.js.map +1 -1
- package/lib/utils/omit.js +0 -2
- package/lib/utils/omit.js.map +1 -1
- package/lib/utils/properties.js +7 -36
- package/lib/utils/properties.js.map +1 -1
- package/lib-amd/utils/isHTMLElement.js +4 -3
- package/lib-amd/utils/isHTMLElement.js.map +1 -1
- package/lib-amd/utils/isInteractiveHTMLElement.js.map +1 -1
- package/lib-commonjs/compose/getSlots.js +0 -12
- package/lib-commonjs/compose/getSlots.js.map +1 -1
- package/lib-commonjs/compose/index.js +0 -5
- package/lib-commonjs/compose/index.js.map +1 -1
- package/lib-commonjs/compose/isResolvedShorthand.js +0 -4
- package/lib-commonjs/compose/isResolvedShorthand.js.map +1 -1
- package/lib-commonjs/compose/resolveShorthand.js +2 -9
- package/lib-commonjs/compose/resolveShorthand.js.map +1 -1
- package/lib-commonjs/compose/types.js.map +1 -1
- package/lib-commonjs/hooks/index.js +0 -12
- package/lib-commonjs/hooks/index.js.map +1 -1
- package/lib-commonjs/hooks/useControllableState.js +6 -14
- package/lib-commonjs/hooks/useControllableState.js.map +1 -1
- package/lib-commonjs/hooks/useEventCallback.js +0 -5
- package/lib-commonjs/hooks/useEventCallback.js.map +1 -1
- package/lib-commonjs/hooks/useFirstMount.js +0 -6
- package/lib-commonjs/hooks/useFirstMount.js.map +1 -1
- package/lib-commonjs/hooks/useForceUpdate.js +0 -4
- package/lib-commonjs/hooks/useForceUpdate.js.map +1 -1
- package/lib-commonjs/hooks/useId.js +0 -8
- package/lib-commonjs/hooks/useId.js.map +1 -1
- package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js +0 -4
- package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js.map +1 -1
- package/lib-commonjs/hooks/useMergedRefs.js +2 -6
- package/lib-commonjs/hooks/useMergedRefs.js.map +1 -1
- package/lib-commonjs/hooks/useOnClickOutside.js +8 -30
- package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -1
- package/lib-commonjs/hooks/useOnScrollOutside.js +0 -8
- package/lib-commonjs/hooks/useOnScrollOutside.js.map +1 -1
- package/lib-commonjs/hooks/usePrevious.js +0 -4
- package/lib-commonjs/hooks/usePrevious.js.map +1 -1
- package/lib-commonjs/hooks/useTimeout.js +2 -6
- package/lib-commonjs/hooks/useTimeout.js.map +1 -1
- package/lib-commonjs/index.js +0 -10
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/ssr/SSRContext.js +4 -17
- package/lib-commonjs/ssr/SSRContext.js.map +1 -1
- package/lib-commonjs/ssr/canUseDOM.js +2 -3
- package/lib-commonjs/ssr/canUseDOM.js.map +1 -1
- package/lib-commonjs/ssr/index.js +0 -3
- package/lib-commonjs/ssr/index.js.map +1 -1
- package/lib-commonjs/trigger/applyTriggerPropsToChildren.js +2 -10
- package/lib-commonjs/trigger/applyTriggerPropsToChildren.js.map +1 -1
- package/lib-commonjs/trigger/getTriggerChild.js +2 -7
- package/lib-commonjs/trigger/getTriggerChild.js.map +1 -1
- package/lib-commonjs/trigger/index.js +0 -5
- package/lib-commonjs/trigger/index.js.map +1 -1
- package/lib-commonjs/trigger/isFluentTrigger.js +0 -2
- package/lib-commonjs/trigger/isFluentTrigger.js.map +1 -1
- package/lib-commonjs/trigger/types.js.map +1 -1
- package/lib-commonjs/utils/clamp.js +0 -2
- package/lib-commonjs/utils/clamp.js.map +1 -1
- package/lib-commonjs/utils/getNativeElementProps.js +0 -6
- package/lib-commonjs/utils/getNativeElementProps.js.map +1 -1
- package/lib-commonjs/utils/getRTLSafeKey.js +0 -4
- package/lib-commonjs/utils/getRTLSafeKey.js.map +1 -1
- package/lib-commonjs/utils/getReactCallbackName.js +0 -5
- package/lib-commonjs/utils/getReactCallbackName.js.map +1 -1
- package/lib-commonjs/utils/index.js +0 -9
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/isHTMLElement.js +2 -4
- package/lib-commonjs/utils/isHTMLElement.js.map +1 -1
- package/lib-commonjs/utils/isInteractiveHTMLElement.js +0 -7
- package/lib-commonjs/utils/isInteractiveHTMLElement.js.map +1 -1
- package/lib-commonjs/utils/mergeCallbacks.js +0 -2
- package/lib-commonjs/utils/mergeCallbacks.js.map +1 -1
- package/lib-commonjs/utils/omit.js +0 -4
- package/lib-commonjs/utils/omit.js.map +1 -1
- package/lib-commonjs/utils/properties.js +7 -38
- package/lib-commonjs/utils/properties.js.map +1 -1
- package/package.json +2 -2
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.getPartitionedNativeProps = exports.getNativeElementProps = void 0;
|
7
|
-
|
8
7
|
const properties_1 = /*#__PURE__*/require("./properties");
|
9
|
-
|
10
8
|
const nativeElementMap = {
|
11
9
|
label: properties_1.labelProperties,
|
12
10
|
audio: properties_1.audioProperties,
|
@@ -40,13 +38,11 @@ const nativeElementMap = {
|
|
40
38
|
* @param excludedPropNames - List of props to disallow
|
41
39
|
*/
|
42
40
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
43
|
-
|
44
41
|
function getNativeElementProps(tagName, props, excludedPropNames) {
|
45
42
|
const allowedPropNames = tagName && nativeElementMap[tagName] || properties_1.htmlElementProperties;
|
46
43
|
allowedPropNames.as = 1;
|
47
44
|
return properties_1.getNativeProps(props, allowedPropNames, excludedPropNames);
|
48
45
|
}
|
49
|
-
|
50
46
|
exports.getNativeElementProps = getNativeElementProps;
|
51
47
|
/**
|
52
48
|
* Splits the native props into ones that go to the `root` slot, and ones that go to the primary slot.
|
@@ -56,7 +52,6 @@ exports.getNativeElementProps = getNativeElementProps;
|
|
56
52
|
*
|
57
53
|
* @returns An object containing the native props for the `root` and primary slots.
|
58
54
|
*/
|
59
|
-
|
60
55
|
const getPartitionedNativeProps = ({
|
61
56
|
primarySlotTagName,
|
62
57
|
props,
|
@@ -70,6 +65,5 @@ const getPartitionedNativeProps = ({
|
|
70
65
|
primary: getNativeElementProps(primarySlotTagName, props, [...(excludedPropNames || []), 'style', 'className'])
|
71
66
|
};
|
72
67
|
};
|
73
|
-
|
74
68
|
exports.getPartitionedNativeProps = getPartitionedNativeProps;
|
75
69
|
//# sourceMappingURL=getNativeElementProps.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"mappings":";;;;;;AACA;AA4BA,MAAMA,gBAAgB,GAA2C;EAC/DC,KAAK,EAAEC,4BAAe;EACtBC,KAAK,EAAED,4BAAe;EACtBE,KAAK,EAAEF,4BAAe;EACtBG,EAAE,EAAEH,yBAAY;EAChBI,EAAE,EAAEJ,yBAAY;EAChBK,CAAC,EAAEL,6BAAgB;EACnBM,MAAM,EAAEN,6BAAgB;EACxBO,KAAK,EAAEP,4BAAe;EACtBQ,QAAQ,EAAER,+BAAkB;EAC5BS,MAAM,EAAET,6BAAgB;EACxBU,MAAM,EAAEV,6BAAgB;EACxBW,KAAK,EAAEX,4BAAe;EACtBY,EAAE,EAAEZ,yBAAY;EAChBa,EAAE,EAAEb,yBAAY;EAChBc,EAAE,EAAEd,yBAAY;EAChBe,QAAQ,EAAEf,+BAAkB;EAC5BgB,GAAG,EAAEhB,0BAAa;EAClBiB,QAAQ,EAAEjB,+BAAkB;EAC5BkB,IAAI,EAAElB,2BAAc;EACpBmB,MAAM,EAAEnB,6BAAgB;EACxBoB,GAAG,EAAEpB,0BAAa;EAClBqB,IAAI,EAAErB,2BAAc;EACpBsB,MAAM,EAAEtB;CACT;AAED;;;;;;;AAOA;AACA,SAAgBuB,qBAAqB,CACnCC,OAAe,EACfC,KAAS,EACTC,iBAA4B;EAE5B,MAAMC,gBAAgB,GAAIH,OAAO,IAAI1B,gBAAgB,CAAC0B,OAAO,CAAC,IAAKxB,kCAAqB;EACxF2B,gBAAgB,CAACC,EAAE,GAAG,CAAC;EAEvB,OAAO5B,2BAAc,CAACyB,KAAK,EAAEE,gBAAgB,EAAED,iBAAiB,CAAC;AACnE;AATAG;AAWA;;;;;;;;AAQO,MAAMC,yBAAyB,GAAG,CAGvC;EACAC,kBAAkB;EAClBN,KAAK;EACLC;AAAiB,CAUlB,KAAI;EACH,OAAO;IACLM,IAAI,EAAE;MAAEC,KAAK,EAAER,KAAK,CAACQ,KAAK;MAAEC,SAAS,EAAET,KAAK,CAACS;IAAS,CAAE;IACxDC,OAAO,EAAEZ,qBAAqB,CAAgCQ,kBAAkB,EAAEN,KAAK,EAAE,CACvF,IAAIC,iBAAiB,IAAI,EAAE,CAAC,EAC5B,OAAO,EACP,WAAW,CACZ;GACF;AACH,CAAC;AAzBYG,iCAAyB","names":["nativeElementMap","label","properties_1","audio","video","ol","li","a","button","input","textarea","select","option","table","tr","th","td","colGroup","col","fieldset","form","iframe","img","time","dialog","getNativeElementProps","tagName","props","excludedPropNames","allowedPropNames","as","exports","getPartitionedNativeProps","primarySlotTagName","root","style","className","primary"],"sourceRoot":"../src/","sources":["packages/react-components/react-utilities/src/utils/getNativeElementProps.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n labelProperties,\n audioProperties,\n videoProperties,\n olProperties,\n liProperties,\n anchorProperties,\n buttonProperties,\n inputProperties,\n textAreaProperties,\n selectProperties,\n optionProperties,\n tableProperties,\n trProperties,\n thProperties,\n tdProperties,\n colGroupProperties,\n colProperties,\n fieldsetProperties,\n formProperties,\n iframeProperties,\n imgProperties,\n htmlElementProperties,\n getNativeProps,\n timeProperties,\n dialogProperties,\n} from './properties';\n\nconst nativeElementMap: Record<string, Record<string, number>> = {\n label: labelProperties,\n audio: audioProperties,\n video: videoProperties,\n ol: olProperties,\n li: liProperties,\n a: anchorProperties,\n button: buttonProperties,\n input: inputProperties,\n textarea: textAreaProperties,\n select: selectProperties,\n option: optionProperties,\n table: tableProperties,\n tr: trProperties,\n th: thProperties,\n td: tdProperties,\n colGroup: colGroupProperties,\n col: colProperties,\n fieldset: fieldsetProperties,\n form: formProperties,\n iframe: iframeProperties,\n img: imgProperties,\n time: timeProperties,\n dialog: dialogProperties,\n};\n\n/**\n * Given an element tagname and user props, filters the props to only allowed props for the given\n * element type.\n * @param tagName - Tag name (e.g. \"div\")\n * @param props - Props object\n * @param excludedPropNames - List of props to disallow\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function getNativeElementProps<TAttributes extends React.HTMLAttributes<any>>(\n tagName: string,\n props: {},\n excludedPropNames?: string[],\n): TAttributes {\n const allowedPropNames = (tagName && nativeElementMap[tagName]) || htmlElementProperties;\n allowedPropNames.as = 1;\n\n return getNativeProps(props, allowedPropNames, excludedPropNames);\n}\n\n/**\n * Splits the native props into ones that go to the `root` slot, and ones that go to the primary slot.\n *\n * This function is only for use with components that have a primary slot other than `root`.\n * Most components should use {@link getNativeElementProps} for their root slot if it is the primary slot.\n *\n * @returns An object containing the native props for the `root` and primary slots.\n */\nexport const getPartitionedNativeProps = <\n Props extends Pick<React.HTMLAttributes<HTMLElement>, 'style' | 'className'>,\n ExcludedPropKeys extends Extract<keyof Props, string> = never\n>({\n primarySlotTagName,\n props,\n excludedPropNames,\n}: {\n /** The primary slot's element type (e.g. 'div') */\n primarySlotTagName: keyof JSX.IntrinsicElements;\n\n /** The component's props object */\n props: Props;\n\n /** List of native props to exclude from the returned value */\n excludedPropNames?: ExcludedPropKeys[];\n}) => {\n return {\n root: { style: props.style, className: props.className },\n primary: getNativeElementProps<Omit<Props, ExcludedPropKeys>>(primarySlotTagName, props, [\n ...(excludedPropNames || []),\n 'style',\n 'className',\n ]),\n };\n};\n"]}
|
@@ -8,7 +8,6 @@ exports.getRTLSafeKey = void 0;
|
|
8
8
|
* @internal
|
9
9
|
* Finds and swaps a provided key for it's right to left format.
|
10
10
|
*/
|
11
|
-
|
12
11
|
const getRTLSafeKey = (key, dir) => {
|
13
12
|
if (dir === 'rtl') {
|
14
13
|
switch (key) {
|
@@ -16,16 +15,13 @@ const getRTLSafeKey = (key, dir) => {
|
|
16
15
|
{
|
17
16
|
return 'ArrowRight';
|
18
17
|
}
|
19
|
-
|
20
18
|
case 'ArrowRight':
|
21
19
|
{
|
22
20
|
return 'ArrowLeft';
|
23
21
|
}
|
24
22
|
}
|
25
23
|
}
|
26
|
-
|
27
24
|
return key;
|
28
25
|
};
|
29
|
-
|
30
26
|
exports.getRTLSafeKey = getRTLSafeKey;
|
31
27
|
//# sourceMappingURL=getRTLSafeKey.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"mappings":";;;;;;AAAA;;;;AAIO,MAAMA,aAAa,GAAG,CAACC,GAAW,EAAEC,GAAkB,KAAI;EAC/D,IAAIA,GAAG,KAAK,KAAK,EAAE;IACjB,QAAQD,GAAG;MACT,KAAK,WAAW;QAAE;UAChB,OAAO,YAAY;;MAGrB,KAAK,YAAY;QAAE;UACjB,OAAO,WAAW;;IACnB;;EAIL,OAAOA,GAAG;AACZ,CAAC;AAdYE,qBAAa","names":["getRTLSafeKey","key","dir","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-utilities/src/utils/getRTLSafeKey.ts"],"sourcesContent":["/**\n * @internal\n * Finds and swaps a provided key for it's right to left format.\n */\nexport const getRTLSafeKey = (key: string, dir: 'ltr' | 'rtl') => {\n if (dir === 'rtl') {\n switch (key) {\n case 'ArrowLeft': {\n return 'ArrowRight';\n }\n\n case 'ArrowRight': {\n return 'ArrowLeft';\n }\n }\n }\n\n return key;\n};\n"]}
|
@@ -11,25 +11,20 @@ exports.getReactCallbackName = void 0;
|
|
11
11
|
* ".eventPhase" there has proper value, see https://github.com/facebook/react/pull/19244. In React 16 all events
|
12
12
|
* are handled in bubble phase.
|
13
13
|
*/
|
14
|
-
|
15
14
|
function getReactCallbackName(event) {
|
16
15
|
if (event._reactName) {
|
17
16
|
return event._reactName;
|
18
17
|
}
|
19
|
-
|
20
18
|
if (event.dispatchConfig) {
|
21
19
|
if (event.dispatchConfig.registrationName) {
|
22
20
|
return event.dispatchConfig.registrationName;
|
23
21
|
}
|
24
|
-
|
25
22
|
return event.dispatchConfig.phasedRegistrationNames.bubbled;
|
26
23
|
}
|
27
|
-
|
28
24
|
if (process.env.NODE_ENV !== 'production') {
|
29
25
|
// eslint-disable-next-line no-console
|
30
26
|
console.error(['Passed React.SyntheticEvent does not contain ".dispatchConfig" or "._reactName".', 'This should not happen, please report it to https://github.com/microsoft/fluentui']);
|
31
27
|
}
|
32
28
|
}
|
33
|
-
|
34
29
|
exports.getReactCallbackName = getReactCallbackName;
|
35
30
|
//# sourceMappingURL=getReactCallbackName.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"mappings":";;;;;;AAwBA;;;;;;;AAOA,SAAgBA,oBAAoB,CAACC,KAA0B;EAC7D,IAAIA,KAAK,CAACC,UAAU,EAAE;IACpB,OAAOD,KAAK,CAACC,UAA+B;;EAG9C,IAAID,KAAK,CAACE,cAAc,EAAE;IACxB,IAAIF,KAAK,CAACE,cAAc,CAACC,gBAAgB,EAAE;MACzC,OAAOH,KAAK,CAACE,cAAc,CAACC,gBAAqC;;IAGnE,OAAOH,KAAK,CAACE,cAAc,CAACE,uBAAuB,CAACC,OAA4B;;EAGlF,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACzC;IACAC,OAAO,CAACC,KAAK,CAAC,CACZ,kFAAkF,EAClF,mFAAmF,CACpF,CAAC;;AAEN;AApBAC","names":["getReactCallbackName","event","_reactName","dispatchConfig","registrationName","phasedRegistrationNames","bubbled","process","env","NODE_ENV","console","error","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-utilities/src/utils/getReactCallbackName.ts"],"sourcesContent":["import * as React from 'react';\n\ninterface ReactSyntheticEvent extends React.SyntheticEvent<unknown> {\n // React 17/18\n // See https://github.com/facebook/react/pull/19236\n _reactName?: string;\n\n // React 16\n dispatchConfig?: {\n registrationName: string;\n phasedRegistrationNames: {\n bubbled: string;\n captured: string;\n };\n };\n}\n\ntype NonUndefined<A> = A extends undefined ? never : A;\ntype FunctionKeys<T extends object> = {\n [K in keyof T]-?: NonUndefined<T[K]> extends Function ? K : never;\n}[keyof T];\n\nexport type ReactCallbackName = FunctionKeys<React.DOMAttributes<unknown>>;\n\n/**\n * React.SyntheticEvent contains name of a callback that should be fired, this function returns it.\n *\n * Ideally, it should also distinguish regular and \"capture\" callbacks, but it's possible only with React 17 as\n * \".eventPhase\" there has proper value, see https://github.com/facebook/react/pull/19244. In React 16 all events\n * are handled in bubble phase.\n */\nexport function getReactCallbackName(event: ReactSyntheticEvent): ReactCallbackName | undefined {\n if (event._reactName) {\n return event._reactName as ReactCallbackName;\n }\n\n if (event.dispatchConfig) {\n if (event.dispatchConfig.registrationName) {\n return event.dispatchConfig.registrationName as ReactCallbackName;\n }\n\n return event.dispatchConfig.phasedRegistrationNames.bubbled as ReactCallbackName;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.error([\n 'Passed React.SyntheticEvent does not contain \".dispatchConfig\" or \"._reactName\".',\n 'This should not happen, please report it to https://github.com/microsoft/fluentui',\n ]);\n }\n}\n"]}
|
@@ -3,22 +3,13 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
|
7
6
|
const tslib_1 = /*#__PURE__*/require("tslib");
|
8
|
-
|
9
7
|
tslib_1.__exportStar(require("./clamp"), exports);
|
10
|
-
|
11
8
|
tslib_1.__exportStar(require("./getNativeElementProps"), exports);
|
12
|
-
|
13
9
|
tslib_1.__exportStar(require("./getRTLSafeKey"), exports);
|
14
|
-
|
15
10
|
tslib_1.__exportStar(require("./mergeCallbacks"), exports);
|
16
|
-
|
17
11
|
tslib_1.__exportStar(require("./omit"), exports);
|
18
|
-
|
19
12
|
tslib_1.__exportStar(require("./properties"), exports);
|
20
|
-
|
21
13
|
tslib_1.__exportStar(require("./isHTMLElement"), exports);
|
22
|
-
|
23
14
|
tslib_1.__exportStar(require("./isInteractiveHTMLElement"), exports);
|
24
15
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-utilities/src/utils/index.ts"],"
|
1
|
+
{"version":3,"mappings":";;;;;;AAAAA;AACAA;AACAA;AACAA;AACAA;AACAA;AACAA;AACAA","names":["tslib_1"],"sourceRoot":"../src/","sources":["packages/react-components/react-utilities/src/utils/index.ts"],"sourcesContent":["export * from './clamp';\nexport * from './getNativeElementProps';\nexport * from './getRTLSafeKey';\nexport * from './mergeCallbacks';\nexport * from './omit';\nexport * from './properties';\nexport * from './isHTMLElement';\nexport * from './isInteractiveHTMLElement';\n"]}
|
@@ -13,12 +13,10 @@ exports.isHTMLElement = void 0;
|
|
13
13
|
* might be problematic while operating with [multiple realms](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof#instanceof_and_multiple_realms)
|
14
14
|
*
|
15
15
|
*/
|
16
|
-
|
17
16
|
function isHTMLElement(element) {
|
18
17
|
var _a;
|
19
|
-
|
20
|
-
return Boolean(
|
18
|
+
const typedElement = element;
|
19
|
+
return Boolean(typedElement !== null && ((_a = typedElement === null || typedElement === void 0 ? void 0 : typedElement.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView) && typedElement instanceof typedElement.ownerDocument.defaultView.HTMLElement);
|
21
20
|
}
|
22
|
-
|
23
21
|
exports.isHTMLElement = isHTMLElement;
|
24
22
|
//# sourceMappingURL=isHTMLElement.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"mappings":";;;;;;AAAA;;;;;;;;;AASA,SAAgBA,aAAa,CAACC,OAAiB;;EAC7C,MAAMC,YAAY,GAAGD,OAAkC;EACvD,OAAOE,OAAO,CACZD,YAAY,KAAK,IAAI,KACnB,kBAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEE,aAAa,0CAAEC,WAAW,KACxCH,YAAY,YAAYA,YAAY,CAACE,aAAa,CAACC,WAAW,CAACC,WAAW,CAC7E;AACH;AAPAC","names":["isHTMLElement","element","typedElement","Boolean","ownerDocument","defaultView","HTMLElement","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-utilities/src/utils/isHTMLElement.ts"],"sourcesContent":["/**\n * @internal\n * Verifies if a given node is an HTMLElement,\n * this method works seamlessly with frames and elements from different documents\n *\n * This is required as simply using `instanceof`\n * might be problematic while operating with [multiple realms](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof#instanceof_and_multiple_realms)\n *\n */\nexport function isHTMLElement(element?: unknown): element is HTMLElement {\n const typedElement = element as Node | null | undefined;\n return Boolean(\n typedElement !== null &&\n typedElement?.ownerDocument?.defaultView &&\n typedElement instanceof typedElement.ownerDocument.defaultView.HTMLElement,\n );\n}\n"]}
|
@@ -4,23 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.isInteractiveHTMLElement = void 0;
|
7
|
-
|
8
7
|
const isHTMLElement_1 = /*#__PURE__*/require("./isHTMLElement");
|
9
8
|
/**
|
10
9
|
* @internal
|
11
10
|
* Checks that the element has default behaviour from user input on click or 'Enter'/'Space' keys
|
12
11
|
*/
|
13
|
-
|
14
|
-
|
15
12
|
function isInteractiveHTMLElement(element) {
|
16
13
|
if (!isHTMLElement_1.isHTMLElement(element)) {
|
17
14
|
return false;
|
18
15
|
}
|
19
|
-
|
20
16
|
const {
|
21
17
|
tagName
|
22
18
|
} = element;
|
23
|
-
|
24
19
|
switch (tagName) {
|
25
20
|
case 'BUTTON':
|
26
21
|
case 'A':
|
@@ -28,9 +23,7 @@ function isInteractiveHTMLElement(element) {
|
|
28
23
|
case 'TEXTAREA':
|
29
24
|
return true;
|
30
25
|
}
|
31
|
-
|
32
26
|
return element.isContentEditable;
|
33
27
|
}
|
34
|
-
|
35
28
|
exports.isInteractiveHTMLElement = isInteractiveHTMLElement;
|
36
29
|
//# sourceMappingURL=isInteractiveHTMLElement.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"mappings":";;;;;;AAAA;AAEA;;;;AAIA,SAAgBA,wBAAwB,CAACC,OAAgB;EACvD,IAAI,CAACC,6BAAa,CAACD,OAAO,CAAC,EAAE;IAC3B,OAAO,KAAK;;EAGd,MAAM;IAAEE;EAAO,CAAE,GAAGF,OAAO;EAC3B,QAAQE,OAAO;IACb,KAAK,QAAQ;IACb,KAAK,GAAG;IACR,KAAK,OAAO;IACZ,KAAK,UAAU;MACb,OAAO,IAAI;EAAC;EAGhB,OAAOF,OAAO,CAACG,iBAAiB;AAClC;AAfAC","names":["isInteractiveHTMLElement","element","isHTMLElement_1","tagName","isContentEditable","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-utilities/src/utils/isInteractiveHTMLElement.ts"],"sourcesContent":["import { isHTMLElement } from './isHTMLElement';\n\n/**\n * @internal\n * Checks that the element has default behaviour from user input on click or 'Enter'/'Space' keys\n */\nexport function isInteractiveHTMLElement(element: unknown) {\n if (!isHTMLElement(element)) {\n return false;\n }\n\n const { tagName } = element;\n switch (tagName) {\n case 'BUTTON':\n case 'A':\n case 'INPUT':\n case 'TEXTAREA':\n return true;\n }\n\n return element.isContentEditable;\n}\n"]}
|
@@ -27,13 +27,11 @@ exports.mergeCallbacks = void 0;
|
|
27
27
|
*
|
28
28
|
* @returns A function that that calls the provided functions in order
|
29
29
|
*/
|
30
|
-
|
31
30
|
function mergeCallbacks(callback1, callback2) {
|
32
31
|
return (...args) => {
|
33
32
|
callback1 === null || callback1 === void 0 ? void 0 : callback1(...args);
|
34
33
|
callback2 === null || callback2 === void 0 ? void 0 : callback2(...args);
|
35
34
|
};
|
36
35
|
}
|
37
|
-
|
38
36
|
exports.mergeCallbacks = mergeCallbacks;
|
39
37
|
//# sourceMappingURL=mergeCallbacks.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAgBA,cAAc,CAC5BC,SAAgD,EAChDC,SAAgD;EAEhD,OAAO,CAAC,GAAGC,IAAU,KAAI;IACvBF,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAG,GAAGE,IAAI,CAAC;IACpBD,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAG,GAAGC,IAAI,CAAC;EACtB,CAAC;AACH;AARAC","names":["mergeCallbacks","callback1","callback2","args","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-utilities/src/utils/mergeCallbacks.ts"],"sourcesContent":["/**\n * @internal\n * Combine two event callbacks into a single callback function that calls each one in order.\n *\n * Usage example:\n * ```ts\n * state.slot.onChange = mergeCallbacks(state.slot.onChange, ev => {\n * // Handle onChange\n * });\n * ```\n *\n * The primary use is to avoid the need to capture an existing callback (`state.slot.onChange` in the example) to a\n * local variable before replacing with a new listener that calls the existing one. This helps avoid bugs like:\n * * Infinite recursion by calling the re-assigned state.slot.onChange if it's not captured to a local variable.\n * * Missing a call to the original onChange due to an early return or other conditional.\n *\n * If you need a callback that is stable between renders, wrap the result in {@link useEventCallback}.\n *\n * @param callback1 - The first callback to be called, or undefined\n * @param callback2 - The second callback to be called, or undefined\n *\n * @returns A function that that calls the provided functions in order\n */\nexport function mergeCallbacks<Args extends unknown[]>(\n callback1: ((...args: Args) => void) | undefined,\n callback2: ((...args: Args) => void) | undefined,\n) {\n return (...args: Args) => {\n callback1?.(...args);\n callback2?.(...args);\n };\n}\n"]}
|
@@ -18,19 +18,15 @@ exports.omit = void 0;
|
|
18
18
|
* @param exclusions - The array of keys to exclude
|
19
19
|
*/
|
20
20
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
21
|
-
|
22
21
|
function omit(obj, exclusions) {
|
23
22
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
24
23
|
const result = {};
|
25
|
-
|
26
24
|
for (const key in obj) {
|
27
25
|
if (exclusions.indexOf(key) === -1 && obj.hasOwnProperty(key)) {
|
28
26
|
result[key] = obj[key];
|
29
27
|
}
|
30
28
|
}
|
31
|
-
|
32
29
|
return result;
|
33
30
|
}
|
34
|
-
|
35
31
|
exports.omit = omit;
|
36
32
|
//# sourceMappingURL=omit.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"mappings":";;;;;;AAAA;;;;;;;;;;;;;AAaA;AACA,SAAgBA,IAAI,CAClBC,GAAS,EACTC,UAAsB;EAEtB;EACA,MAAMC,MAAM,GAAwB,EAAE;EAEtC,KAAK,MAAMC,GAAG,IAAIH,GAAG,EAAE;IACrB,IAAIC,UAAU,CAACG,OAAO,CAACD,GAAG,CAAC,KAAK,CAAC,CAAC,IAAIH,GAAG,CAACK,cAAc,CAACF,GAAG,CAAC,EAAE;MAC7DD,MAAM,CAACC,GAAG,CAAC,GAAGH,GAAG,CAACG,GAAG,CAAC;;;EAI1B,OAAOD,MAAc;AACvB;AAdAI","names":["omit","obj","exclusions","result","key","indexOf","hasOwnProperty","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-utilities/src/utils/omit.ts"],"sourcesContent":["/**\n * Tiny helper to do the minimal amount of work in duplicating an object but omitting some\n * props. This ends up faster than using object ...rest or reduce to filter.\n *\n * This behaves very much like filteredAssign, but does not merge many objects together,\n * uses an exclusion object map, and avoids spreads all for optimal performance.\n *\n * See perf test for background:\n * https://jsperf.com/omit-vs-rest-vs-reduce/1\n *\n * @param obj - The object to clone\n * @param exclusions - The array of keys to exclude\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function omit<TObj extends Record<string, any>, Exclusions extends (keyof TObj)[]>(\n obj: TObj,\n exclusions: Exclusions,\n): Omit<TObj, Exclusions[number]> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const result: Record<string, any> = {};\n\n for (const key in obj) {\n if (exclusions.indexOf(key) === -1 && obj.hasOwnProperty(key)) {\n result[key] = obj[key];\n }\n }\n\n return result as TObj;\n}\n"]}
|
@@ -4,18 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.getNativeProps = exports.divProperties = exports.dialogProperties = exports.imgProperties = exports.iframeProperties = exports.formProperties = exports.fieldsetProperties = exports.colProperties = exports.colGroupProperties = exports.tdProperties = exports.thProperties = exports.trProperties = exports.tableProperties = exports.optionProperties = exports.selectProperties = exports.textAreaProperties = exports.inputProperties = exports.buttonProperties = exports.timeProperties = exports.anchorProperties = exports.liProperties = exports.olProperties = exports.videoProperties = exports.audioProperties = exports.labelProperties = exports.htmlElementProperties = exports.microdataProperties = exports.baseElementProperties = exports.baseElementEvents = void 0;
|
7
|
-
|
8
7
|
const toObjectMap = (...items) => {
|
9
8
|
const result = {};
|
10
|
-
|
11
9
|
for (const item of items) {
|
12
10
|
const keys = Array.isArray(item) ? item : Object.keys(item);
|
13
|
-
|
14
11
|
for (const key of keys) {
|
15
12
|
result[key] = 1;
|
16
13
|
}
|
17
14
|
}
|
18
|
-
|
19
15
|
return result;
|
20
16
|
};
|
21
17
|
/**
|
@@ -23,15 +19,12 @@ const toObjectMap = (...items) => {
|
|
23
19
|
*
|
24
20
|
* @public
|
25
21
|
*/
|
26
|
-
|
27
|
-
|
28
22
|
exports.baseElementEvents = /*#__PURE__*/toObjectMap(['onAuxClick', 'onCopy', 'onCut', 'onPaste', 'onCompositionEnd', 'onCompositionStart', 'onCompositionUpdate', 'onFocus', 'onFocusCapture', 'onBlur', 'onBlurCapture', 'onChange', 'onInput', 'onSubmit', 'onLoad', 'onError', 'onKeyDown', 'onKeyDownCapture', 'onKeyPress', 'onKeyUp', 'onAbort', 'onCanPlay', 'onCanPlayThrough', 'onDurationChange', 'onEmptied', 'onEncrypted', 'onEnded', 'onLoadedData', 'onLoadedMetadata', 'onLoadStart', 'onPause', 'onPlay', 'onPlaying', 'onProgress', 'onRateChange', 'onSeeked', 'onSeeking', 'onStalled', 'onSuspend', 'onTimeUpdate', 'onVolumeChange', 'onWaiting', 'onClick', 'onClickCapture', 'onContextMenu', 'onDoubleClick', 'onDrag', 'onDragEnd', 'onDragEnter', 'onDragExit', 'onDragLeave', 'onDragOver', 'onDragStart', 'onDrop', 'onMouseDown', 'onMouseDownCapture', 'onMouseEnter', 'onMouseLeave', 'onMouseMove', 'onMouseOut', 'onMouseOver', 'onMouseUp', 'onMouseUpCapture', 'onSelect', 'onTouchCancel', 'onTouchEnd', 'onTouchMove', 'onTouchStart', 'onScroll', 'onWheel', 'onPointerCancel', 'onPointerDown', 'onPointerEnter', 'onPointerLeave', 'onPointerMove', 'onPointerOut', 'onPointerOver', 'onPointerUp', 'onGotPointerCapture', 'onLostPointerCapture']);
|
29
23
|
/**
|
30
24
|
* An array of element attributes which are allowed on every html element type.
|
31
25
|
*
|
32
26
|
* @public
|
33
27
|
*/
|
34
|
-
|
35
28
|
exports.baseElementProperties = /*#__PURE__*/toObjectMap(['accessKey', 'children', 'className', 'contentEditable', 'dir', 'draggable', 'hidden', 'htmlFor', 'id', 'lang', 'ref', 'role', 'style', 'tabIndex', 'title', 'translate', 'spellCheck', 'name' // global
|
36
29
|
]);
|
37
30
|
/**
|
@@ -39,7 +32,6 @@ exports.baseElementProperties = /*#__PURE__*/toObjectMap(['accessKey', 'children
|
|
39
32
|
*
|
40
33
|
* @public
|
41
34
|
*/
|
42
|
-
|
43
35
|
exports.microdataProperties = /*#__PURE__*/toObjectMap(['itemID', 'itemProp', 'itemRef', 'itemScope', 'itemType' // global
|
44
36
|
]);
|
45
37
|
/**
|
@@ -47,14 +39,12 @@ exports.microdataProperties = /*#__PURE__*/toObjectMap(['itemID', 'itemProp', 'i
|
|
47
39
|
*
|
48
40
|
* @public
|
49
41
|
*/
|
50
|
-
|
51
42
|
exports.htmlElementProperties = /*#__PURE__*/toObjectMap(exports.baseElementProperties, exports.baseElementEvents, exports.microdataProperties);
|
52
43
|
/**
|
53
44
|
* An array of LABEL tag properties and events.
|
54
45
|
*
|
55
46
|
* @public
|
56
47
|
*/
|
57
|
-
|
58
48
|
exports.labelProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['form' // button, fieldset, input, label, meter, object, output, select, textarea
|
59
49
|
]);
|
60
50
|
/**
|
@@ -62,7 +52,6 @@ exports.labelProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties
|
|
62
52
|
|
63
53
|
* @public
|
64
54
|
*/
|
65
|
-
|
66
55
|
exports.audioProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['height', 'loop', 'muted', 'preload', 'src', 'width' // canvas, embed, iframe, img, input, object, video
|
67
56
|
]);
|
68
57
|
/**
|
@@ -70,7 +59,6 @@ exports.audioProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties
|
|
70
59
|
*
|
71
60
|
* @public
|
72
61
|
*/
|
73
|
-
|
74
62
|
exports.videoProperties = /*#__PURE__*/toObjectMap(exports.audioProperties, ['poster' // video
|
75
63
|
]);
|
76
64
|
/**
|
@@ -78,7 +66,6 @@ exports.videoProperties = /*#__PURE__*/toObjectMap(exports.audioProperties, ['po
|
|
78
66
|
*
|
79
67
|
* @public
|
80
68
|
*/
|
81
|
-
|
82
69
|
exports.olProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['start' // ol
|
83
70
|
]);
|
84
71
|
/**
|
@@ -86,7 +73,6 @@ exports.olProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, [
|
|
86
73
|
*
|
87
74
|
* @public
|
88
75
|
*/
|
89
|
-
|
90
76
|
exports.liProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['value' // button, input, li, option, meter, progress, param
|
91
77
|
]);
|
92
78
|
/**
|
@@ -94,7 +80,6 @@ exports.liProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, [
|
|
94
80
|
*
|
95
81
|
* @public
|
96
82
|
*/
|
97
|
-
|
98
83
|
exports.anchorProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['download', 'href', 'hrefLang', 'media', 'rel', 'target', 'type' // a, button, input, link, menu, object, script, source, style
|
99
84
|
]);
|
100
85
|
/**
|
@@ -102,7 +87,6 @@ exports.anchorProperties = /*#__PURE__*/toObjectMap(exports.htmlElementPropertie
|
|
102
87
|
*
|
103
88
|
* @public
|
104
89
|
*/
|
105
|
-
|
106
90
|
exports.timeProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['dateTime' // time
|
107
91
|
]);
|
108
92
|
/**
|
@@ -110,7 +94,6 @@ exports.timeProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties,
|
|
110
94
|
*
|
111
95
|
* @public
|
112
96
|
*/
|
113
|
-
|
114
97
|
exports.buttonProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['autoFocus', 'disabled', 'form', 'formAction', 'formEncType', 'formMethod', 'formNoValidate', 'formTarget', 'type', 'value' // button, input, li, option, meter, progress, param,
|
115
98
|
]);
|
116
99
|
/**
|
@@ -118,7 +101,6 @@ exports.buttonProperties = /*#__PURE__*/toObjectMap(exports.htmlElementPropertie
|
|
118
101
|
*
|
119
102
|
* @public
|
120
103
|
*/
|
121
|
-
|
122
104
|
exports.inputProperties = /*#__PURE__*/toObjectMap(exports.buttonProperties, ['accept', 'alt', 'autoCapitalize', 'autoComplete', 'checked', 'dirname', 'form', 'height', 'inputMode', 'list', 'max', 'maxLength', 'min', 'multiple', 'pattern', 'placeholder', 'readOnly', 'required', 'src', 'step', 'size', 'type', 'value', 'width' // canvas, embed, iframe, img, input, object, video
|
123
105
|
]);
|
124
106
|
/**
|
@@ -126,7 +108,6 @@ exports.inputProperties = /*#__PURE__*/toObjectMap(exports.buttonProperties, ['a
|
|
126
108
|
*
|
127
109
|
* @public
|
128
110
|
*/
|
129
|
-
|
130
111
|
exports.textAreaProperties = /*#__PURE__*/toObjectMap(exports.buttonProperties, ['autoCapitalize', 'cols', 'dirname', 'form', 'maxLength', 'placeholder', 'readOnly', 'required', 'rows', 'wrap' // textarea
|
131
112
|
]);
|
132
113
|
/**
|
@@ -134,9 +115,9 @@ exports.textAreaProperties = /*#__PURE__*/toObjectMap(exports.buttonProperties,
|
|
134
115
|
*
|
135
116
|
* @public
|
136
117
|
*/
|
137
|
-
|
138
118
|
exports.selectProperties = /*#__PURE__*/toObjectMap(exports.buttonProperties, ['form', 'multiple', 'required' // input, select, textarea
|
139
119
|
]);
|
120
|
+
|
140
121
|
exports.optionProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['selected', 'value' // button, input, li, option, meter, progress, param
|
141
122
|
]);
|
142
123
|
/**
|
@@ -144,7 +125,6 @@ exports.optionProperties = /*#__PURE__*/toObjectMap(exports.htmlElementPropertie
|
|
144
125
|
*
|
145
126
|
* @public
|
146
127
|
*/
|
147
|
-
|
148
128
|
exports.tableProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['cellPadding', 'cellSpacing' // table
|
149
129
|
]);
|
150
130
|
/**
|
@@ -152,14 +132,12 @@ exports.tableProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties
|
|
152
132
|
*
|
153
133
|
* @public
|
154
134
|
*/
|
155
|
-
|
156
135
|
exports.trProperties = exports.htmlElementProperties;
|
157
136
|
/**
|
158
137
|
* An array of TH tag properties and events.
|
159
138
|
*
|
160
139
|
* @public
|
161
140
|
*/
|
162
|
-
|
163
141
|
exports.thProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['colSpan', 'rowSpan', 'scope' // th
|
164
142
|
]);
|
165
143
|
/**
|
@@ -167,11 +145,12 @@ exports.thProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, [
|
|
167
145
|
*
|
168
146
|
* @public
|
169
147
|
*/
|
170
|
-
|
171
148
|
exports.tdProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['colSpan', 'headers', 'rowSpan', 'scope' // th
|
172
149
|
]);
|
150
|
+
|
173
151
|
exports.colGroupProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['span' // col, colgroup
|
174
152
|
]);
|
153
|
+
|
175
154
|
exports.colProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['span' // col, colgroup
|
176
155
|
]);
|
177
156
|
/**
|
@@ -179,7 +158,6 @@ exports.colProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties,
|
|
179
158
|
*
|
180
159
|
* @public
|
181
160
|
*/
|
182
|
-
|
183
161
|
exports.fieldsetProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['disabled', 'form' // button, fieldset, input, label, meter, object, output, select, textarea
|
184
162
|
]);
|
185
163
|
/**
|
@@ -187,7 +165,6 @@ exports.fieldsetProperties = /*#__PURE__*/toObjectMap(exports.htmlElementPropert
|
|
187
165
|
*
|
188
166
|
* @public
|
189
167
|
*/
|
190
|
-
|
191
168
|
exports.formProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['acceptCharset', 'action', 'encType', 'encType', 'method', 'noValidate', 'target' // form
|
192
169
|
]);
|
193
170
|
/**
|
@@ -195,7 +172,6 @@ exports.formProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties,
|
|
195
172
|
*
|
196
173
|
* @public
|
197
174
|
*/
|
198
|
-
|
199
175
|
exports.iframeProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['allow', 'allowFullScreen', 'allowPaymentRequest', 'allowTransparency', 'csp', 'height', 'importance', 'referrerPolicy', 'sandbox', 'src', 'srcDoc', 'width' // canvas, embed, iframe, img, input, object, video,
|
200
176
|
]);
|
201
177
|
/**
|
@@ -203,7 +179,6 @@ exports.iframeProperties = /*#__PURE__*/toObjectMap(exports.htmlElementPropertie
|
|
203
179
|
*
|
204
180
|
* @public
|
205
181
|
*/
|
206
|
-
|
207
182
|
exports.imgProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['alt', 'crossOrigin', 'height', 'src', 'srcSet', 'useMap', 'width' // canvas, embed, iframe, img, input, object, video
|
208
183
|
]);
|
209
184
|
/**
|
@@ -211,14 +186,12 @@ exports.imgProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties,
|
|
211
186
|
*
|
212
187
|
* @public
|
213
188
|
*/
|
214
|
-
|
215
189
|
exports.dialogProperties = /*#__PURE__*/toObjectMap(exports.htmlElementProperties, ['open', 'onCancel', 'onClose']);
|
216
190
|
/**
|
217
191
|
* An array of DIV tag properties and events.
|
218
192
|
*
|
219
193
|
* @public
|
220
194
|
*/
|
221
|
-
|
222
195
|
exports.divProperties = exports.htmlElementProperties;
|
223
196
|
/**
|
224
197
|
* Gets native supported props for an html element provided the allowance set. Use one of the property
|
@@ -236,30 +209,26 @@ exports.divProperties = exports.htmlElementProperties;
|
|
236
209
|
* @returns The filtered props
|
237
210
|
*/
|
238
211
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
239
|
-
|
240
|
-
|
212
|
+
function getNativeProps(
|
213
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
241
214
|
props, allowedPropNames, excludedPropNames) {
|
242
215
|
// It'd be great to properly type this while allowing 'aria-` and 'data-' attributes like TypeScript does for
|
243
216
|
// JSX attributes, but that ability is hardcoded into the TS compiler with no analog in TypeScript typings.
|
244
217
|
// Then we'd be able to enforce props extends native props (including aria- and data- attributes), and then
|
245
218
|
// return native props.
|
246
219
|
// We should be able to do this once this PR is merged: https://github.com/microsoft/TypeScript/pull/26797
|
247
|
-
const isArray = Array.isArray(allowedPropNames);
|
248
|
-
|
220
|
+
const isArray = Array.isArray(allowedPropNames);
|
221
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
249
222
|
const result = {};
|
250
223
|
const keys = Object.keys(props);
|
251
|
-
|
252
224
|
for (const key of keys) {
|
253
225
|
const isNativeProp = !isArray && allowedPropNames[key] || isArray && allowedPropNames.indexOf(key) >= 0 || key.indexOf('data-') === 0 || key.indexOf('aria-') === 0;
|
254
|
-
|
255
226
|
if (isNativeProp && (!excludedPropNames || (excludedPropNames === null || excludedPropNames === void 0 ? void 0 : excludedPropNames.indexOf(key)) === -1)) {
|
256
227
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
257
228
|
result[key] = props[key];
|
258
229
|
}
|
259
230
|
}
|
260
|
-
|
261
231
|
return result;
|
262
232
|
}
|
263
|
-
|
264
233
|
exports.getNativeProps = getNativeProps;
|
265
234
|
//# sourceMappingURL=properties.js.map
|