@muraldevkit/ui-toolkit 2.65.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.
@@ -26,3 +26,4 @@ export * from './empty';
26
26
  export * from './live-region';
27
27
  export * from './callout';
28
28
  export * from './panel';
29
+ export * from './rovingTabindex';
@@ -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';
@@ -115,7 +115,7 @@ export declare const colorPictoStoryData: {
115
115
  export declare const animateStoryData: {
116
116
  args: {
117
117
  delay: number;
118
- state: "stop" | "play";
118
+ state: "play" | "stop";
119
119
  };
120
120
  argTypes: {
121
121
  delay: {