@fluentui/react-utilities 0.0.0-nightly-20221208-0423.1 → 0.0.0-nightly-20221213-0427.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 +5 -5
- package/CHANGELOG.md +5 -5
- package/dist/index.d.ts +7 -9
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/utils/index.js +1 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/isHTMLElement.js.map +1 -1
- package/lib/utils/isInteractiveHTMLElement.js +26 -0
- package/lib/utils/isInteractiveHTMLElement.js.map +1 -0
- package/lib-commonjs/index.js +5 -5
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utils/index.js +2 -2
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/isHTMLElement.js.map +1 -1
- package/lib-commonjs/utils/isInteractiveHTMLElement.js +36 -0
- package/lib-commonjs/utils/isInteractiveHTMLElement.js.map +1 -0
- package/package.json +2 -2
- package/lib/utils/shouldPreventDefaultOnKeyDown.js +0 -25
- package/lib/utils/shouldPreventDefaultOnKeyDown.js.map +0 -1
- package/lib-commonjs/utils/shouldPreventDefaultOnKeyDown.js +0 -35
- package/lib-commonjs/utils/shouldPreventDefaultOnKeyDown.js.map +0 -1
package/CHANGELOG.json
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
"name": "@fluentui/react-utilities",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "
|
6
|
-
"tag": "@fluentui/react-utilities_v0.0.0-nightly-
|
7
|
-
"version": "0.0.0-nightly-
|
5
|
+
"date": "Tue, 13 Dec 2022 04:36:10 GMT",
|
6
|
+
"tag": "@fluentui/react-utilities_v0.0.0-nightly-20221213-0427.1",
|
7
|
+
"version": "0.0.0-nightly-20221213-0427.1",
|
8
8
|
"comments": {
|
9
9
|
"prerelease": [
|
10
10
|
{
|
@@ -16,8 +16,8 @@
|
|
16
16
|
{
|
17
17
|
"author": "beachball",
|
18
18
|
"package": "@fluentui/react-utilities",
|
19
|
-
"comment": "Bump @fluentui/keyboard-keys to v0.0.0-nightly-
|
20
|
-
"commit": "
|
19
|
+
"comment": "Bump @fluentui/keyboard-keys to v0.0.0-nightly-20221213-0427.1",
|
20
|
+
"commit": "a6e8ff4e70da42888306c18b79e81928eed13e32"
|
21
21
|
}
|
22
22
|
]
|
23
23
|
}
|
package/CHANGELOG.md
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
# Change Log - @fluentui/react-utilities
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Tue, 13 Dec 2022 04:36:10 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
-
## [0.0.0-nightly-
|
7
|
+
## [0.0.0-nightly-20221213-0427.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v0.0.0-nightly-20221213-0427.1)
|
8
8
|
|
9
|
-
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.2.2..@fluentui/react-utilities_v0.0.0-nightly-
|
9
|
+
Tue, 13 Dec 2022 04:36:10 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.2.2..@fluentui/react-utilities_v0.0.0-nightly-20221213-0427.1)
|
11
11
|
|
12
12
|
### Changes
|
13
13
|
|
14
14
|
- Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by fluentui-internal@service.microsoft.com)
|
15
|
-
- Bump @fluentui/keyboard-keys to v0.0.0-nightly-
|
15
|
+
- Bump @fluentui/keyboard-keys to v0.0.0-nightly-20221213-0427.1 ([commit](https://github.com/microsoft/fluentui/commit/a6e8ff4e70da42888306c18b79e81928eed13e32) by beachball)
|
16
16
|
|
17
17
|
## [9.2.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.2.2)
|
18
18
|
|
package/dist/index.d.ts
CHANGED
@@ -197,7 +197,13 @@ export declare function isFluentTrigger(element: React_2.ReactElement): element
|
|
197
197
|
* might be problematic while operating with [multiple realms](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof#instanceof_and_multiple_realms)
|
198
198
|
*
|
199
199
|
*/
|
200
|
-
export declare function isHTMLElement(element?: Node | null): element is HTMLElement;
|
200
|
+
export declare function isHTMLElement(element?: Node | null | undefined): element is HTMLElement;
|
201
|
+
|
202
|
+
/**
|
203
|
+
* @internal
|
204
|
+
* Checks that the element has default behaviour from user input on click or 'Enter'/'Space' keys
|
205
|
+
*/
|
206
|
+
export declare function isInteractiveHTMLElement(element: Node | null | undefined): boolean;
|
201
207
|
|
202
208
|
/**
|
203
209
|
* Guard method that validates if a shorthand is a slot
|
@@ -329,14 +335,6 @@ export declare type ResolveShorthandOptions<Props, Required extends boolean = fa
|
|
329
335
|
defaultProps?: Props;
|
330
336
|
};
|
331
337
|
|
332
|
-
/**
|
333
|
-
* @internal
|
334
|
-
* Checks if the keyboard event should preventDefault() for Enter and Spacebar keys
|
335
|
-
*
|
336
|
-
* Useful for situations where a keydown needs to be transformed to a click event
|
337
|
-
*/
|
338
|
-
export declare function shouldPreventDefaultOnKeyDown(e: KeyboardEvent | React_2.KeyboardEvent): boolean;
|
339
|
-
|
340
338
|
/**
|
341
339
|
* The props type and shorthand value for a slot. Type is either a single intrinsic element like `'div'`,
|
342
340
|
* or a component like `typeof Button`.
|
package/lib/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
export { getSlots, resolveShorthand, isResolvedShorthand } from './compose/index';
|
2
2
|
export { resetIdsForTests, useControllableState, useEventCallback, useFirstMount, useForceUpdate, useId, useIsomorphicLayoutEffect, useMergedRefs, useOnClickOutside, useOnScrollOutside, usePrevious, useTimeout } from './hooks/index';
|
3
3
|
export { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';
|
4
|
-
export { clamp, getNativeElementProps, getPartitionedNativeProps, getRTLSafeKey, mergeCallbacks,
|
4
|
+
export { clamp, getNativeElementProps, getPartitionedNativeProps, getRTLSafeKey, mergeCallbacks, isHTMLElement, isInteractiveHTMLElement } from './utils/index';
|
5
5
|
export { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';
|
6
6
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../../../packages/react-components/react-utilities/src/index.ts"],"names":[],"mappings":"AAAA,SAAS,QAAT,EAAmB,gBAAnB,EAAqC,mBAArC,QAAgE,iBAAhE;AAgBA,SACE,gBADF,EAEE,oBAFF,EAGE,gBAHF,EAIE,aAJF,EAKE,cALF,EAME,KANF,EAOE,yBAPF,EAQE,aARF,EASE,iBATF,EAUE,kBAVF,EAWE,WAXF,EAYE,UAZF,QAaO,eAbP;AAgBA,SAAS,SAAT,EAAoB,QAApB,EAA8B,WAA9B,QAAiD,aAAjD;AAEA,SACE,KADF,EAEE,qBAFF,EAGE,yBAHF,EAIE,aAJF,EAKE,cALF,EAME,
|
1
|
+
{"version":3,"sources":["../../../../../../../packages/react-components/react-utilities/src/index.ts"],"names":[],"mappings":"AAAA,SAAS,QAAT,EAAmB,gBAAnB,EAAqC,mBAArC,QAAgE,iBAAhE;AAgBA,SACE,gBADF,EAEE,oBAFF,EAGE,gBAHF,EAIE,aAJF,EAKE,cALF,EAME,KANF,EAOE,yBAPF,EAQE,aARF,EASE,iBATF,EAUE,kBAVF,EAWE,WAXF,EAYE,UAZF,QAaO,eAbP;AAgBA,SAAS,SAAT,EAAoB,QAApB,EAA8B,WAA9B,QAAiD,aAAjD;AAEA,SACE,KADF,EAEE,qBAFF,EAGE,yBAHF,EAIE,aAJF,EAKE,cALF,EAME,aANF,EAOE,wBAPF,QAQO,eARP;AAUA,SAAS,2BAAT,EAAsC,eAAtC,EAAuD,eAAvD,QAA8E,iBAA9E","sourcesContent":["export { getSlots, resolveShorthand, isResolvedShorthand } from './compose/index';\nexport type {\n ExtractSlotProps,\n ComponentProps,\n ComponentState,\n ForwardRefComponent,\n ResolveShorthandFunction,\n ResolveShorthandOptions,\n Slot,\n Slots,\n SlotClassNames,\n SlotPropsRecord,\n SlotRenderFunction,\n SlotShorthandValue,\n} from './compose/index';\n\nexport {\n resetIdsForTests,\n useControllableState,\n useEventCallback,\n useFirstMount,\n useForceUpdate,\n useId,\n useIsomorphicLayoutEffect,\n useMergedRefs,\n useOnClickOutside,\n useOnScrollOutside,\n usePrevious,\n useTimeout,\n} from './hooks/index';\nexport type { RefObjectFunction, UseControllableStateOptions, UseOnClickOrScrollOutsideOptions } from './hooks/index';\n\nexport { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';\n\nexport {\n clamp,\n getNativeElementProps,\n getPartitionedNativeProps,\n getRTLSafeKey,\n mergeCallbacks,\n isHTMLElement,\n isInteractiveHTMLElement,\n} from './utils/index';\n\nexport { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';\n\nexport type { FluentTriggerComponent, TriggerProps } from './trigger/index';\n"],"sourceRoot":""}
|
package/lib/utils/index.js
CHANGED
@@ -4,6 +4,6 @@ export * from './getRTLSafeKey';
|
|
4
4
|
export * from './mergeCallbacks';
|
5
5
|
export * from './omit';
|
6
6
|
export * from './properties';
|
7
|
-
export * from './shouldPreventDefaultOnKeyDown';
|
8
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,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,4BAA4B,CAAC","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"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/isHTMLElement.ts"],"names":[],"mappings":"AAAA;;;;;;;;AAQG;AACH,OAAM,SAAU,aAAV,CAAwB,OAAxB,
|
1
|
+
{"version":3,"sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/isHTMLElement.ts"],"names":[],"mappings":"AAAA;;;;;;;;AAQG;AACH,OAAM,SAAU,aAAV,CAAwB,OAAxB,EAAyD;;;EAC7D,OAAO,OAAO,CACZ,OAAO,KAAK,IAAZ,KACE,CAAA,EAAA,GAAA,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,aAAT,MAAsB,IAAtB,IAAsB,EAAA,KAAA,KAAA,CAAtB,GAAsB,KAAA,CAAtB,GAAsB,EAAA,CAAE,WAD1B,KAEE,OAAO,YAAY,OAAO,CAAC,aAAR,CAAsB,WAAtB,CAAkC,WAH3C,CAAd;AAKD","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?: Node | null | undefined): element is HTMLElement {\n return Boolean(\n element !== null &&\n element?.ownerDocument?.defaultView &&\n element instanceof element.ownerDocument.defaultView.HTMLElement,\n );\n}\n"],"sourceRoot":""}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import { isHTMLElement } from './isHTMLElement';
|
2
|
+
/**
|
3
|
+
* @internal
|
4
|
+
* Checks that the element has default behaviour from user input on click or 'Enter'/'Space' keys
|
5
|
+
*/
|
6
|
+
|
7
|
+
export function isInteractiveHTMLElement(element) {
|
8
|
+
if (!isHTMLElement(element)) {
|
9
|
+
return false;
|
10
|
+
}
|
11
|
+
|
12
|
+
const {
|
13
|
+
tagName
|
14
|
+
} = element;
|
15
|
+
|
16
|
+
switch (tagName) {
|
17
|
+
case 'BUTTON':
|
18
|
+
case 'A':
|
19
|
+
case 'INPUT':
|
20
|
+
case 'TEXTAREA':
|
21
|
+
return true;
|
22
|
+
}
|
23
|
+
|
24
|
+
return element.isContentEditable;
|
25
|
+
}
|
26
|
+
//# sourceMappingURL=isInteractiveHTMLElement.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/isInteractiveHTMLElement.ts"],"names":[],"mappings":"AAAA,SAAS,aAAT,QAA8B,iBAA9B;AAEA;;;AAGG;;AACH,OAAM,SAAU,wBAAV,CAAmC,OAAnC,EAAmE;EACvE,IAAI,CAAC,aAAa,CAAC,OAAD,CAAlB,EAA6B;IAC3B,OAAO,KAAP;EACD;;EAED,MAAM;IAAE;EAAF,IAAc,OAApB;;EACA,QAAQ,OAAR;IACE,KAAK,QAAL;IACA,KAAK,GAAL;IACA,KAAK,OAAL;IACA,KAAK,UAAL;MACE,OAAO,IAAP;EALJ;;EAQA,OAAO,OAAO,CAAC,iBAAf;AACD","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: Node | null | undefined) {\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"],"sourceRoot":""}
|
package/lib-commonjs/index.js
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.isFluentTrigger = exports.getTriggerChild = exports.applyTriggerPropsToChildren = exports.
|
6
|
+
exports.isFluentTrigger = exports.getTriggerChild = exports.applyTriggerPropsToChildren = exports.isInteractiveHTMLElement = exports.isHTMLElement = exports.mergeCallbacks = exports.getRTLSafeKey = exports.getPartitionedNativeProps = exports.getNativeElementProps = exports.clamp = exports.SSRProvider = exports.useIsSSR = exports.canUseDOM = exports.useTimeout = exports.usePrevious = exports.useOnScrollOutside = exports.useOnClickOutside = exports.useMergedRefs = exports.useIsomorphicLayoutEffect = exports.useId = exports.useForceUpdate = exports.useFirstMount = exports.useEventCallback = exports.useControllableState = exports.resetIdsForTests = exports.isResolvedShorthand = exports.resolveShorthand = exports.getSlots = void 0;
|
7
7
|
|
8
8
|
var index_1 = /*#__PURE__*/require("./compose/index");
|
9
9
|
|
@@ -154,16 +154,16 @@ Object.defineProperty(exports, "mergeCallbacks", {
|
|
154
154
|
return index_4.mergeCallbacks;
|
155
155
|
}
|
156
156
|
});
|
157
|
-
Object.defineProperty(exports, "
|
157
|
+
Object.defineProperty(exports, "isHTMLElement", {
|
158
158
|
enumerable: true,
|
159
159
|
get: function () {
|
160
|
-
return index_4.
|
160
|
+
return index_4.isHTMLElement;
|
161
161
|
}
|
162
162
|
});
|
163
|
-
Object.defineProperty(exports, "
|
163
|
+
Object.defineProperty(exports, "isInteractiveHTMLElement", {
|
164
164
|
enumerable: true,
|
165
165
|
get: function () {
|
166
|
-
return index_4.
|
166
|
+
return index_4.isInteractiveHTMLElement;
|
167
167
|
}
|
168
168
|
});
|
169
169
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../../../packages/react-components/react-utilities/src/index.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,OAAA,gBAAA,OAAA,CAAA,iBAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,UAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,QAAA;EAAQ;AAAR,CAAA;AAAU,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,kBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,gBAAA;EAAgB;AAAhB,CAAA;AAAkB,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,qBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,mBAAA;EAAmB;AAAnB,CAAA;;AAgBrC,IAAA,OAAA,gBAAA,OAAA,CAAA,eAAA,CAAA;;AACE,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,kBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,gBAAA;EAAgB;AAAhB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,sBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,oBAAA;EAAoB;AAApB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,kBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,gBAAA;EAAgB;AAAhB,CAAA;AACA,MAAA,CAAA,cAA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zB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,eAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,aAAA;EAAa;AAAb,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,gBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,cAAA;EAAc;AAAd,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,eAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,aAAA;EAAa;AAAb,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,0BAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,wBAAA;EAAwB;AAAxB,CAAA;;AAGF,IAAA,OAAA,gBAAA,OAAA,CAAA,iBAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,6BAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,2BAAA;EAA2B;AAA3B,CAAA;AAA6B,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,iBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,eAAA;EAAe;AAAf,CAAA;AAAiB,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,iBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,eAAA;EAAe;AAAf,CAAA","sourcesContent":["export { getSlots, resolveShorthand, isResolvedShorthand } from './compose/index';\nexport type {\n ExtractSlotProps,\n ComponentProps,\n ComponentState,\n ForwardRefComponent,\n ResolveShorthandFunction,\n ResolveShorthandOptions,\n Slot,\n Slots,\n SlotClassNames,\n SlotPropsRecord,\n SlotRenderFunction,\n SlotShorthandValue,\n} from './compose/index';\n\nexport {\n resetIdsForTests,\n useControllableState,\n useEventCallback,\n useFirstMount,\n useForceUpdate,\n useId,\n useIsomorphicLayoutEffect,\n useMergedRefs,\n useOnClickOutside,\n useOnScrollOutside,\n usePrevious,\n useTimeout,\n} from './hooks/index';\nexport type { RefObjectFunction, UseControllableStateOptions, UseOnClickOrScrollOutsideOptions } from './hooks/index';\n\nexport { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';\n\nexport {\n clamp,\n getNativeElementProps,\n getPartitionedNativeProps,\n getRTLSafeKey,\n mergeCallbacks,\n isHTMLElement,\n isInteractiveHTMLElement,\n} from './utils/index';\n\nexport { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';\n\nexport type { FluentTriggerComponent, TriggerProps } from './trigger/index';\n"],"sourceRoot":""}
|
@@ -18,7 +18,7 @@ tslib_1.__exportStar(require("./omit"), exports);
|
|
18
18
|
|
19
19
|
tslib_1.__exportStar(require("./properties"), exports);
|
20
20
|
|
21
|
-
tslib_1.__exportStar(require("./shouldPreventDefaultOnKeyDown"), exports);
|
22
|
-
|
23
21
|
tslib_1.__exportStar(require("./isHTMLElement"), exports);
|
22
|
+
|
23
|
+
tslib_1.__exportStar(require("./isInteractiveHTMLElement"), exports);
|
24
24
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,SAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,yBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,QAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,cAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,
|
1
|
+
{"version":3,"sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,SAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,yBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,QAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,cAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,4BAAA,CAAA,EAAA,OAAA","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"],"sourceRoot":""}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/isHTMLElement.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;AAQG;;AACH,SAAgB,aAAhB,CAA8B,OAA9B,
|
1
|
+
{"version":3,"sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/isHTMLElement.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;AAQG;;AACH,SAAgB,aAAhB,CAA8B,OAA9B,EAA+D;;;EAC7D,OAAO,OAAO,CACZ,OAAO,KAAK,IAAZ,KACE,CAAA,EAAA,GAAA,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,aAAT,MAAsB,IAAtB,IAAsB,EAAA,KAAA,KAAA,CAAtB,GAAsB,KAAA,CAAtB,GAAsB,EAAA,CAAE,WAD1B,KAEE,OAAO,YAAY,OAAO,CAAC,aAAR,CAAsB,WAAtB,CAAkC,WAH3C,CAAd;AAKD;;AAND,OAAA,CAAA,aAAA,GAAA,aAAA","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?: Node | null | undefined): element is HTMLElement {\n return Boolean(\n element !== null &&\n element?.ownerDocument?.defaultView &&\n element instanceof element.ownerDocument.defaultView.HTMLElement,\n );\n}\n"],"sourceRoot":""}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.isInteractiveHTMLElement = void 0;
|
7
|
+
|
8
|
+
const isHTMLElement_1 = /*#__PURE__*/require("./isHTMLElement");
|
9
|
+
/**
|
10
|
+
* @internal
|
11
|
+
* Checks that the element has default behaviour from user input on click or 'Enter'/'Space' keys
|
12
|
+
*/
|
13
|
+
|
14
|
+
|
15
|
+
function isInteractiveHTMLElement(element) {
|
16
|
+
if (!isHTMLElement_1.isHTMLElement(element)) {
|
17
|
+
return false;
|
18
|
+
}
|
19
|
+
|
20
|
+
const {
|
21
|
+
tagName
|
22
|
+
} = element;
|
23
|
+
|
24
|
+
switch (tagName) {
|
25
|
+
case 'BUTTON':
|
26
|
+
case 'A':
|
27
|
+
case 'INPUT':
|
28
|
+
case 'TEXTAREA':
|
29
|
+
return true;
|
30
|
+
}
|
31
|
+
|
32
|
+
return element.isContentEditable;
|
33
|
+
}
|
34
|
+
|
35
|
+
exports.isInteractiveHTMLElement = isInteractiveHTMLElement;
|
36
|
+
//# sourceMappingURL=isInteractiveHTMLElement.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/isInteractiveHTMLElement.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,eAAA,gBAAA,OAAA,CAAA,iBAAA,CAAA;AAEA;;;AAGG;;;AACH,SAAgB,wBAAhB,CAAyC,OAAzC,EAAyE;EACvE,IAAI,CAAC,eAAA,CAAA,aAAA,CAAc,OAAd,CAAL,EAA6B;IAC3B,OAAO,KAAP;EACD;;EAED,MAAM;IAAE;EAAF,IAAc,OAApB;;EACA,QAAQ,OAAR;IACE,KAAK,QAAL;IACA,KAAK,GAAL;IACA,KAAK,OAAL;IACA,KAAK,UAAL;MACE,OAAO,IAAP;EALJ;;EAQA,OAAO,OAAO,CAAC,iBAAf;AACD;;AAfD,OAAA,CAAA,wBAAA,GAAA,wBAAA","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: Node | null | undefined) {\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"],"sourceRoot":""}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-utilities",
|
3
|
-
"version": "0.0.0-nightly-
|
3
|
+
"version": "0.0.0-nightly-20221213-0427.1",
|
4
4
|
"description": "A set of general React-specific utilities.",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -27,7 +27,7 @@
|
|
27
27
|
"@fluentui/scripts": "^1.0.0"
|
28
28
|
},
|
29
29
|
"dependencies": {
|
30
|
-
"@fluentui/keyboard-keys": "0.0.0-nightly-
|
30
|
+
"@fluentui/keyboard-keys": "0.0.0-nightly-20221213-0427.1",
|
31
31
|
"tslib": "^2.1.0"
|
32
32
|
},
|
33
33
|
"peerDependencies": {
|
@@ -1,25 +0,0 @@
|
|
1
|
-
import { Space, Enter } from '@fluentui/keyboard-keys';
|
2
|
-
/**
|
3
|
-
* @internal
|
4
|
-
* Checks if the keyboard event should preventDefault() for Enter and Spacebar keys
|
5
|
-
*
|
6
|
-
* Useful for situations where a keydown needs to be transformed to a click event
|
7
|
-
*/
|
8
|
-
|
9
|
-
export function shouldPreventDefaultOnKeyDown(e) {
|
10
|
-
if (e.defaultPrevented) {
|
11
|
-
return false;
|
12
|
-
}
|
13
|
-
|
14
|
-
const key = e.key;
|
15
|
-
const target = e.target;
|
16
|
-
const matchesByKey = key === Space || key === Enter;
|
17
|
-
|
18
|
-
if ((target === null || target === void 0 ? void 0 : target.tagName) === 'A') {
|
19
|
-
return key === Space;
|
20
|
-
}
|
21
|
-
|
22
|
-
const ignoredByTag = (target === null || target === void 0 ? void 0 : target.tagName) === 'INPUT' || (target === null || target === void 0 ? void 0 : target.tagName) === 'TEXTAREA' || (target === null || target === void 0 ? void 0 : target.isContentEditable) === true;
|
23
|
-
return matchesByKey && !ignoredByTag;
|
24
|
-
}
|
25
|
-
//# sourceMappingURL=shouldPreventDefaultOnKeyDown.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/shouldPreventDefaultOnKeyDown.ts"],"names":[],"mappings":"AAAA,SAAS,KAAT,EAAgB,KAAhB,QAA6B,yBAA7B;AAGA;;;;;AAKG;;AACH,OAAM,SAAU,6BAAV,CAAwC,CAAxC,EAA8E;EAClF,IAAI,CAAC,CAAC,gBAAN,EAAwB;IACtB,OAAO,KAAP;EACD;;EAED,MAAM,GAAG,GAAG,CAAC,CAAC,GAAd;EACA,MAAM,MAAM,GAA4B,CAAC,CAAC,MAA1C;EAEA,MAAM,YAAY,GAAG,GAAG,KAAK,KAAR,IAAiB,GAAG,KAAK,KAA9C;;EAEA,IAAI,CAAA,MAAM,KAAA,IAAN,IAAA,MAAM,KAAA,KAAA,CAAN,GAAM,KAAA,CAAN,GAAA,MAAM,CAAE,OAAR,MAAoB,GAAxB,EAA6B;IAC3B,OAAO,GAAG,KAAK,KAAf;EACD;;EAED,MAAM,YAAY,GAChB,CAAA,MAAM,KAAA,IAAN,IAAA,MAAM,KAAA,KAAA,CAAN,GAAM,KAAA,CAAN,GAAA,MAAM,CAAE,OAAR,MAAoB,OAApB,IAA+B,CAAA,MAAM,KAAA,IAAN,IAAA,MAAM,KAAA,KAAA,CAAN,GAAM,KAAA,CAAN,GAAA,MAAM,CAAE,OAAR,MAAoB,UAAnD,IAAiE,CAAA,MAAM,KAAA,IAAN,IAAA,MAAM,KAAA,KAAA,CAAN,GAAM,KAAA,CAAN,GAAA,MAAM,CAAE,iBAAR,MAA8B,IADjG;EAGA,OAAO,YAAY,IAAI,CAAC,YAAxB;AACD","sourcesContent":["import { Space, Enter } from '@fluentui/keyboard-keys';\nimport * as React from 'react';\n\n/**\n * @internal\n * Checks if the keyboard event should preventDefault() for Enter and Spacebar keys\n *\n * Useful for situations where a keydown needs to be transformed to a click event\n */\nexport function shouldPreventDefaultOnKeyDown(e: KeyboardEvent | React.KeyboardEvent) {\n if (e.defaultPrevented) {\n return false;\n }\n\n const key = e.key;\n const target: HTMLElement | undefined = e.target as HTMLElement;\n\n const matchesByKey = key === Space || key === Enter;\n\n if (target?.tagName === 'A') {\n return key === Space;\n }\n\n const ignoredByTag =\n target?.tagName === 'INPUT' || target?.tagName === 'TEXTAREA' || target?.isContentEditable === true;\n\n return matchesByKey && !ignoredByTag;\n}\n"],"sourceRoot":""}
|
@@ -1,35 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.shouldPreventDefaultOnKeyDown = void 0;
|
7
|
-
|
8
|
-
const keyboard_keys_1 = /*#__PURE__*/require("@fluentui/keyboard-keys");
|
9
|
-
/**
|
10
|
-
* @internal
|
11
|
-
* Checks if the keyboard event should preventDefault() for Enter and Spacebar keys
|
12
|
-
*
|
13
|
-
* Useful for situations where a keydown needs to be transformed to a click event
|
14
|
-
*/
|
15
|
-
|
16
|
-
|
17
|
-
function shouldPreventDefaultOnKeyDown(e) {
|
18
|
-
if (e.defaultPrevented) {
|
19
|
-
return false;
|
20
|
-
}
|
21
|
-
|
22
|
-
const key = e.key;
|
23
|
-
const target = e.target;
|
24
|
-
const matchesByKey = key === keyboard_keys_1.Space || key === keyboard_keys_1.Enter;
|
25
|
-
|
26
|
-
if ((target === null || target === void 0 ? void 0 : target.tagName) === 'A') {
|
27
|
-
return key === keyboard_keys_1.Space;
|
28
|
-
}
|
29
|
-
|
30
|
-
const ignoredByTag = (target === null || target === void 0 ? void 0 : target.tagName) === 'INPUT' || (target === null || target === void 0 ? void 0 : target.tagName) === 'TEXTAREA' || (target === null || target === void 0 ? void 0 : target.isContentEditable) === true;
|
31
|
-
return matchesByKey && !ignoredByTag;
|
32
|
-
}
|
33
|
-
|
34
|
-
exports.shouldPreventDefaultOnKeyDown = shouldPreventDefaultOnKeyDown;
|
35
|
-
//# sourceMappingURL=shouldPreventDefaultOnKeyDown.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/shouldPreventDefaultOnKeyDown.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;AAGA;;;;;AAKG;;;AACH,SAAgB,6BAAhB,CAA8C,CAA9C,EAAoF;EAClF,IAAI,CAAC,CAAC,gBAAN,EAAwB;IACtB,OAAO,KAAP;EACD;;EAED,MAAM,GAAG,GAAG,CAAC,CAAC,GAAd;EACA,MAAM,MAAM,GAA4B,CAAC,CAAC,MAA1C;EAEA,MAAM,YAAY,GAAG,GAAG,KAAK,eAAA,CAAA,KAAR,IAAiB,GAAG,KAAK,eAAA,CAAA,KAA9C;;EAEA,IAAI,CAAA,MAAM,KAAA,IAAN,IAAA,MAAM,KAAA,KAAA,CAAN,GAAM,KAAA,CAAN,GAAA,MAAM,CAAE,OAAR,MAAoB,GAAxB,EAA6B;IAC3B,OAAO,GAAG,KAAK,eAAA,CAAA,KAAf;EACD;;EAED,MAAM,YAAY,GAChB,CAAA,MAAM,KAAA,IAAN,IAAA,MAAM,KAAA,KAAA,CAAN,GAAM,KAAA,CAAN,GAAA,MAAM,CAAE,OAAR,MAAoB,OAApB,IAA+B,CAAA,MAAM,KAAA,IAAN,IAAA,MAAM,KAAA,KAAA,CAAN,GAAM,KAAA,CAAN,GAAA,MAAM,CAAE,OAAR,MAAoB,UAAnD,IAAiE,CAAA,MAAM,KAAA,IAAN,IAAA,MAAM,KAAA,KAAA,CAAN,GAAM,KAAA,CAAN,GAAA,MAAM,CAAE,iBAAR,MAA8B,IADjG;EAGA,OAAO,YAAY,IAAI,CAAC,YAAxB;AACD;;AAlBD,OAAA,CAAA,6BAAA,GAAA,6BAAA","sourcesContent":["import { Space, Enter } from '@fluentui/keyboard-keys';\nimport * as React from 'react';\n\n/**\n * @internal\n * Checks if the keyboard event should preventDefault() for Enter and Spacebar keys\n *\n * Useful for situations where a keydown needs to be transformed to a click event\n */\nexport function shouldPreventDefaultOnKeyDown(e: KeyboardEvent | React.KeyboardEvent) {\n if (e.defaultPrevented) {\n return false;\n }\n\n const key = e.key;\n const target: HTMLElement | undefined = e.target as HTMLElement;\n\n const matchesByKey = key === Space || key === Enter;\n\n if (target?.tagName === 'A') {\n return key === Space;\n }\n\n const ignoredByTag =\n target?.tagName === 'INPUT' || target?.tagName === 'TEXTAREA' || target?.isContentEditable === true;\n\n return matchesByKey && !ignoredByTag;\n}\n"],"sourceRoot":""}
|