carbon-react 105.1.2 → 106.0.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/esm/__internal__/tooltip-provider/index.d.ts +19 -24
- package/esm/__internal__/tooltip-provider/index.js +1 -11
- package/esm/__internal__/utils/helpers/browser/index.d.ts +15 -1
- package/esm/__internal__/utils/helpers/browser/index.js +33 -1
- package/esm/__internal__/utils/helpers/browser-type-check/index.d.ts +7 -1
- package/esm/__internal__/utils/helpers/browser-type-check/index.js +8 -1
- package/esm/__internal__/utils/helpers/events/composedPath.d.ts +1 -1
- package/esm/__internal__/utils/helpers/events/events.d.ts +132 -31
- package/esm/__internal__/utils/helpers/events/events.js +10 -125
- package/esm/__internal__/utils/helpers/guid/index.d.ts +5 -0
- package/esm/__internal__/utils/helpers/guid/{guid.js → index.js} +0 -2
- package/esm/__internal__/utils/helpers/tags/tags-specs/tags-specs.d.ts +4 -2
- package/esm/__internal__/utils/helpers/tags/tags-specs/tags-specs.js +2 -1
- package/esm/__internal__/utils/helpers/tags/tags.d.ts +10 -6
- package/esm/__internal__/utils/helpers/tags/tags.js +2 -6
- package/esm/__internal__/utils/helpers/useUniqueId/index.d.ts +2 -0
- package/esm/__internal__/utils/helpers/useUniqueId/index.js +7 -0
- package/esm/__internal__/utils/logger/index.d.ts +5 -1
- package/esm/__internal__/utils/logger/index.js +25 -1
- package/esm/components/app-wrapper/app-wrapper.component.d.ts +4 -0
- package/esm/components/app-wrapper/app-wrapper.component.js +5 -3
- package/esm/components/badge/badge.style.d.ts +4 -2
- package/esm/components/button/button-types.style.d.ts +1 -2
- package/esm/components/button/button-types.style.js +3 -1
- package/esm/components/button/button.component.d.ts +67 -36
- package/esm/components/button/button.component.js +3314 -165
- package/esm/components/button/button.config.d.ts +4 -3
- package/esm/components/button/button.style.d.ts +6 -8
- package/esm/components/button/button.style.js +51 -95
- package/esm/components/button/index.d.ts +2 -2
- package/esm/components/confirm/confirm.component.js +1 -1
- package/esm/components/dialog/dialog.component.js +1 -1
- package/esm/components/dialog-full-screen/dialog-full-screen.component.js +1 -1
- package/esm/components/duelling-picklist/picklist-group/picklist-group.style.d.ts +1 -2
- package/esm/components/duelling-picklist/picklist-item/picklist-item.style.d.ts +1 -2
- package/esm/components/fieldset/fieldset.component.d.ts +6 -1
- package/esm/components/fieldset/fieldset.component.js +14 -15
- package/esm/components/heading/heading.component.d.ts +5 -0
- package/esm/components/icon/index.d.ts +1 -0
- package/esm/components/multi-action-button/multi-action-button.component.d.ts +3 -1
- package/esm/components/multi-action-button/multi-action-button.component.js +7 -5
- package/esm/components/multi-action-button/multi-action-button.d.ts +4 -2
- package/esm/components/multi-step-wizard/multi-step-wizard.d.ts +22 -0
- package/esm/components/multi-step-wizard/step/step.d.ts +6 -0
- package/esm/components/multi-step-wizard/step/step.style.d.ts +4 -2
- package/esm/components/portrait/portrait-initials.component.js +1 -1
- package/esm/components/radio-button/radio-button-svg.component.js +29 -16
- package/esm/components/scrollable-list/scrollable-list.component.d.ts +8 -0
- package/esm/components/select/select-list/select-list.component.js +1 -1
- package/esm/components/select/select-textbox/select-textbox.component.js +1 -1
- package/esm/components/split-button/split-button-toggle.style.d.ts +2 -6
- package/esm/components/split-button/split-button.component.d.ts +3 -1
- package/esm/components/split-button/split-button.component.js +7 -4
- package/esm/components/split-button/split-button.d.ts +5 -2
- package/esm/components/tabs/__internal__/tab-title/tab-title.style.js +3 -5
- package/esm/components/textbox/textbox.component.d.ts +1 -2
- package/esm/components/textbox/textbox.component.js +7 -6
- package/esm/components/tooltip/index.d.ts +2 -1
- package/esm/components/tooltip/tooltip-pointer.style.d.ts +10 -1
- package/esm/components/tooltip/tooltip-pointer.style.js +5 -12
- package/esm/components/tooltip/tooltip.component.d.ts +33 -2
- package/esm/components/tooltip/tooltip.component.js +255 -110
- package/esm/components/tooltip/tooltip.config.d.ts +2 -1
- package/esm/components/tooltip/tooltip.style.d.ts +7 -2
- package/esm/components/tooltip/tooltip.style.js +7 -21
- package/esm/components/typography/typography.component.d.ts +1 -1
- package/esm/locales/en-gb.d.ts +3 -5
- package/esm/locales/en-gb.js +5 -4
- package/esm/locales/index.d.ts +1 -1
- package/esm/locales/index.js +2 -0
- package/esm/locales/locale.d.ts +99 -105
- package/esm/locales/locale.js +1 -0
- package/esm/locales/pl-pl.d.ts +3 -5
- package/esm/locales/pl-pl.js +5 -4
- package/esm/style/{fonts → assets}/carbon-icons-webfont.woff +0 -0
- package/esm/style/fonts.css +30 -0
- package/esm/style/global-style.js +1 -1
- package/esm/style/themes/base/base-theme.config.d.ts +17 -8
- package/esm/style/themes/sage/index.d.ts +17 -8
- package/lib/__internal__/tooltip-provider/index.d.ts +19 -24
- package/lib/__internal__/tooltip-provider/index.js +2 -13
- package/lib/__internal__/utils/helpers/browser/index.d.ts +15 -1
- package/lib/__internal__/utils/helpers/browser/index.js +33 -8
- package/lib/__internal__/utils/helpers/browser-type-check/index.d.ts +7 -1
- package/lib/__internal__/utils/helpers/browser-type-check/index.js +10 -21
- package/lib/__internal__/utils/helpers/events/composedPath.d.ts +1 -1
- package/lib/__internal__/utils/helpers/events/events.d.ts +132 -31
- package/lib/__internal__/utils/helpers/events/events.js +10 -125
- package/lib/__internal__/utils/helpers/guid/index.d.ts +5 -0
- package/lib/__internal__/utils/helpers/guid/{guid.js → index.js} +0 -2
- package/lib/__internal__/utils/helpers/guid/package.json +5 -2
- package/lib/__internal__/utils/helpers/tags/tags-specs/tags-specs.d.ts +4 -2
- package/lib/__internal__/utils/helpers/tags/tags-specs/tags-specs.js +2 -1
- package/lib/__internal__/utils/helpers/tags/tags.d.ts +10 -6
- package/lib/__internal__/utils/helpers/tags/tags.js +2 -6
- package/lib/__internal__/utils/helpers/useUniqueId/index.d.ts +2 -0
- package/lib/__internal__/utils/helpers/useUniqueId/index.js +20 -0
- package/lib/__internal__/utils/helpers/useUniqueId/package.json +6 -0
- package/lib/__internal__/utils/logger/index.d.ts +5 -1
- package/lib/__internal__/utils/logger/index.js +26 -8
- package/lib/components/app-wrapper/app-wrapper.component.d.ts +4 -0
- package/lib/components/app-wrapper/app-wrapper.component.js +5 -4
- package/lib/components/badge/badge.style.d.ts +4 -2
- package/lib/components/button/button-types.style.d.ts +1 -2
- package/lib/components/button/button-types.style.js +0 -1
- package/lib/components/button/button.component.d.ts +67 -36
- package/lib/components/button/button.component.js +3381 -172
- package/lib/components/button/button.config.d.ts +4 -3
- package/lib/components/button/button.style.d.ts +6 -8
- package/lib/components/button/button.style.js +52 -101
- package/lib/components/button/index.d.ts +2 -2
- package/lib/components/confirm/confirm.component.js +1 -1
- package/lib/components/dialog/dialog.component.js +1 -1
- package/lib/components/dialog-full-screen/dialog-full-screen.component.js +1 -1
- package/lib/components/duelling-picklist/picklist-group/picklist-group.style.d.ts +1 -2
- package/lib/components/duelling-picklist/picklist-item/picklist-item.style.d.ts +1 -2
- package/lib/components/fieldset/fieldset.component.d.ts +6 -1
- package/lib/components/fieldset/fieldset.component.js +14 -16
- package/lib/components/heading/heading.component.d.ts +5 -0
- package/lib/components/icon/index.d.ts +1 -0
- package/lib/components/multi-action-button/multi-action-button.component.d.ts +3 -1
- package/lib/components/multi-action-button/multi-action-button.component.js +6 -4
- package/lib/components/multi-action-button/multi-action-button.d.ts +4 -2
- package/lib/components/multi-step-wizard/multi-step-wizard.d.ts +22 -0
- package/lib/components/multi-step-wizard/step/step.d.ts +6 -0
- package/lib/components/multi-step-wizard/step/step.style.d.ts +4 -2
- package/lib/components/portrait/portrait-initials.component.js +1 -1
- package/lib/components/radio-button/radio-button-svg.component.js +38 -20
- package/lib/components/scrollable-list/scrollable-list.component.d.ts +8 -0
- package/lib/components/select/select-list/select-list.component.js +1 -1
- package/lib/components/select/select-textbox/select-textbox.component.js +1 -1
- package/lib/components/split-button/split-button-toggle.style.d.ts +2 -6
- package/lib/components/split-button/split-button.component.d.ts +3 -1
- package/lib/components/split-button/split-button.component.js +6 -3
- package/lib/components/split-button/split-button.d.ts +5 -2
- package/lib/components/tabs/__internal__/tab-title/tab-title.style.js +3 -5
- package/lib/components/textbox/textbox.component.d.ts +1 -2
- package/lib/components/textbox/textbox.component.js +7 -8
- package/lib/components/tooltip/index.d.ts +2 -1
- package/lib/components/tooltip/tooltip-pointer.style.d.ts +10 -1
- package/lib/components/tooltip/tooltip-pointer.style.js +7 -15
- package/lib/components/tooltip/tooltip.component.d.ts +33 -2
- package/lib/components/tooltip/tooltip.component.js +221 -130
- package/lib/components/tooltip/tooltip.config.d.ts +2 -1
- package/lib/components/tooltip/tooltip.style.d.ts +7 -2
- package/lib/components/tooltip/tooltip.style.js +7 -22
- package/lib/components/typography/typography.component.d.ts +1 -1
- package/lib/locales/en-gb.d.ts +3 -5
- package/lib/locales/en-gb.js +2 -1
- package/lib/locales/index.d.ts +1 -1
- package/lib/locales/index.js +23 -0
- package/lib/locales/locale.d.ts +99 -105
- package/lib/locales/locale.js +5 -0
- package/lib/{__internal__/utils/ether → locales}/package.json +1 -1
- package/lib/locales/pl-pl.d.ts +3 -5
- package/lib/locales/pl-pl.js +2 -1
- package/lib/style/{fonts → assets}/carbon-icons-webfont.woff +0 -0
- package/lib/style/fonts.css +30 -0
- package/lib/style/global-style.js +1 -1
- package/lib/style/themes/base/base-theme.config.d.ts +17 -8
- package/lib/style/themes/sage/index.d.ts +17 -8
- package/package.json +10 -5
- package/esm/__internal__/utils/ether/ether.d.ts +0 -19
- package/esm/__internal__/utils/ether/ether.js +0 -29
- package/esm/__internal__/utils/ether/index.d.ts +0 -1
- package/esm/__internal__/utils/ether/index.js +0 -1
- package/esm/__internal__/utils/helpers/browser/browser.d.ts +0 -17
- package/esm/__internal__/utils/helpers/browser/browser.js +0 -198
- package/esm/__internal__/utils/helpers/browser-type-check/browser-type-check.d.ts +0 -7
- package/esm/__internal__/utils/helpers/browser-type-check/browser-type-check.js +0 -14
- package/esm/__internal__/utils/helpers/guid/__spec__.d.ts +0 -1
- package/esm/__internal__/utils/helpers/guid/__spec__.js +0 -10
- package/esm/__internal__/utils/helpers/guid/guid.d.ts +0 -2
- package/esm/__internal__/utils/helpers/guid/package.json +0 -3
- package/esm/__internal__/utils/helpers/immutable/__spec__.d.ts +0 -1
- package/esm/__internal__/utils/helpers/immutable/__spec__.js +0 -117
- package/esm/__internal__/utils/helpers/immutable/immutable.d.ts +0 -4
- package/esm/__internal__/utils/helpers/immutable/immutable.js +0 -36
- package/esm/__internal__/utils/helpers/immutable/package.json +0 -4
- package/esm/__internal__/utils/helpers/with-unique-id-props/index.d.ts +0 -1
- package/esm/__internal__/utils/helpers/with-unique-id-props/index.js +0 -1
- package/esm/__internal__/utils/helpers/with-unique-id-props/with-unique-id-props.hoc.d.ts +0 -7
- package/esm/__internal__/utils/helpers/with-unique-id-props/with-unique-id-props.hoc.js +0 -82
- package/esm/__internal__/utils/logger/logger.d.ts +0 -9
- package/esm/__internal__/utils/logger/logger.js +0 -71
- package/esm/components/button/button.d.ts +0 -85
- package/esm/components/tooltip/tooltip.d.ts +0 -40
- package/lib/__internal__/utils/ether/ether.d.ts +0 -19
- package/lib/__internal__/utils/ether/ether.js +0 -33
- package/lib/__internal__/utils/ether/index.d.ts +0 -1
- package/lib/__internal__/utils/ether/index.js +0 -18
- package/lib/__internal__/utils/helpers/browser/browser.d.ts +0 -17
- package/lib/__internal__/utils/helpers/browser/browser.js +0 -213
- package/lib/__internal__/utils/helpers/browser-type-check/browser-type-check.d.ts +0 -7
- package/lib/__internal__/utils/helpers/browser-type-check/browser-type-check.js +0 -26
- package/lib/__internal__/utils/helpers/guid/__spec__.d.ts +0 -1
- package/lib/__internal__/utils/helpers/guid/__spec__.js +0 -15
- package/lib/__internal__/utils/helpers/guid/guid.d.ts +0 -2
- package/lib/__internal__/utils/helpers/immutable/__spec__.d.ts +0 -1
- package/lib/__internal__/utils/helpers/immutable/__spec__.js +0 -135
- package/lib/__internal__/utils/helpers/immutable/immutable.d.ts +0 -4
- package/lib/__internal__/utils/helpers/immutable/immutable.js +0 -46
- package/lib/__internal__/utils/helpers/immutable/package.json +0 -4
- package/lib/__internal__/utils/helpers/with-unique-id-props/index.d.ts +0 -1
- package/lib/__internal__/utils/helpers/with-unique-id-props/index.js +0 -15
- package/lib/__internal__/utils/helpers/with-unique-id-props/package.json +0 -6
- package/lib/__internal__/utils/helpers/with-unique-id-props/with-unique-id-props.hoc.d.ts +0 -7
- package/lib/__internal__/utils/helpers/with-unique-id-props/with-unique-id-props.hoc.js +0 -96
- package/lib/__internal__/utils/logger/logger.d.ts +0 -9
- package/lib/__internal__/utils/logger/logger.js +0 -78
- package/lib/components/button/button.d.ts +0 -85
- package/lib/components/tooltip/tooltip.d.ts +0 -40
|
@@ -1,26 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface TooltipProviderProps {
|
|
3
|
+
/** The position to display the tooltip */
|
|
4
|
+
tooltipPosition?: "top" | "bottom" | "left" | "right";
|
|
5
|
+
/** Control whether the tooltip is visible */
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
/** Aria label for rendered help component */
|
|
8
|
+
helpAriaLabel?: string;
|
|
9
|
+
focusable?: boolean;
|
|
10
|
+
tooltipVisible?: boolean;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
target?: Element;
|
|
5
13
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
/** Control whether the tooltip is visible */
|
|
11
|
-
children: React.ReactNode;
|
|
12
|
-
/** Aria label for rendered help component */
|
|
13
|
-
helpAriaLabel?: string;
|
|
14
|
-
focusable?: boolean;
|
|
15
|
-
tooltipVisible?: boolean;
|
|
16
|
-
disabled?: boolean;
|
|
17
|
-
target?: Element;
|
|
14
|
+
interface ToolbarContextProps extends Omit<TooltipProviderProps, "children"> {
|
|
15
|
+
tooltipId?: {
|
|
16
|
+
current: string;
|
|
17
|
+
};
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
declare const
|
|
21
|
-
|
|
22
|
-
declare function TooltipProvider(props: TooltipProviderProps): JSX.Element;
|
|
23
|
-
|
|
24
|
-
export { ToolbarContext };
|
|
25
|
-
|
|
26
|
-
export default TooltipProvider;
|
|
19
|
+
export declare const TooltipContext: React.Context<ToolbarContextProps>;
|
|
20
|
+
export declare const TooltipProvider: ({ children, tooltipPosition, helpAriaLabel, focusable, tooltipVisible, disabled, target, }: TooltipProviderProps) => JSX.Element;
|
|
21
|
+
export {};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { useRef } from "react";
|
|
2
|
-
import
|
|
3
|
-
import guid from "../utils/helpers/guid/guid";
|
|
2
|
+
import guid from "../utils/helpers/guid";
|
|
4
3
|
export const TooltipContext = /*#__PURE__*/React.createContext({});
|
|
5
4
|
export const TooltipProvider = ({
|
|
6
5
|
children,
|
|
@@ -23,13 +22,4 @@ export const TooltipProvider = ({
|
|
|
23
22
|
target
|
|
24
23
|
}
|
|
25
24
|
}, children);
|
|
26
|
-
};
|
|
27
|
-
TooltipProvider.propTypes = {
|
|
28
|
-
children: PropTypes.node.isRequired,
|
|
29
|
-
tooltipPosition: PropTypes.oneOf(["top", "bottom", "left", "right"]),
|
|
30
|
-
helpAriaLabel: PropTypes.string,
|
|
31
|
-
focusable: PropTypes.bool,
|
|
32
|
-
tooltipVisible: PropTypes.bool,
|
|
33
|
-
disabled: PropTypes.bool,
|
|
34
|
-
target: PropTypes.instanceOf(Element)
|
|
35
25
|
};
|
|
@@ -1 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Browser provides helper methods for working with Browser behavior.
|
|
3
|
+
*/
|
|
4
|
+
declare const Browser: {
|
|
5
|
+
isDomAvailable: () => boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Get the current window
|
|
8
|
+
*/
|
|
9
|
+
getWindow: () => Window | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Get the current document
|
|
12
|
+
*/
|
|
13
|
+
getDocument: () => Document | undefined;
|
|
14
|
+
};
|
|
15
|
+
export default Browser;
|
|
@@ -1 +1,33 @@
|
|
|
1
|
-
|
|
1
|
+
const globalNode = {
|
|
2
|
+
window,
|
|
3
|
+
document: window.document,
|
|
4
|
+
...global
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Browser provides helper methods for working with Browser behavior.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const Browser = {
|
|
11
|
+
isDomAvailable: () => {
|
|
12
|
+
const _window = Browser.getWindow();
|
|
13
|
+
|
|
14
|
+
const _document = Browser.getDocument();
|
|
15
|
+
|
|
16
|
+
return !!(typeof _window !== "undefined" && _document && _document.createElement);
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Get the current window
|
|
21
|
+
*/
|
|
22
|
+
getWindow: () => {
|
|
23
|
+
return globalNode.window;
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Get the current document
|
|
28
|
+
*/
|
|
29
|
+
getDocument: () => {
|
|
30
|
+
return globalNode.document;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
export default Browser;
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
interface WindowInterface extends Partial<Window> {
|
|
2
|
+
chrome?: Record<string, unknown>;
|
|
3
|
+
sidebar?: Record<string, unknown>;
|
|
4
|
+
}
|
|
5
|
+
declare function browserTypeCheck(_window: WindowInterface): boolean;
|
|
6
|
+
export declare function isSafari(navigator: Navigator): boolean;
|
|
7
|
+
export default browserTypeCheck;
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
function browserTypeCheck(_window) {
|
|
2
|
+
return Boolean(_window.chrome || _window.sidebar);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function isSafari(navigator) {
|
|
6
|
+
return navigator.vendor.includes("Apple");
|
|
7
|
+
}
|
|
8
|
+
export default browserTypeCheck;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare
|
|
1
|
+
declare const _default: (ev: CustomEvent) => EventTarget[];
|
|
2
2
|
export default _default;
|
|
@@ -1,32 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JavaScript Events
|
|
3
|
+
*
|
|
4
|
+
* A collection of functions to be used with events.
|
|
5
|
+
*
|
|
6
|
+
* E.g. The KeyPress event has different implementations accross browsers, so
|
|
7
|
+
* this class contains methods to polyfill this functionality to ensure a standardised
|
|
8
|
+
* implementation between browsers
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
declare const Events: {
|
|
12
|
+
/**
|
|
13
|
+
* A method to determine if an event is of a particular type
|
|
14
|
+
* */
|
|
15
|
+
isEventType: (ev: React.SyntheticEvent | Event, type: string) => boolean;
|
|
16
|
+
/**
|
|
17
|
+
* A method to determine whether a key down event was an arrow key
|
|
18
|
+
* */
|
|
19
|
+
isNavigationKeyup: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
|
|
20
|
+
/**
|
|
21
|
+
* A method to determine whether a key down event was an enter key
|
|
22
|
+
* */
|
|
23
|
+
isEnterKeyup: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
|
|
24
|
+
/**
|
|
25
|
+
* A method to determine whether a key up event is allowed or not.
|
|
26
|
+
* */
|
|
27
|
+
isValidKeypress: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Determines if a number key along the top of the keyboard or a number key on the
|
|
30
|
+
* keypad is pressed
|
|
31
|
+
* */
|
|
32
|
+
isNumberKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Determines if the key pressed is part of the numpad
|
|
35
|
+
* includes symbols
|
|
36
|
+
* */
|
|
37
|
+
isNumpadKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Determines if the key pressed is a alphabet key
|
|
40
|
+
* Case insensitive
|
|
41
|
+
* */
|
|
42
|
+
isAlphabetKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Determines if the key pressed is a valid symbol
|
|
45
|
+
* */
|
|
46
|
+
isSymbolKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Determines if the key pressed is a navigation key
|
|
49
|
+
* */
|
|
50
|
+
isNavigationKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Determines if the key pressed is a navigation left key
|
|
53
|
+
* */
|
|
54
|
+
isLeftKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Determines if the key pressed is a navigation up key
|
|
57
|
+
* */
|
|
58
|
+
isUpKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Determines if the key pressed is a navigation right key
|
|
61
|
+
* */
|
|
62
|
+
isRightKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Determines if the key pressed is a navigation down key
|
|
65
|
+
* */
|
|
66
|
+
isDownKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Determines if the key pressed is a meta key
|
|
69
|
+
* */
|
|
70
|
+
isMetaKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Determines if the key pressed is the escape key
|
|
73
|
+
* */
|
|
74
|
+
isEscKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Determines if the key pressed is the enter key
|
|
77
|
+
* */
|
|
78
|
+
isEnterKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Determines if the key pressed is the tab key
|
|
81
|
+
* */
|
|
82
|
+
isTabKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Determines if the key pressed is the backspace key
|
|
85
|
+
* */
|
|
86
|
+
isBackspaceKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Determines if the key pressed is the delete key
|
|
89
|
+
* */
|
|
90
|
+
isDeleteKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Determines if the key pressed is the backspace or delete key
|
|
93
|
+
* */
|
|
94
|
+
isDeletingKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Determines if the key pressed is the shift key
|
|
97
|
+
* */
|
|
98
|
+
isShiftKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Determines if the key pressed is the space key
|
|
101
|
+
* */
|
|
102
|
+
isSpaceKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Determines if the key pressed is the space key or enter key
|
|
105
|
+
* */
|
|
106
|
+
isEnterOrSpaceKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Determines if the key pressed is the period key
|
|
109
|
+
* */
|
|
110
|
+
isPeriodKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Determines if the key pressed is the comma key
|
|
113
|
+
* */
|
|
114
|
+
isCommaKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Determines if the key pressed is the minus key
|
|
117
|
+
* */
|
|
118
|
+
isMinusKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Determines if the key pressed is the home key
|
|
121
|
+
* */
|
|
122
|
+
isHomeKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Determines if the key pressed is the end key
|
|
125
|
+
* */
|
|
126
|
+
isEndKey: (ev: React.KeyboardEvent | KeyboardEvent) => boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Gets the event's path which is an array of the objects on which listeners will be invoked.
|
|
129
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Event/composedPath
|
|
130
|
+
*/
|
|
131
|
+
composedPath: (ev: CustomEvent) => EventTarget[];
|
|
132
|
+
};
|
|
1
133
|
export default Events;
|
|
2
|
-
declare namespace Events {
|
|
3
|
-
function isEventType(ev: Event, type: Type): boolean;
|
|
4
|
-
function isNavigationKeyup(ev: Event): boolean;
|
|
5
|
-
function isEnterKeyup(ev: Event): boolean;
|
|
6
|
-
function isValidKeypress(ev: Event): boolean;
|
|
7
|
-
function isNumberKey(ev: Event): boolean;
|
|
8
|
-
function isNumpadKey(ev: Event): boolean;
|
|
9
|
-
function isAlphabetKey(ev: Event): boolean;
|
|
10
|
-
function isSymbolKey(ev: Event): boolean;
|
|
11
|
-
function isNavigationKey(ev: Event): boolean;
|
|
12
|
-
function isLeftKey(ev: Event): boolean;
|
|
13
|
-
function isUpKey(ev: Event): boolean;
|
|
14
|
-
function isRightKey(ev: Event): boolean;
|
|
15
|
-
function isDownKey(ev: Event): boolean;
|
|
16
|
-
function isMetaKey(ev: Event): boolean;
|
|
17
|
-
function isEscKey(ev: Event): boolean;
|
|
18
|
-
function isEnterKey(ev: Event): boolean;
|
|
19
|
-
function isTabKey(ev: Event): boolean;
|
|
20
|
-
function isBackspaceKey(ev: Event): boolean;
|
|
21
|
-
function isDeleteKey(ev: Event): boolean;
|
|
22
|
-
function isDeletingKey(ev: Event): boolean;
|
|
23
|
-
function isShiftKey(ev: Event): boolean;
|
|
24
|
-
function isSpaceKey(ev: Event): boolean;
|
|
25
|
-
function isEnterOrSpaceKey(ev: Event): boolean;
|
|
26
|
-
function isPeriodKey(ev: Event): boolean;
|
|
27
|
-
function isCommaKey(ev: Event): boolean;
|
|
28
|
-
function isMinusKey(ev: Event): boolean;
|
|
29
|
-
function isHomeKey(ev: Event): boolean;
|
|
30
|
-
function isEndKey(ev: Event): boolean;
|
|
31
|
-
function composedPath(ev: Event): EventTarget[];
|
|
32
|
-
}
|
|
@@ -8,17 +8,11 @@ import composedPath from "./composedPath";
|
|
|
8
8
|
* this class contains methods to polyfill this functionality to ensure a standardised
|
|
9
9
|
* implementation between browsers
|
|
10
10
|
*
|
|
11
|
-
* @object Events
|
|
12
11
|
*/
|
|
13
12
|
|
|
14
13
|
const Events = {
|
|
15
14
|
/**
|
|
16
15
|
* A method to determine if an event is of a particular type
|
|
17
|
-
*
|
|
18
|
-
* @method isEventType
|
|
19
|
-
* @param {Event} ev A JavaScript event
|
|
20
|
-
* @param {Type} type A JavaScript event type
|
|
21
|
-
* @returns {Boolean} true if event type matches passed type
|
|
22
16
|
* */
|
|
23
17
|
isEventType: (ev, type) => {
|
|
24
18
|
return ev.type === type;
|
|
@@ -26,10 +20,6 @@ const Events = {
|
|
|
26
20
|
|
|
27
21
|
/**
|
|
28
22
|
* A method to determine whether a key down event was an arrow key
|
|
29
|
-
*
|
|
30
|
-
* @method isNavigationKeyup
|
|
31
|
-
* @param {Event} ev A JavaScript event
|
|
32
|
-
* @returns {Boolean} true if key up event and a navigation key
|
|
33
23
|
* */
|
|
34
24
|
isNavigationKeyup: ev => {
|
|
35
25
|
if (!Events.isEventType(ev, "keyup")) {
|
|
@@ -41,10 +31,6 @@ const Events = {
|
|
|
41
31
|
|
|
42
32
|
/**
|
|
43
33
|
* A method to determine whether a key down event was an enter key
|
|
44
|
-
*
|
|
45
|
-
* @method isEnterKeyup
|
|
46
|
-
* @param {Event} ev A JavaScript event
|
|
47
|
-
* @returns {Boolean} true if keyup event and enter key
|
|
48
34
|
* */
|
|
49
35
|
isEnterKeyup: ev => {
|
|
50
36
|
if (!Events.isEventType(ev, "keyup")) {
|
|
@@ -56,10 +42,6 @@ const Events = {
|
|
|
56
42
|
|
|
57
43
|
/**
|
|
58
44
|
* A method to determine whether a key up event is allowed or not.
|
|
59
|
-
*
|
|
60
|
-
* @method isValidKeypress
|
|
61
|
-
* @param {Event} ev A JavaScript event
|
|
62
|
-
* @returns {Boolean} true if keyup and valid
|
|
63
45
|
* */
|
|
64
46
|
isValidKeypress: ev => {
|
|
65
47
|
if (!Events.isEventType(ev, "keyup")) {
|
|
@@ -76,68 +58,46 @@ const Events = {
|
|
|
76
58
|
/**
|
|
77
59
|
* Determines if a number key along the top of the keyboard or a number key on the
|
|
78
60
|
* keypad is pressed
|
|
79
|
-
*
|
|
80
|
-
* @method isNumberKey
|
|
81
|
-
* @param {Event} ev A JavaScript event
|
|
82
|
-
* @returns {Boolean} true if valid number key
|
|
83
61
|
* */
|
|
84
62
|
isNumberKey: ev => {
|
|
85
|
-
|
|
86
|
-
|
|
63
|
+
var _ev$key;
|
|
64
|
+
|
|
65
|
+
const charCode = (_ev$key = ev.key) === null || _ev$key === void 0 ? void 0 : _ev$key.charCodeAt(0);
|
|
66
|
+
return charCode !== undefined && charCode >= 48 && charCode <= 57;
|
|
87
67
|
},
|
|
88
68
|
|
|
89
69
|
/**
|
|
90
70
|
* Determines if the key pressed is part of the numpad
|
|
91
71
|
* includes symbols
|
|
92
|
-
*
|
|
93
|
-
* @method isNumberKey
|
|
94
|
-
* @param {Event} ev A JavaScript event
|
|
95
|
-
* @returns {Boolean} true if key is part of numpad
|
|
96
72
|
* */
|
|
97
73
|
isNumpadKey: ev => {
|
|
98
|
-
return ev.which >= 96 && ev.which <= 111;
|
|
74
|
+
return ev.which !== undefined && ev.which >= 96 && ev.which <= 111;
|
|
99
75
|
},
|
|
100
76
|
|
|
101
77
|
/**
|
|
102
78
|
* Determines if the key pressed is a alphabet key
|
|
103
79
|
* Case insensitive
|
|
104
|
-
*
|
|
105
|
-
* @method isAlphabetKey
|
|
106
|
-
* @param {Event} ev A JavaScript event
|
|
107
|
-
* @returns {Boolean} true if alphabet key is pressed
|
|
108
80
|
* */
|
|
109
81
|
isAlphabetKey: ev => {
|
|
110
|
-
return ev.which >= 65 && ev.which <= 90;
|
|
82
|
+
return ev.which !== undefined && ev.which >= 65 && ev.which <= 90;
|
|
111
83
|
},
|
|
112
84
|
|
|
113
85
|
/**
|
|
114
86
|
* Determines if the key pressed is a valid symbol
|
|
115
|
-
*
|
|
116
|
-
* @method isSymbolKey
|
|
117
|
-
* @param {Event} ev A JavaScript event
|
|
118
|
-
* @returns {Boolean} true if any symbol key is pressed
|
|
119
87
|
* */
|
|
120
88
|
isSymbolKey: ev => {
|
|
121
|
-
return ev.which >= 58 && ev.which <= 64 || ev.which >= 106 && ev.which <= 107 || ev.which >= 186 && ev.which <= 192 || ev.which >= 219 && ev.which <= 222;
|
|
89
|
+
return ev.which !== undefined && (ev.which >= 58 && ev.which <= 64 || ev.which >= 106 && ev.which <= 107 || ev.which >= 186 && ev.which <= 192 || ev.which >= 219 && ev.which <= 222);
|
|
122
90
|
},
|
|
123
91
|
|
|
124
92
|
/**
|
|
125
93
|
* Determines if the key pressed is a navigation key
|
|
126
|
-
*
|
|
127
|
-
* @method isNavigationKey
|
|
128
|
-
* @param {Event} ev A JavaScript event
|
|
129
|
-
* @returns {Boolean} true if one of four arrow keys
|
|
130
94
|
* */
|
|
131
95
|
isNavigationKey: ev => {
|
|
132
|
-
return ev.which >= 37 && ev.which <= 40;
|
|
96
|
+
return ev.which !== undefined && ev.which >= 37 && ev.which <= 40;
|
|
133
97
|
},
|
|
134
98
|
|
|
135
99
|
/**
|
|
136
100
|
* Determines if the key pressed is a navigation left key
|
|
137
|
-
*
|
|
138
|
-
* @method isLeftKey
|
|
139
|
-
* @param {Event} ev A JavaScript event
|
|
140
|
-
* @returns {Boolean} true if left arrow key
|
|
141
101
|
* */
|
|
142
102
|
isLeftKey: ev => {
|
|
143
103
|
return ev.which === 37;
|
|
@@ -145,10 +105,6 @@ const Events = {
|
|
|
145
105
|
|
|
146
106
|
/**
|
|
147
107
|
* Determines if the key pressed is a navigation up key
|
|
148
|
-
*
|
|
149
|
-
* @method isUpKey
|
|
150
|
-
* @param {Event} ev A JavaScript event
|
|
151
|
-
* @returns {Boolean} true if up arrow key
|
|
152
108
|
* */
|
|
153
109
|
isUpKey: ev => {
|
|
154
110
|
return ev.which === 38;
|
|
@@ -156,10 +112,6 @@ const Events = {
|
|
|
156
112
|
|
|
157
113
|
/**
|
|
158
114
|
* Determines if the key pressed is a navigation right key
|
|
159
|
-
*
|
|
160
|
-
* @method isRightKey
|
|
161
|
-
* @param {Event} ev A JavaScript event
|
|
162
|
-
* @returns {Boolean} true if right arrow key
|
|
163
115
|
* */
|
|
164
116
|
isRightKey: ev => {
|
|
165
117
|
return ev.which === 39;
|
|
@@ -167,10 +119,6 @@ const Events = {
|
|
|
167
119
|
|
|
168
120
|
/**
|
|
169
121
|
* Determines if the key pressed is a navigation down key
|
|
170
|
-
*
|
|
171
|
-
* @method isDownKey
|
|
172
|
-
* @param {Event} ev A JavaScript event
|
|
173
|
-
* @returns {Boolean} true if down arrow key
|
|
174
122
|
* */
|
|
175
123
|
isDownKey: ev => {
|
|
176
124
|
return ev.which === 40;
|
|
@@ -178,21 +126,13 @@ const Events = {
|
|
|
178
126
|
|
|
179
127
|
/**
|
|
180
128
|
* Determines if the key pressed is a meta key
|
|
181
|
-
*
|
|
182
|
-
* @method isMetaKey
|
|
183
|
-
* @param {Event} ev A JavaScript event
|
|
184
|
-
* @returns {Boolean} true if any meta key is pressed
|
|
185
129
|
* */
|
|
186
130
|
isMetaKey: ev => {
|
|
187
|
-
return ev.metaKey;
|
|
131
|
+
return !!ev.metaKey;
|
|
188
132
|
},
|
|
189
133
|
|
|
190
134
|
/**
|
|
191
135
|
* Determines if the key pressed is the escape key
|
|
192
|
-
*
|
|
193
|
-
* @method isEscKey
|
|
194
|
-
* @param {Event} ev A JavaScript event
|
|
195
|
-
* @returns {Boolean} true if esc key
|
|
196
136
|
* */
|
|
197
137
|
isEscKey: ev => {
|
|
198
138
|
return ev.which === 27;
|
|
@@ -200,10 +140,6 @@ const Events = {
|
|
|
200
140
|
|
|
201
141
|
/**
|
|
202
142
|
* Determines if the key pressed is the enter key
|
|
203
|
-
*
|
|
204
|
-
* @method isEnterKey
|
|
205
|
-
* @param {Event} ev A JavaScript event
|
|
206
|
-
* @returns {Boolean} true if enter key
|
|
207
143
|
* */
|
|
208
144
|
isEnterKey: ev => {
|
|
209
145
|
return ev.which === 13;
|
|
@@ -211,10 +147,6 @@ const Events = {
|
|
|
211
147
|
|
|
212
148
|
/**
|
|
213
149
|
* Determines if the key pressed is the tab key
|
|
214
|
-
*
|
|
215
|
-
* @method isTabKey
|
|
216
|
-
* @param {Event} ev A JavaScript event
|
|
217
|
-
* @returns {Boolean} true if tab key
|
|
218
150
|
* */
|
|
219
151
|
isTabKey: ev => {
|
|
220
152
|
return ev.which === 9;
|
|
@@ -222,10 +154,6 @@ const Events = {
|
|
|
222
154
|
|
|
223
155
|
/**
|
|
224
156
|
* Determines if the key pressed is the backspace key
|
|
225
|
-
*
|
|
226
|
-
* @method isBackspaceKey
|
|
227
|
-
* @param {Event} ev A JavaScript event
|
|
228
|
-
* @returns {Boolean} true if backspace key
|
|
229
157
|
* */
|
|
230
158
|
isBackspaceKey: ev => {
|
|
231
159
|
return ev.key === "Backspace";
|
|
@@ -233,10 +161,6 @@ const Events = {
|
|
|
233
161
|
|
|
234
162
|
/**
|
|
235
163
|
* Determines if the key pressed is the delete key
|
|
236
|
-
*
|
|
237
|
-
* @method isDeleteKey
|
|
238
|
-
* @param {Event} ev A JavaScript event
|
|
239
|
-
* @returns {Boolean} true if delete key
|
|
240
164
|
* */
|
|
241
165
|
isDeleteKey: ev => {
|
|
242
166
|
return ev.key === "Delete";
|
|
@@ -244,10 +168,6 @@ const Events = {
|
|
|
244
168
|
|
|
245
169
|
/**
|
|
246
170
|
* Determines if the key pressed is the backspace or delete key
|
|
247
|
-
*
|
|
248
|
-
* @method isDeletingKey
|
|
249
|
-
* @param {Event} ev A JavaScript event
|
|
250
|
-
* @returns {Boolean} true if is delete key or backspace key
|
|
251
171
|
* */
|
|
252
172
|
isDeletingKey: ev => {
|
|
253
173
|
return Events.isDeleteKey(ev) || Events.isBackspaceKey(ev);
|
|
@@ -255,10 +175,6 @@ const Events = {
|
|
|
255
175
|
|
|
256
176
|
/**
|
|
257
177
|
* Determines if the key pressed is the shift key
|
|
258
|
-
*
|
|
259
|
-
* @method isShiftKey
|
|
260
|
-
* @param {Event} ev A JavaScript event
|
|
261
|
-
* @returns {Boolean} true if shift key
|
|
262
178
|
* */
|
|
263
179
|
isShiftKey: ev => {
|
|
264
180
|
return ev.shiftKey || ev.which === 16;
|
|
@@ -266,10 +182,6 @@ const Events = {
|
|
|
266
182
|
|
|
267
183
|
/**
|
|
268
184
|
* Determines if the key pressed is the space key
|
|
269
|
-
*
|
|
270
|
-
* @method isSpaceKey
|
|
271
|
-
* @param {Event} ev A JavaScript event
|
|
272
|
-
* @returns {Boolean} true if space key
|
|
273
185
|
* */
|
|
274
186
|
isSpaceKey: ev => {
|
|
275
187
|
return ev.which === 32;
|
|
@@ -277,10 +189,6 @@ const Events = {
|
|
|
277
189
|
|
|
278
190
|
/**
|
|
279
191
|
* Determines if the key pressed is the space key or enter key
|
|
280
|
-
*
|
|
281
|
-
* @method isEnterOrSpaceKey
|
|
282
|
-
* @param {Event} ev A JavaScript event
|
|
283
|
-
* @returns {Boolean} true if space key
|
|
284
192
|
* */
|
|
285
193
|
isEnterOrSpaceKey: ev => {
|
|
286
194
|
return ev.which === 13 || ev.which === 32;
|
|
@@ -288,10 +196,6 @@ const Events = {
|
|
|
288
196
|
|
|
289
197
|
/**
|
|
290
198
|
* Determines if the key pressed is the period key
|
|
291
|
-
*
|
|
292
|
-
* @method isPeriodKey
|
|
293
|
-
* @param {Event} ev A JavaScript event
|
|
294
|
-
* @returns {Boolean} true if period key
|
|
295
199
|
* */
|
|
296
200
|
isPeriodKey: ev => {
|
|
297
201
|
return ev.which === 190;
|
|
@@ -299,10 +203,6 @@ const Events = {
|
|
|
299
203
|
|
|
300
204
|
/**
|
|
301
205
|
* Determines if the key pressed is the comma key
|
|
302
|
-
*
|
|
303
|
-
* @method isCommaKey
|
|
304
|
-
* @param {Event} ev A JavaScript event
|
|
305
|
-
* @returns {Boolean} true if comma key
|
|
306
206
|
* */
|
|
307
207
|
isCommaKey: ev => {
|
|
308
208
|
return ev.which === 188;
|
|
@@ -310,10 +210,6 @@ const Events = {
|
|
|
310
210
|
|
|
311
211
|
/**
|
|
312
212
|
* Determines if the key pressed is the minus key
|
|
313
|
-
*
|
|
314
|
-
* @method isMinusKey
|
|
315
|
-
* @param {Event} ev A JavaScript event
|
|
316
|
-
* @returns {Boolean} true if minus key
|
|
317
213
|
* */
|
|
318
214
|
isMinusKey: ev => {
|
|
319
215
|
return ev.key === "-" || ev.key === "Subtract";
|
|
@@ -321,10 +217,6 @@ const Events = {
|
|
|
321
217
|
|
|
322
218
|
/**
|
|
323
219
|
* Determines if the key pressed is the home key
|
|
324
|
-
*
|
|
325
|
-
* @method isHomeKey
|
|
326
|
-
* @param {Event} ev A JavaScript event
|
|
327
|
-
* @returns {Boolean} true if home key
|
|
328
220
|
* */
|
|
329
221
|
isHomeKey: ev => {
|
|
330
222
|
return ev.which === 36;
|
|
@@ -332,10 +224,6 @@ const Events = {
|
|
|
332
224
|
|
|
333
225
|
/**
|
|
334
226
|
* Determines if the key pressed is the end key
|
|
335
|
-
*
|
|
336
|
-
* @method isEndKey
|
|
337
|
-
* @param {Event} ev A JavaScript event
|
|
338
|
-
* @returns {Boolean} true if end key
|
|
339
227
|
* */
|
|
340
228
|
isEndKey: ev => {
|
|
341
229
|
return ev.which === 35;
|
|
@@ -344,12 +232,9 @@ const Events = {
|
|
|
344
232
|
/**
|
|
345
233
|
* Gets the event's path which is an array of the objects on which listeners will be invoked.
|
|
346
234
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Event/composedPath
|
|
347
|
-
* @method composedPath
|
|
348
|
-
* @param {Event} ev A Javascript event
|
|
349
|
-
* @returns {EventTarget[]} objects representing the objects on which an event listener will be invoked
|
|
350
235
|
*/
|
|
351
236
|
composedPath: ev => {
|
|
352
|
-
return ev.
|
|
237
|
+
return ev.detail && ev.detail.enzymeTestingTarget && composedPath(ev) || ev.composedPath && ev.composedPath() || composedPath(ev);
|
|
353
238
|
}
|
|
354
239
|
};
|
|
355
240
|
export default Events;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { ReactWrapper, ShallowWrapper } from "enzyme";
|
|
2
|
+
declare const elementsTagTest: (wrapper: ReactWrapper, elements: string[]) => void;
|
|
3
|
+
declare const rootTagTest: (rootNode: ReactWrapper | ShallowWrapper, comp: string, elem?: string | undefined, role?: string | undefined) => void;
|
|
4
|
+
export { elementsTagTest, rootTagTest };
|
|
@@ -12,6 +12,7 @@ const rootTagTest = (rootNode, comp, elem, role) => {
|
|
|
12
12
|
expect(rootNode.prop("data-component")).toEqual(comp);
|
|
13
13
|
expect(rootNode.prop("data-element")).toEqual(elem);
|
|
14
14
|
expect(rootNode.prop("data-role")).toEqual(role);
|
|
15
|
-
};
|
|
15
|
+
}; // eslint-disable-next-line jest/no-export
|
|
16
|
+
|
|
16
17
|
|
|
17
18
|
export { elementsTagTest, rootTagTest };
|