@muraldevkit/ui-toolkit 2.64.0 → 2.66.0
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/dist/components/index.d.ts +1 -0
- package/dist/components/menu/MrlMenu/MrlMenu.d.ts +15 -1
- package/dist/components/rovingTabindex/MrlRovingTabindex/MrlRovingTabindex.d.ts +127 -0
- package/dist/components/rovingTabindex/MrlRovingTabindex/index.d.ts +1 -0
- package/dist/components/rovingTabindex/index.d.ts +1 -0
- package/dist/components/svg/config.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/utils/layers/index.d.ts +4 -0
- package/package.json +3 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { RefObject } from 'react';
|
|
2
|
+
import { PortalProps } from '../../../components';
|
|
2
3
|
import { MenuPosition, MenuAlignment, ActionState, CustomMenuPosition } from '../constants';
|
|
3
4
|
export interface MrlMenuProps {
|
|
4
5
|
/** Custom position for the menu */
|
|
@@ -7,6 +8,15 @@ export interface MrlMenuProps {
|
|
|
7
8
|
children: React.ReactNode;
|
|
8
9
|
/** Event to close the menu */
|
|
9
10
|
clickOutsideEvent?: 'mouseup' | 'mousedown' | 'click';
|
|
11
|
+
/**
|
|
12
|
+
* Disable arrows from opening the menu
|
|
13
|
+
* - This is useful when you want to disable the default browser behavior of opening a menu on arrow down.
|
|
14
|
+
*
|
|
15
|
+
* Example usage: the menu is within a vertical toolbar and you want to use the arrow keys to navigate the toolbar.
|
|
16
|
+
* By using this prop you can disable the arrow key open/close so that navigating the toolbar does not conflict
|
|
17
|
+
* with opening/closing the menu.
|
|
18
|
+
*/
|
|
19
|
+
disableArrowOpen?: boolean;
|
|
10
20
|
/** Unique identifier for the menu */
|
|
11
21
|
id?: string;
|
|
12
22
|
/**
|
|
@@ -39,6 +49,10 @@ export interface MrlMenuProps {
|
|
|
39
49
|
* @default 10px
|
|
40
50
|
*/
|
|
41
51
|
menuOffset?: number;
|
|
52
|
+
/**
|
|
53
|
+
* Configuration for the portal component
|
|
54
|
+
*/
|
|
55
|
+
portalProps?: Omit<PortalProps, 'children'>;
|
|
42
56
|
/**
|
|
43
57
|
* Horizontal and vertical alignment of the menu relative to the trigger element
|
|
44
58
|
* - position 'left', 'right', 'top', 'bottom' position relative to the trigger
|
|
@@ -91,7 +105,7 @@ export interface MrlMenuProps {
|
|
|
91
105
|
* @param {MrlMenuProps} props - The props for the MrlMenu component
|
|
92
106
|
* @returns {Element} - rendered MrlMenu component
|
|
93
107
|
*/
|
|
94
|
-
export declare function MrlMenu({ actionState, alignment, children, customPosition, clickOutsideEvent, id, isInternal, isSubMenu, spacing, menuOffset, position, triggerStopPropagation, onClose, triggerRef, ...remainingProps }: MrlMenuProps): JSX.Element;
|
|
108
|
+
export declare function MrlMenu({ actionState, alignment, children, customPosition, clickOutsideEvent, disableArrowOpen, id, isInternal, isSubMenu, spacing, menuOffset, portalProps, position, triggerStopPropagation, onClose, triggerRef, ...remainingProps }: MrlMenuProps): JSX.Element;
|
|
95
109
|
export declare namespace MrlMenu {
|
|
96
110
|
var componentType: string;
|
|
97
111
|
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
type RefType = HTMLElement | HTMLDivElement | null;
|
|
3
|
+
/**
|
|
4
|
+
* Gets tabbable elements in a given bit of the DOM
|
|
5
|
+
*
|
|
6
|
+
* @param {RefType} ref - the ref of the container
|
|
7
|
+
* @param {string} selector - the selector to query
|
|
8
|
+
* @returns {HTMLElement[]} - an array of tabbable HTML elements
|
|
9
|
+
*/
|
|
10
|
+
export declare const getTabbableElements: (ref: RefType, selector: string) => HTMLElement[];
|
|
11
|
+
export type FocusOnInitPosition = 'first' | 'last';
|
|
12
|
+
export interface RovingPropTypes {
|
|
13
|
+
activeSelector?: string;
|
|
14
|
+
children: unknown;
|
|
15
|
+
/**
|
|
16
|
+
* delayMount is used to apply a delay to the mounting
|
|
17
|
+
* of the RovingTabindex component. This can be helpful in
|
|
18
|
+
* the event that a component's children have not been fully
|
|
19
|
+
* rendered by the time the componentDidMount function is triggered
|
|
20
|
+
*/
|
|
21
|
+
delayMount?: number;
|
|
22
|
+
focusOnInit?: FocusOnInitPosition;
|
|
23
|
+
focusWithShortcut?: boolean;
|
|
24
|
+
forceUpdate?: boolean;
|
|
25
|
+
hasChildRoving?: boolean;
|
|
26
|
+
ignoreElements?: string;
|
|
27
|
+
isFocused?: boolean;
|
|
28
|
+
onBlur?: () => void;
|
|
29
|
+
onRefocus?: (shouldRefocus: boolean) => void;
|
|
30
|
+
orientation?: RovingOrientation;
|
|
31
|
+
qa?: string;
|
|
32
|
+
}
|
|
33
|
+
type RovingOrientation = 'horizontal' | 'vertical';
|
|
34
|
+
type NavigationDirection = 'forward' | 'back';
|
|
35
|
+
/**
|
|
36
|
+
* Component to create a Roving Tabindex in the DOM
|
|
37
|
+
*
|
|
38
|
+
* @returns {HTMLDivElement}
|
|
39
|
+
*/
|
|
40
|
+
declare class MrlRovingTabindex extends React.Component<RovingPropTypes> {
|
|
41
|
+
elements: Array<Element | null>;
|
|
42
|
+
orientation: RovingOrientation;
|
|
43
|
+
ref: HTMLDivElement | null;
|
|
44
|
+
selector: string;
|
|
45
|
+
/**
|
|
46
|
+
* MrlRovingTabindex class constructor
|
|
47
|
+
*
|
|
48
|
+
* @param {RovingPropTypes} props - the MrlRovingTabindex props
|
|
49
|
+
* @returns {void}
|
|
50
|
+
*/
|
|
51
|
+
constructor(props: RovingPropTypes);
|
|
52
|
+
/**
|
|
53
|
+
* Runs when the MrlRovingTabindex component mounts
|
|
54
|
+
*/
|
|
55
|
+
componentDidMount(): void;
|
|
56
|
+
/**
|
|
57
|
+
* Runs when the MrlRovingTabindex component updates
|
|
58
|
+
*
|
|
59
|
+
* @param {RovingPropTypes} prevProps - the props before the component updated
|
|
60
|
+
*/
|
|
61
|
+
componentDidUpdate(prevProps: RovingPropTypes): void;
|
|
62
|
+
handleRef: (ref: HTMLDivElement) => HTMLDivElement;
|
|
63
|
+
/**
|
|
64
|
+
* Sets component array of elements
|
|
65
|
+
*
|
|
66
|
+
* @returns {void}
|
|
67
|
+
*/
|
|
68
|
+
setElements: () => void;
|
|
69
|
+
/**
|
|
70
|
+
* Gets the components active element based on priority order.
|
|
71
|
+
*
|
|
72
|
+
* @returns {HTMLElement | undefined} - the active HTML element
|
|
73
|
+
*/
|
|
74
|
+
getActiveElement: () => HTMLElement | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* Sets an element to `tabindex=0` and sets all other elements to `tabindex=-1`
|
|
77
|
+
*
|
|
78
|
+
* @param {HTMLElement | undefined} el - the element to set as active
|
|
79
|
+
* @returns {void}
|
|
80
|
+
*/
|
|
81
|
+
setActiveElement: (el: HTMLElement | undefined) => void;
|
|
82
|
+
/**
|
|
83
|
+
* Sets focus to a specific element
|
|
84
|
+
*
|
|
85
|
+
* @param {HTMLElement | undefined} el - the element to set in focus
|
|
86
|
+
* @returns {void}
|
|
87
|
+
*/
|
|
88
|
+
setElementFocus: (el: HTMLElement | undefined) => void;
|
|
89
|
+
/**
|
|
90
|
+
* Sets focus to an element based on a direction (`forward` or `back`)
|
|
91
|
+
*
|
|
92
|
+
* @param {NavigationDirection} direction 'forward' | 'back'
|
|
93
|
+
* @returns {void}
|
|
94
|
+
*/
|
|
95
|
+
setFocusByDirection: (direction: NavigationDirection) => void;
|
|
96
|
+
/**
|
|
97
|
+
* Sets all tabindex for elements of this component to -1
|
|
98
|
+
*
|
|
99
|
+
* @returns {void}
|
|
100
|
+
*/
|
|
101
|
+
unsetTabbableElements: () => void;
|
|
102
|
+
/**
|
|
103
|
+
* Will return `false` if the orientation param matches the
|
|
104
|
+
* orientation of the component and the actively focused element has a menu or select
|
|
105
|
+
*
|
|
106
|
+
* @param orientation : 'horizontal' | 'vertical'
|
|
107
|
+
* @returns boolean
|
|
108
|
+
*/
|
|
109
|
+
canUseArrows: (orientation: RovingOrientation) => boolean;
|
|
110
|
+
handleKeyUp: (e: React.KeyboardEvent) => void;
|
|
111
|
+
handleFocusedFirst: () => void;
|
|
112
|
+
handleFocusedLast: () => void;
|
|
113
|
+
handleRefocus: () => void;
|
|
114
|
+
/**
|
|
115
|
+
* Mounts the MrlRovingTabindex component
|
|
116
|
+
*
|
|
117
|
+
* @returns {void}
|
|
118
|
+
*/
|
|
119
|
+
mount(): void;
|
|
120
|
+
/**
|
|
121
|
+
* Renders the MrlRovingTabindex component
|
|
122
|
+
*
|
|
123
|
+
* @returns {HTMLDivElement}
|
|
124
|
+
*/
|
|
125
|
+
render(): JSX.Element;
|
|
126
|
+
}
|
|
127
|
+
export { MrlRovingTabindex };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './MrlRovingTabindex';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './MrlRovingTabindex';
|