@fluentui/react-utilities 0.0.0-nightly-20230317-0436.1 → 0.0.0-nightly-20230317-1454.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/.swcrc +39 -0
- package/CHANGELOG.json +5 -5
- package/CHANGELOG.md +5 -5
- package/lib/compose/getSlots.js +6 -7
- package/lib/compose/getSlots.js.map +1 -1
- package/lib/compose/index.js +4 -4
- package/lib/compose/index.js.map +1 -1
- package/lib/compose/isResolvedShorthand.js +2 -2
- package/lib/compose/isResolvedShorthand.js.map +1 -1
- package/lib/compose/resolveShorthand.js +3 -3
- package/lib/compose/resolveShorthand.js.map +1 -1
- package/lib/compose/types.js +1 -1
- package/lib/compose/types.js.map +1 -1
- package/lib/events/index.js +1 -1
- package/lib/events/index.js.map +1 -1
- package/lib/events/mouseTouchHelpers.js +5 -4
- package/lib/events/mouseTouchHelpers.js.map +1 -1
- package/lib/hooks/index.js +12 -12
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useControllableState.js +7 -7
- package/lib/hooks/useControllableState.js.map +1 -1
- package/lib/hooks/useEventCallback.js +3 -3
- package/lib/hooks/useEventCallback.js.map +1 -1
- package/lib/hooks/useFirstMount.js +1 -1
- package/lib/hooks/useFirstMount.js.map +1 -1
- package/lib/hooks/useForceUpdate.js +1 -1
- package/lib/hooks/useForceUpdate.js.map +1 -1
- package/lib/hooks/useId.js +6 -6
- package/lib/hooks/useId.js.map +1 -1
- package/lib/hooks/useIsomorphicLayoutEffect.js +3 -4
- package/lib/hooks/useIsomorphicLayoutEffect.js.map +1 -1
- package/lib/hooks/useMergedRefs.js +2 -2
- package/lib/hooks/useMergedRefs.js.map +1 -1
- package/lib/hooks/useOnClickOutside.js +20 -23
- package/lib/hooks/useOnClickOutside.js.map +1 -1
- package/lib/hooks/useOnScrollOutside.js +7 -7
- package/lib/hooks/useOnScrollOutside.js.map +1 -1
- package/lib/hooks/usePrevious.js +1 -1
- package/lib/hooks/usePrevious.js.map +1 -1
- package/lib/hooks/useScrollbarWidth.js +5 -5
- package/lib/hooks/useScrollbarWidth.js.map +1 -1
- package/lib/hooks/useTimeout.js +1 -1
- package/lib/hooks/useTimeout.js.map +1 -1
- package/lib/index.js +6 -6
- package/lib/index.js.map +1 -1
- package/lib/ssr/SSRContext.js +5 -6
- package/lib/ssr/SSRContext.js.map +1 -1
- package/lib/ssr/canUseDOM.js +2 -3
- package/lib/ssr/canUseDOM.js.map +1 -1
- package/lib/ssr/index.js +2 -2
- package/lib/ssr/index.js.map +1 -1
- package/lib/trigger/applyTriggerPropsToChildren.js +4 -4
- package/lib/trigger/applyTriggerPropsToChildren.js.map +1 -1
- package/lib/trigger/getTriggerChild.js +2 -2
- package/lib/trigger/getTriggerChild.js.map +1 -1
- package/lib/trigger/index.js +4 -4
- package/lib/trigger/index.js.map +1 -1
- package/lib/trigger/isFluentTrigger.js +1 -0
- package/lib/trigger/isFluentTrigger.js.map +1 -1
- package/lib/trigger/types.js +1 -1
- package/lib/trigger/types.js.map +1 -1
- package/lib/utils/clamp.js +1 -2
- package/lib/utils/clamp.js.map +1 -1
- package/lib/utils/getNativeElementProps.js +4 -4
- package/lib/utils/getNativeElementProps.js.map +1 -1
- package/lib/utils/getRTLSafeKey.js +6 -7
- package/lib/utils/getRTLSafeKey.js.map +1 -1
- package/lib/utils/getReactCallbackName.js +3 -2
- package/lib/utils/getReactCallbackName.js.map +1 -1
- package/lib/utils/index.js +8 -8
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/isHTMLElement.js +2 -4
- package/lib/utils/isHTMLElement.js.map +1 -1
- package/lib/utils/isInteractiveHTMLElement.js +5 -5
- package/lib/utils/isInteractiveHTMLElement.js.map +1 -1
- package/lib/utils/mergeCallbacks.js +3 -4
- package/lib/utils/mergeCallbacks.js.map +1 -1
- package/lib/utils/omit.js +1 -2
- package/lib/utils/omit.js.map +1 -1
- package/lib/utils/properties.js +28 -55
- package/lib/utils/properties.js.map +1 -1
- package/lib-commonjs/compose/getSlots.js +47 -55
- package/lib-commonjs/compose/getSlots.js.map +1 -1
- package/lib-commonjs/compose/index.js +8 -7
- package/lib-commonjs/compose/index.js.map +1 -1
- package/lib-commonjs/compose/isResolvedShorthand.js +9 -37
- package/lib-commonjs/compose/isResolvedShorthand.js.map +1 -1
- package/lib-commonjs/compose/resolveShorthand.js +25 -32
- package/lib-commonjs/compose/resolveShorthand.js.map +1 -1
- package/lib-commonjs/compose/types.js +5 -2
- package/lib-commonjs/compose/types.js.map +1 -1
- package/lib-commonjs/events/index.js +5 -4
- package/lib-commonjs/events/index.js.map +1 -1
- package/lib-commonjs/events/mouseTouchHelpers.js +40 -37
- package/lib-commonjs/events/mouseTouchHelpers.js.map +1 -1
- package/lib-commonjs/hooks/index.js +16 -15
- package/lib-commonjs/hooks/index.js.map +1 -1
- package/lib-commonjs/hooks/useControllableState.js +63 -64
- package/lib-commonjs/hooks/useControllableState.js.map +1 -1
- package/lib-commonjs/hooks/useEventCallback.js +25 -31
- package/lib-commonjs/hooks/useEventCallback.js.map +1 -1
- package/lib-commonjs/hooks/useFirstMount.js +15 -23
- package/lib-commonjs/hooks/useFirstMount.js.map +1 -1
- package/lib-commonjs/hooks/useForceUpdate.js +9 -11
- package/lib-commonjs/hooks/useForceUpdate.js.map +1 -1
- package/lib-commonjs/hooks/useId.js +48 -47
- package/lib-commonjs/hooks/useId.js.map +1 -1
- package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js +10 -16
- package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js.map +1 -1
- package/lib-commonjs/hooks/useMergedRefs.js +25 -27
- package/lib-commonjs/hooks/useMergedRefs.js.map +1 -1
- package/lib-commonjs/hooks/useOnClickOutside.js +109 -115
- package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -1
- package/lib-commonjs/hooks/useOnScrollOutside.js +33 -36
- package/lib-commonjs/hooks/useOnScrollOutside.js.map +1 -1
- package/lib-commonjs/hooks/usePrevious.js +17 -15
- package/lib-commonjs/hooks/usePrevious.js.map +1 -1
- package/lib-commonjs/hooks/useScrollbarWidth.js +32 -32
- package/lib-commonjs/hooks/useScrollbarWidth.js.map +1 -1
- package/lib-commonjs/hooks/useTimeout.js +30 -30
- package/lib-commonjs/hooks/useTimeout.js.map +1 -1
- package/lib-commonjs/index.js +52 -214
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/ssr/SSRContext.js +56 -59
- package/lib-commonjs/ssr/SSRContext.js.map +1 -1
- package/lib-commonjs/ssr/canUseDOM.js +12 -12
- package/lib-commonjs/ssr/canUseDOM.js.map +1 -1
- package/lib-commonjs/ssr/index.js +6 -5
- package/lib-commonjs/ssr/index.js.map +1 -1
- package/lib-commonjs/trigger/applyTriggerPropsToChildren.js +29 -31
- package/lib-commonjs/trigger/applyTriggerPropsToChildren.js.map +1 -1
- package/lib-commonjs/trigger/getTriggerChild.js +16 -36
- package/lib-commonjs/trigger/getTriggerChild.js.map +1 -1
- package/lib-commonjs/trigger/index.js +8 -7
- package/lib-commonjs/trigger/index.js.map +1 -1
- package/lib-commonjs/trigger/isFluentTrigger.js +10 -11
- package/lib-commonjs/trigger/isFluentTrigger.js.map +1 -1
- package/lib-commonjs/trigger/types.js +5 -2
- package/lib-commonjs/trigger/types.js.map +1 -1
- package/lib-commonjs/utils/clamp.js +10 -9
- package/lib-commonjs/utils/clamp.js.map +1 -1
- package/lib-commonjs/utils/getNativeElementProps.js +54 -61
- package/lib-commonjs/utils/getNativeElementProps.js.map +1 -1
- package/lib-commonjs/utils/getRTLSafeKey.js +22 -21
- package/lib-commonjs/utils/getRTLSafeKey.js.map +1 -1
- package/lib-commonjs/utils/getReactCallbackName.js +24 -24
- package/lib-commonjs/utils/getReactCallbackName.js.map +1 -1
- package/lib-commonjs/utils/index.js +12 -11
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/isHTMLElement.js +12 -12
- package/lib-commonjs/utils/isHTMLElement.js.map +1 -1
- package/lib-commonjs/utils/isInteractiveHTMLElement.js +20 -24
- package/lib-commonjs/utils/isInteractiveHTMLElement.js.map +1 -1
- package/lib-commonjs/utils/mergeCallbacks.js +14 -13
- package/lib-commonjs/utils/mergeCallbacks.js.map +1 -1
- package/lib-commonjs/utils/omit.js +18 -17
- package/lib-commonjs/utils/omit.js.map +1 -1
- package/lib-commonjs/utils/properties.js +327 -223
- package/lib-commonjs/utils/properties.js.map +1 -1
- package/package.json +4 -4
package/lib/trigger/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
export * from
|
2
|
-
export * from
|
3
|
-
export * from
|
4
|
-
export * from
|
1
|
+
export * from "./applyTriggerPropsToChildren";
|
2
|
+
export * from "./getTriggerChild";
|
3
|
+
export * from "./isFluentTrigger";
|
4
|
+
export * from "./types";
|
5
5
|
//# sourceMappingURL=index.js.map
|
package/lib/trigger/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":[],"sources":["../../src/trigger/index.ts"],"sourcesContent":["export * from './applyTriggerPropsToChildren';\nexport * from './getTriggerChild';\nexport * from './isFluentTrigger';\nexport * from './types';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["isFluentTrigger","element","Boolean","type","isFluentTriggerComponent"],"sources":["
|
1
|
+
{"version":3,"names":["React","isFluentTrigger","element","Boolean","type","isFluentTriggerComponent"],"sources":["../../src/trigger/isFluentTrigger.ts"],"sourcesContent":["import * as React from 'react';\nimport type { FluentTriggerComponent, TriggerProps } from './types';\n\n/**\n * @internal\n * Checks if a given element is a FluentUI trigger (e.g. `MenuTrigger` or `Tooltip`).\n * See the {@link FluentTriggerComponent} type for more info.\n */\nexport function isFluentTrigger(element: React.ReactElement): element is React.ReactElement<TriggerProps> {\n return Boolean((element.type as FluentTriggerComponent).isFluentTriggerComponent);\n}\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AAGvB;;;;;AAKA,OAAO,SAASC,gBAAgBC,OAA2B,EAA+C;EACxG,OAAOC,OAAA,CAAQD,OAAC,CAAQE,IAAI,CAA4BC,wBAAwB;AAClF"}
|
package/lib/trigger/types.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
|
1
|
+
import * as React from "react";
|
2
2
|
//# sourceMappingURL=types.js.map
|
package/lib/trigger/types.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["React"],"sources":["../../src/trigger/types.ts"],"sourcesContent":["import * as React from 'react';\n\n/**\n * @internal\n * Allows a component to be tagged as a FluentUI trigger component.\n *\n * Triggers are special-case components: they attach event listeners and other props on their child,\n * and use them to trigger another component to show. Examples include `MenuTrigger` and `Tooltip`.\n *\n * A component can be tagged as a trigger as follows:\n * ```ts\n * const MyComponent: React.FC<MyComponentProps> & FluentTriggerComponent = ...;\n *\n * MyComponent.isFluentTriggerComponent = true; // MUST also set this to true\n * ```\n */\nexport type FluentTriggerComponent = {\n isFluentTriggerComponent?: boolean;\n};\n\n/**\n * A trigger may have a children that could be either:\n * 1. A single element\n * 2. A render function that will receive properties and must return a valid element or null\n * 3. null or undefined\n */\nexport type TriggerProps<TriggerChildProps = unknown> = {\n children?: React.ReactElement | ((props: TriggerChildProps) => React.ReactElement | null) | null;\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW"}
|
package/lib/utils/clamp.js
CHANGED
@@ -5,6 +5,5 @@
|
|
5
5
|
* @param value - the value to be clamped
|
6
6
|
* @param min - the lowest valid value
|
7
7
|
* @param max - the highest valid value
|
8
|
-
*/
|
9
|
-
export const clamp = (value, min, max) => Math.max(min, Math.min(max, value || 0));
|
8
|
+
*/export const clamp = (value, min, max) => Math.max(min, Math.min(max, value || 0));
|
10
9
|
//# sourceMappingURL=clamp.js.map
|
package/lib/utils/clamp.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["clamp","value","min","max","Math"],"sources":["../../src/utils/clamp.ts"],"sourcesContent":["/**\n * @internal\n * Clamps `value` to a number between the min and max.\n *\n * @param value - the value to be clamped\n * @param min - the lowest valid value\n * @param max - the highest valid value\n */\nexport const clamp = (value: number, min: number, max: number): number => Math.max(min, Math.min(max, value || 0));\n"],"mappings":"AAAA;;;;;;;GAQA,OAAO,MAAMA,KAAA,GAAQA,CAACC,KAAA,EAAeC,GAAA,EAAaC,GAAA,KAAwBC,IAAA,CAAKD,GAAG,CAACD,GAAA,EAAKE,IAAA,CAAKF,GAAG,CAACC,GAAA,EAAKF,KAAA,IAAS"}
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import
|
1
|
+
import * as React from "react";
|
2
|
+
import { labelProperties, audioProperties, videoProperties, olProperties, liProperties, anchorProperties, buttonProperties, inputProperties, textAreaProperties, selectProperties, optionProperties, tableProperties, trProperties, thProperties, tdProperties, colGroupProperties, colProperties, fieldsetProperties, formProperties, iframeProperties, imgProperties, htmlElementProperties, getNativeProps, timeProperties, dialogProperties } from "./properties";
|
2
3
|
const nativeElementMap = {
|
3
4
|
label: labelProperties,
|
4
5
|
audio: audioProperties,
|
@@ -30,8 +31,7 @@ const nativeElementMap = {
|
|
30
31
|
* @param tagName - Tag name (e.g. "div")
|
31
32
|
* @param props - Props object
|
32
33
|
* @param excludedPropNames - List of props to disallow
|
33
|
-
*/
|
34
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
34
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
35
35
|
export function getNativeElementProps(tagName, props, excludedPropNames) {
|
36
36
|
const allowedPropNames = tagName && nativeElementMap[tagName] || htmlElementProperties;
|
37
37
|
allowedPropNames.as = 1;
|
@@ -55,7 +55,7 @@ export const getPartitionedNativeProps = ({
|
|
55
55
|
style: props.style,
|
56
56
|
className: props.className
|
57
57
|
},
|
58
|
-
primary: getNativeElementProps(primarySlotTagName, props, [...(excludedPropNames || []),
|
58
|
+
primary: getNativeElementProps(primarySlotTagName, props, [...(excludedPropNames || []), "style", "className"])
|
59
59
|
};
|
60
60
|
};
|
61
61
|
//# sourceMappingURL=getNativeElementProps.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["labelProperties","audioProperties","videoProperties","olProperties","liProperties","anchorProperties","buttonProperties","inputProperties","textAreaProperties","selectProperties","optionProperties","tableProperties","trProperties","thProperties","tdProperties","colGroupProperties","colProperties","fieldsetProperties","formProperties","iframeProperties","imgProperties","htmlElementProperties","getNativeProps","timeProperties","dialogProperties","nativeElementMap","label","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","getPartitionedNativeProps","primarySlotTagName","root","style","className","primary"],"sources":["
|
1
|
+
{"version":3,"names":["React","labelProperties","audioProperties","videoProperties","olProperties","liProperties","anchorProperties","buttonProperties","inputProperties","textAreaProperties","selectProperties","optionProperties","tableProperties","trProperties","thProperties","tdProperties","colGroupProperties","colProperties","fieldsetProperties","formProperties","iframeProperties","imgProperties","htmlElementProperties","getNativeProps","timeProperties","dialogProperties","nativeElementMap","label","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","getPartitionedNativeProps","primarySlotTagName","root","style","className","primary"],"sources":["../../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"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SACEC,eAAe,EACfC,eAAe,EACfC,eAAe,EACfC,YAAY,EACZC,YAAY,EACZC,gBAAgB,EAChBC,gBAAgB,EAChBC,eAAe,EACfC,kBAAkB,EAClBC,gBAAgB,EAChBC,gBAAgB,EAChBC,eAAe,EACfC,YAAY,EACZC,YAAY,EACZC,YAAY,EACZC,kBAAkB,EAClBC,aAAa,EACbC,kBAAkB,EAClBC,cAAc,EACdC,gBAAgB,EAChBC,aAAa,EACbC,qBAAqB,EACrBC,cAAc,EACdC,cAAc,EACdC,gBAAgB,QACX;AAEP,MAAMC,gBAAA,GAA2D;EAC/DC,KAAA,EAAO1B,eAAA;EACP2B,KAAA,EAAO1B,eAAA;EACP2B,KAAA,EAAO1B,eAAA;EACP2B,EAAA,EAAI1B,YAAA;EACJ2B,EAAA,EAAI1B,YAAA;EACJ2B,CAAA,EAAG1B,gBAAA;EACH2B,MAAA,EAAQ1B,gBAAA;EACR2B,KAAA,EAAO1B,eAAA;EACP2B,QAAA,EAAU1B,kBAAA;EACV2B,MAAA,EAAQ1B,gBAAA;EACR2B,MAAA,EAAQ1B,gBAAA;EACR2B,KAAA,EAAO1B,eAAA;EACP2B,EAAA,EAAI1B,YAAA;EACJ2B,EAAA,EAAI1B,YAAA;EACJ2B,EAAA,EAAI1B,YAAA;EACJ2B,QAAA,EAAU1B,kBAAA;EACV2B,GAAA,EAAK1B,aAAA;EACL2B,QAAA,EAAU1B,kBAAA;EACV2B,IAAA,EAAM1B,cAAA;EACN2B,MAAA,EAAQ1B,gBAAA;EACR2B,GAAA,EAAK1B,aAAA;EACL2B,IAAA,EAAMxB,cAAA;EACNyB,MAAA,EAAQxB;AACV;AAEA;;;;;;GAAA,CAOA;AACA,OAAO,SAASyB,sBACdC,OAAe,EACfC,KAAS,EACTC,iBAA4B,EACf;EACb,MAAMC,gBAAA,GAAmBH,OAAC,IAAWzB,gBAAgB,CAACyB,OAAA,CAAQ,IAAK7B,qBAAA;EACnEgC,gBAAA,CAAiBC,EAAE,GAAG;EAEtB,OAAOhC,cAAA,CAAe6B,KAAA,EAAOE,gBAAA,EAAkBD,iBAAA;AACjD;AAEA;;;;;;;;AAQA,OAAO,MAAMG,yBAAA,GAA4BA,CAGvC;EACAC,kBAAA;EACAL,KAAA;EACAC;AAAiB,CAUlB,KAAK;EACJ,OAAO;IACLK,IAAA,EAAM;MAAEC,KAAA,EAAOP,KAAA,CAAMO,KAAK;MAAEC,SAAA,EAAWR,KAAA,CAAMQ;IAAU;IACvDC,OAAA,EAASX,qBAAA,CAAqDO,kBAAA,EAAoBL,KAAA,EAAO,C,IACnFC,iBAAA,IAAqB,EAAE,GAC3B,SACA,YACD;EACH;AACF"}
|
@@ -1,17 +1,16 @@
|
|
1
1
|
/**
|
2
2
|
* @internal
|
3
3
|
* Finds and swaps a provided key for it's right to left format.
|
4
|
-
*/
|
5
|
-
|
6
|
-
if (dir === 'rtl') {
|
4
|
+
*/export const getRTLSafeKey = (key, dir) => {
|
5
|
+
if (dir === "rtl") {
|
7
6
|
switch (key) {
|
8
|
-
case
|
7
|
+
case "ArrowLeft":
|
9
8
|
{
|
10
|
-
return
|
9
|
+
return "ArrowRight";
|
11
10
|
}
|
12
|
-
case
|
11
|
+
case "ArrowRight":
|
13
12
|
{
|
14
|
-
return
|
13
|
+
return "ArrowLeft";
|
15
14
|
}
|
16
15
|
}
|
17
16
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["getRTLSafeKey","key","dir"],"sources":["
|
1
|
+
{"version":3,"names":["getRTLSafeKey","key","dir"],"sources":["../../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"],"mappings":"AAAA;;;GAIA,OAAO,MAAMA,aAAA,GAAgBA,CAACC,GAAA,EAAaC,GAAA,KAAuB;EAChE,IAAIA,GAAA,KAAQ,OAAO;IACjB,QAAQD,GAAA;MACN,KAAK;QAAa;UAChB,OAAO;QACT;MAEA,KAAK;QAAc;UACjB,OAAO;QACT;IAAA;EAEJ;EAEA,OAAOA,GAAA;AACT"}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import * as React from "react";
|
1
2
|
/**
|
2
3
|
* React.SyntheticEvent contains name of a callback that should be fired, this function returns it.
|
3
4
|
*
|
@@ -15,9 +16,9 @@ export function getReactCallbackName(event) {
|
|
15
16
|
}
|
16
17
|
return event.dispatchConfig.phasedRegistrationNames.bubbled;
|
17
18
|
}
|
18
|
-
if (process.env.NODE_ENV !==
|
19
|
+
if (process.env.NODE_ENV !== "production") {
|
19
20
|
// eslint-disable-next-line no-console
|
20
|
-
console.error(['Passed React.SyntheticEvent does not contain ".dispatchConfig" or "._reactName".',
|
21
|
+
console.error(['Passed React.SyntheticEvent does not contain ".dispatchConfig" or "._reactName".', "This should not happen, please report it to https://github.com/microsoft/fluentui"]);
|
21
22
|
}
|
22
23
|
}
|
23
24
|
//# sourceMappingURL=getReactCallbackName.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["getReactCallbackName","event","_reactName","dispatchConfig","registrationName","phasedRegistrationNames","bubbled","process","env","NODE_ENV","console","error"],"sources":["
|
1
|
+
{"version":3,"names":["React","getReactCallbackName","event","_reactName","dispatchConfig","registrationName","phasedRegistrationNames","bubbled","process","env","NODE_ENV","console","error"],"sources":["../../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"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AAwBvB;;;;;;;AAOA,OAAO,SAASC,qBAAqBC,KAA0B,EAAiC;EAC9F,IAAIA,KAAA,CAAMC,UAAU,EAAE;IACpB,OAAOD,KAAA,CAAMC,UAAU;EACzB;EAEA,IAAID,KAAA,CAAME,cAAc,EAAE;IACxB,IAAIF,KAAA,CAAME,cAAc,CAACC,gBAAgB,EAAE;MACzC,OAAOH,KAAA,CAAME,cAAc,CAACC,gBAAgB;IAC9C;IAEA,OAAOH,KAAA,CAAME,cAAc,CAACE,uBAAuB,CAACC,OAAO;EAC7D;EAEA,IAAIC,OAAA,CAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;IACzC;IACAC,OAAA,CAAQC,KAAK,CAAC,CACZ,oFACA,oFACD;EACH;AACF"}
|
package/lib/utils/index.js
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
export * from
|
2
|
-
export * from
|
3
|
-
export * from
|
4
|
-
export * from
|
5
|
-
export * from
|
6
|
-
export * from
|
7
|
-
export * from
|
8
|
-
export * from
|
1
|
+
export * from "./clamp";
|
2
|
+
export * from "./getNativeElementProps";
|
3
|
+
export * from "./getRTLSafeKey";
|
4
|
+
export * from "./mergeCallbacks";
|
5
|
+
export * from "./omit";
|
6
|
+
export * from "./properties";
|
7
|
+
export * from "./isHTMLElement";
|
8
|
+
export * from "./isInteractiveHTMLElement";
|
9
9
|
//# sourceMappingURL=index.js.map
|
package/lib/utils/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":[],"sources":["../../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"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc"}
|
@@ -11,10 +11,8 @@
|
|
11
11
|
* isHTMLElement(event.target, {constructorName: 'HTMLInputElement'}) && event.target.value // some value
|
12
12
|
* ```
|
13
13
|
*
|
14
|
-
*/
|
15
|
-
export function isHTMLElement(element, options) {
|
16
|
-
var _a, _b;
|
14
|
+
*/export function isHTMLElement(element, options) {
|
17
15
|
const typedElement = element;
|
18
|
-
return Boolean(
|
16
|
+
return Boolean(typedElement?.ownerDocument?.defaultView && typedElement instanceof typedElement.ownerDocument.defaultView[options?.constructorName ?? "HTMLElement"]);
|
19
17
|
}
|
20
18
|
//# sourceMappingURL=isHTMLElement.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["isHTMLElement","element","options","typedElement","Boolean","
|
1
|
+
{"version":3,"names":["isHTMLElement","element","options","typedElement","Boolean","ownerDocument","defaultView","constructorName"],"sources":["../../src/utils/isHTMLElement.ts"],"sourcesContent":["/**\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 preferred over simply using `instanceof`.\n * Since `instanceof` 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 * @example\n * ```ts\n * isHTMLElement(event.target) && event.target.focus()\n * isHTMLElement(event.target, {constructorName: 'HTMLInputElement'}) && event.target.value // some value\n * ```\n *\n */\nexport function isHTMLElement<ConstructorName extends HTMLElementConstructorName = 'HTMLElement'>(\n element?: unknown,\n options?: {\n /**\n * Can be used to provide a custom constructor instead of `HTMLElement`,\n * Like `HTMLInputElement` for example.\n */\n constructorName?: ConstructorName;\n },\n): element is InstanceType<(typeof globalThis)[ConstructorName]> {\n const typedElement = element as Node | null | undefined;\n return Boolean(\n typedElement?.ownerDocument?.defaultView &&\n typedElement instanceof typedElement.ownerDocument.defaultView[options?.constructorName ?? 'HTMLElement'],\n );\n}\n\n/**\n * @internal\n */\nexport type HTMLElementConstructorName =\n | 'HTMLElement'\n | 'HTMLAnchorElement'\n | 'HTMLAreaElement'\n | 'HTMLAudioElement'\n | 'HTMLBaseElement'\n | 'HTMLBodyElement'\n | 'HTMLBRElement'\n | 'HTMLButtonElement'\n | 'HTMLCanvasElement'\n | 'HTMLDataElement'\n | 'HTMLDataListElement'\n | 'HTMLDetailsElement'\n | 'HTMLDialogElement'\n | 'HTMLDivElement'\n | 'HTMLDListElement'\n | 'HTMLEmbedElement'\n | 'HTMLFieldSetElement'\n | 'HTMLFormElement'\n | 'HTMLHeadingElement'\n | 'HTMLHeadElement'\n | 'HTMLHRElement'\n | 'HTMLHtmlElement'\n | 'HTMLIFrameElement'\n | 'HTMLImageElement'\n | 'HTMLInputElement'\n | 'HTMLModElement'\n | 'HTMLLabelElement'\n | 'HTMLLegendElement'\n | 'HTMLLIElement'\n | 'HTMLLinkElement'\n | 'HTMLMapElement'\n | 'HTMLMetaElement'\n | 'HTMLMeterElement'\n | 'HTMLObjectElement'\n | 'HTMLOListElement'\n | 'HTMLOptGroupElement'\n | 'HTMLOptionElement'\n | 'HTMLOutputElement'\n | 'HTMLParagraphElement'\n | 'HTMLParamElement'\n | 'HTMLPreElement'\n | 'HTMLProgressElement'\n | 'HTMLQuoteElement'\n | 'HTMLSlotElement'\n | 'HTMLScriptElement'\n | 'HTMLSelectElement'\n | 'HTMLSourceElement'\n | 'HTMLSpanElement'\n | 'HTMLStyleElement'\n | 'HTMLTableElement'\n | 'HTMLTableColElement'\n | 'HTMLTableRowElement'\n | 'HTMLTableSectionElement'\n | 'HTMLTemplateElement'\n | 'HTMLTextAreaElement'\n | 'HTMLTimeElement'\n | 'HTMLTitleElement'\n | 'HTMLTrackElement'\n | 'HTMLUListElement'\n | 'HTMLVideoElement';\n"],"mappings":"AAAA;;;;;;;;;;;;;GAcA,OAAO,SAASA,cACdC,OAAiB,EACjBC,OAMC,EAC8D;EAC/D,MAAMC,YAAA,GAAeF,OAAA;EACrB,OAAOG,OAAA,CACLD,YAAA,EAAcE,aAAA,EAAeC,WAAA,IAC3BH,YAAA,YAAwBA,YAAA,CAAaE,aAAa,CAACC,WAAW,CAACJ,OAAA,EAASK,eAAA,IAAmB,cAAc;AAE/G"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { isHTMLElement } from
|
1
|
+
import { isHTMLElement } from "./isHTMLElement";
|
2
2
|
/**
|
3
3
|
* @internal
|
4
4
|
* Checks that the element has default behaviour from user input on click or 'Enter'/'Space' keys
|
@@ -11,10 +11,10 @@ export function isInteractiveHTMLElement(element) {
|
|
11
11
|
tagName
|
12
12
|
} = element;
|
13
13
|
switch (tagName) {
|
14
|
-
case
|
15
|
-
case
|
16
|
-
case
|
17
|
-
case
|
14
|
+
case "BUTTON":
|
15
|
+
case "A":
|
16
|
+
case "INPUT":
|
17
|
+
case "TEXTAREA":
|
18
18
|
return true;
|
19
19
|
}
|
20
20
|
return element.isContentEditable;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["isHTMLElement","isInteractiveHTMLElement","element","tagName","isContentEditable"],"sources":["
|
1
|
+
{"version":3,"names":["isHTMLElement","isInteractiveHTMLElement","element","tagName","isContentEditable"],"sources":["../../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"],"mappings":"AAAA,SAASA,aAAa,QAAQ;AAE9B;;;;AAIA,OAAO,SAASC,yBAAyBC,OAAgB,EAAE;EACzD,IAAI,CAACF,aAAA,CAAcE,OAAA,GAAU;IAC3B,OAAO,KAAK;EACd;EAEA,MAAM;IAAEC;EAAO,CAAE,GAAGD,OAAA;EACpB,QAAQC,OAAA;IACN,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;MACH,OAAO,IAAI;EAAA;EAGf,OAAOD,OAAA,CAAQE,iBAAiB;AAClC"}
|
@@ -20,11 +20,10 @@
|
|
20
20
|
* @param callback2 - The second callback to be called, or undefined
|
21
21
|
*
|
22
22
|
* @returns A function that that calls the provided functions in order
|
23
|
-
*/
|
24
|
-
export function mergeCallbacks(callback1, callback2) {
|
23
|
+
*/export function mergeCallbacks(callback1, callback2) {
|
25
24
|
return (...args) => {
|
26
|
-
callback1
|
27
|
-
callback2
|
25
|
+
callback1?.(...args);
|
26
|
+
callback2?.(...args);
|
28
27
|
};
|
29
28
|
}
|
30
29
|
//# sourceMappingURL=mergeCallbacks.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["mergeCallbacks","callback1","callback2","args"],"sources":["
|
1
|
+
{"version":3,"names":["mergeCallbacks","callback1","callback2","args"],"sources":["../../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"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAuBA,OAAO,SAASA,eACdC,SAAgD,EAChDC,SAAgD,EAChD;EACA,OAAO,CAAC,GAAGC,IAAA,KAAe;IACxBF,SAAA,MAAeE,IAAA;IACfD,SAAA,MAAeC,IAAA;EACjB;AACF"}
|
package/lib/utils/omit.js
CHANGED
@@ -10,8 +10,7 @@
|
|
10
10
|
*
|
11
11
|
* @param obj - The object to clone
|
12
12
|
* @param exclusions - The array of keys to exclude
|
13
|
-
*/
|
14
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
13
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
15
14
|
export function omit(obj, exclusions) {
|
16
15
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
17
16
|
const result = {};
|
package/lib/utils/omit.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["omit","obj","exclusions","result","key","indexOf","hasOwnProperty"],"sources":["
|
1
|
+
{"version":3,"names":["omit","obj","exclusions","result","key","indexOf","hasOwnProperty"],"sources":["../../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"],"mappings":"AAAA;;;;;;;;;;;;GAAA,CAaA;AACA,OAAO,SAASA,KACdC,GAAS,EACTC,UAAsB,EACU;EAChC;EACA,MAAMC,MAAA,GAA8B,CAAC;EAErC,KAAK,MAAMC,GAAA,IAAOH,GAAA,EAAK;IACrB,IAAIC,UAAA,CAAWG,OAAO,CAACD,GAAA,MAAS,CAAC,KAAKH,GAAA,CAAIK,cAAc,CAACF,GAAA,GAAM;MAC7DD,MAAM,CAACC,GAAA,CAAI,GAAGH,GAAG,CAACG,GAAA,CAAI;IACxB;EACF;EAEA,OAAOD,MAAA;AACT"}
|
package/lib/utils/properties.js
CHANGED
@@ -13,21 +13,19 @@ const toObjectMap = (...items) => {
|
|
13
13
|
*
|
14
14
|
* @public
|
15
15
|
*/
|
16
|
-
export const baseElementEvents = /*#__PURE__*/toObjectMap([
|
16
|
+
export const 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"]);
|
17
17
|
/**
|
18
18
|
* An array of element attributes which are allowed on every html element type.
|
19
19
|
*
|
20
20
|
* @public
|
21
21
|
*/
|
22
|
-
export const baseElementProperties = /*#__PURE__*/toObjectMap([
|
23
|
-
]);
|
22
|
+
export const baseElementProperties = /*#__PURE__*/toObjectMap(["accessKey", "children", "className", "contentEditable", "dir", "draggable", "hidden", "htmlFor", "id", "lang", "ref", "role", "style", "tabIndex", "title", "translate", "spellCheck", "name"]);
|
24
23
|
/**
|
25
24
|
* An array of microdata attributes that are allowed on every html element type.
|
26
25
|
*
|
27
26
|
* @public
|
28
27
|
*/
|
29
|
-
export const microdataProperties = /*#__PURE__*/toObjectMap([
|
30
|
-
]);
|
28
|
+
export const microdataProperties = /*#__PURE__*/toObjectMap(["itemID", "itemProp", "itemRef", "itemScope", "itemType"]);
|
31
29
|
/**
|
32
30
|
* An array of HTML element properties and events.
|
33
31
|
*
|
@@ -39,88 +37,74 @@ export const htmlElementProperties = /*#__PURE__*/toObjectMap(baseElementPropert
|
|
39
37
|
*
|
40
38
|
* @public
|
41
39
|
*/
|
42
|
-
export const labelProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, [
|
43
|
-
]);
|
40
|
+
export const labelProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ["form"]);
|
44
41
|
/**
|
45
42
|
* An array of AUDIO tag properties and events.
|
46
43
|
|
47
44
|
* @public
|
48
45
|
*/
|
49
|
-
export const audioProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, [
|
50
|
-
]);
|
46
|
+
export const audioProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ["height", "loop", "muted", "preload", "src", "width"]);
|
51
47
|
/**
|
52
48
|
* An array of VIDEO tag properties and events.
|
53
49
|
*
|
54
50
|
* @public
|
55
51
|
*/
|
56
|
-
export const videoProperties = /*#__PURE__*/toObjectMap(audioProperties, [
|
57
|
-
]);
|
52
|
+
export const videoProperties = /*#__PURE__*/toObjectMap(audioProperties, ["poster"]);
|
58
53
|
/**
|
59
54
|
* An array of OL tag properties and events.
|
60
55
|
*
|
61
56
|
* @public
|
62
57
|
*/
|
63
|
-
export const olProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, [
|
64
|
-
]);
|
58
|
+
export const olProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ["start"]);
|
65
59
|
/**
|
66
60
|
* An array of LI tag properties and events.
|
67
61
|
*
|
68
62
|
* @public
|
69
63
|
*/
|
70
|
-
export const liProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, [
|
71
|
-
]);
|
64
|
+
export const liProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ["value"]);
|
72
65
|
/**
|
73
66
|
* An array of A tag properties and events.
|
74
67
|
*
|
75
68
|
* @public
|
76
69
|
*/
|
77
|
-
export const anchorProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, [
|
78
|
-
]);
|
70
|
+
export const anchorProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ["download", "href", "hrefLang", "media", "rel", "target", "type"]);
|
79
71
|
/**
|
80
72
|
* An array of TIME tag properties and events.
|
81
73
|
*
|
82
74
|
* @public
|
83
75
|
*/
|
84
|
-
export const timeProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, [
|
85
|
-
]);
|
76
|
+
export const timeProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ["dateTime"]);
|
86
77
|
/**
|
87
78
|
* An array of BUTTON tag properties and events.
|
88
79
|
*
|
89
80
|
* @public
|
90
81
|
*/
|
91
|
-
export const buttonProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, [
|
92
|
-
]);
|
82
|
+
export const buttonProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ["autoFocus", "disabled", "form", "formAction", "formEncType", "formMethod", "formNoValidate", "formTarget", "type", "value"]);
|
93
83
|
/**
|
94
84
|
* An array of INPUT tag properties and events.
|
95
85
|
*
|
96
86
|
* @public
|
97
87
|
*/
|
98
|
-
export const inputProperties = /*#__PURE__*/toObjectMap(buttonProperties, [
|
99
|
-
]);
|
88
|
+
export const inputProperties = /*#__PURE__*/toObjectMap(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"]);
|
100
89
|
/**
|
101
90
|
* An array of TEXTAREA tag properties and events.
|
102
91
|
*
|
103
92
|
* @public
|
104
93
|
*/
|
105
|
-
export const textAreaProperties = /*#__PURE__*/toObjectMap(buttonProperties, [
|
106
|
-
]);
|
94
|
+
export const textAreaProperties = /*#__PURE__*/toObjectMap(buttonProperties, ["autoCapitalize", "cols", "dirname", "form", "maxLength", "placeholder", "readOnly", "required", "rows", "wrap"]);
|
107
95
|
/**
|
108
96
|
* An array of SELECT tag properties and events.
|
109
97
|
*
|
110
98
|
* @public
|
111
99
|
*/
|
112
|
-
export const selectProperties = /*#__PURE__*/toObjectMap(buttonProperties, [
|
113
|
-
]);
|
114
|
-
|
115
|
-
export const optionProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['selected', 'value' // button, input, li, option, meter, progress, param
|
116
|
-
]);
|
100
|
+
export const selectProperties = /*#__PURE__*/toObjectMap(buttonProperties, ["form", "multiple", "required"]);
|
101
|
+
export const optionProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ["selected", "value"]);
|
117
102
|
/**
|
118
103
|
* An array of TABLE tag properties and events.
|
119
104
|
*
|
120
105
|
* @public
|
121
106
|
*/
|
122
|
-
export const tableProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, [
|
123
|
-
]);
|
107
|
+
export const tableProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ["cellPadding", "cellSpacing"]);
|
124
108
|
/**
|
125
109
|
* An array of TR tag properties and events.
|
126
110
|
*
|
@@ -132,55 +116,45 @@ export const trProperties = htmlElementProperties;
|
|
132
116
|
*
|
133
117
|
* @public
|
134
118
|
*/
|
135
|
-
export const thProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, [
|
136
|
-
]);
|
119
|
+
export const thProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ["colSpan", "rowSpan", "scope"]);
|
137
120
|
/**
|
138
121
|
* An array of TD tag properties and events.
|
139
122
|
*
|
140
123
|
* @public
|
141
124
|
*/
|
142
|
-
export const tdProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, [
|
143
|
-
]);
|
144
|
-
|
145
|
-
export const colGroupProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['span' // col, colgroup
|
146
|
-
]);
|
147
|
-
|
148
|
-
export const colProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ['span' // col, colgroup
|
149
|
-
]);
|
125
|
+
export const tdProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ["colSpan", "headers", "rowSpan", "scope"]);
|
126
|
+
export const colGroupProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ["span"]);
|
127
|
+
export const colProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ["span"]);
|
150
128
|
/**
|
151
129
|
* An array of FIELDSET tag properties and events.
|
152
130
|
*
|
153
131
|
* @public
|
154
132
|
*/
|
155
|
-
export const fieldsetProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, [
|
156
|
-
]);
|
133
|
+
export const fieldsetProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ["disabled", "form"]);
|
157
134
|
/**
|
158
135
|
* An array of FORM tag properties and events.
|
159
136
|
*
|
160
137
|
* @public
|
161
138
|
*/
|
162
|
-
export const formProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, [
|
163
|
-
]);
|
139
|
+
export const formProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ["acceptCharset", "action", "encType", "encType", "method", "noValidate", "target"]);
|
164
140
|
/**
|
165
141
|
* An array of IFRAME tag properties and events.
|
166
142
|
*
|
167
143
|
* @public
|
168
144
|
*/
|
169
|
-
export const iframeProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, [
|
170
|
-
]);
|
145
|
+
export const iframeProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ["allow", "allowFullScreen", "allowPaymentRequest", "allowTransparency", "csp", "height", "importance", "referrerPolicy", "sandbox", "src", "srcDoc", "width"]);
|
171
146
|
/**
|
172
147
|
* An array of IMAGE tag properties and events.
|
173
148
|
*
|
174
149
|
* @public
|
175
150
|
*/
|
176
|
-
export const imgProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, [
|
177
|
-
]);
|
151
|
+
export const imgProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ["alt", "crossOrigin", "height", "src", "srcSet", "useMap", "width"]);
|
178
152
|
/**
|
179
153
|
* An array of DIALOG tag properties and events.
|
180
154
|
*
|
181
155
|
* @public
|
182
156
|
*/
|
183
|
-
export const dialogProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, [
|
157
|
+
export const dialogProperties = /*#__PURE__*/toObjectMap(htmlElementProperties, ["open", "onCancel", "onClose"]);
|
184
158
|
/**
|
185
159
|
* An array of DIV tag properties and events.
|
186
160
|
*
|
@@ -201,8 +175,7 @@ export const divProperties = htmlElementProperties;
|
|
201
175
|
* @param allowedPropNames - The array or record of allowed prop names.
|
202
176
|
* @param excludedPropNames
|
203
177
|
* @returns The filtered props
|
204
|
-
*/
|
205
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
178
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
206
179
|
export function getNativeProps(
|
207
180
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
208
181
|
props, allowedPropNames, excludedPropNames) {
|
@@ -216,8 +189,8 @@ props, allowedPropNames, excludedPropNames) {
|
|
216
189
|
const result = {};
|
217
190
|
const keys = Object.keys(props);
|
218
191
|
for (const key of keys) {
|
219
|
-
const isNativeProp = !isArray && allowedPropNames[key] || isArray && allowedPropNames.indexOf(key) >= 0 || key.indexOf(
|
220
|
-
if (isNativeProp && (!excludedPropNames ||
|
192
|
+
const isNativeProp = !isArray && allowedPropNames[key] || isArray && allowedPropNames.indexOf(key) >= 0 || key.indexOf("data-") === 0 || key.indexOf("aria-") === 0;
|
193
|
+
if (isNativeProp && (!excludedPropNames || excludedPropNames?.indexOf(key) === -1)) {
|
221
194
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
222
195
|
result[key] = props[key];
|
223
196
|
}
|