@muraldevkit/ui-toolkit 4.60.1-dev-W3pi.1 → 4.61.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.
@@ -1,15 +1,20 @@
1
1
  import * as React from 'react';
2
2
  type RefType = HTMLElement | HTMLDivElement | null;
3
3
  /**
4
- * Gets tabbable elements in a given bit of the DOM
4
+ * Gets tabbable elements in a given bit of the DOM, excluding disabled elements
5
5
  * @param {RefType} ref - the ref of the container
6
- * @param {string} selector - the selector to query
6
+ * @param {string} selector - the selector to query (should already exclude disabled elements)
7
7
  * @returns {HTMLElement[]} - an array of tabbable HTML elements
8
8
  */
9
9
  export declare const getTabbableElements: (ref: RefType, selector: string) => HTMLElement[];
10
10
  export type FocusOnInitPosition = 'first' | 'last';
11
11
  export interface RovingPropTypes {
12
12
  activeSelector?: string;
13
+ /**
14
+ * If true, disabled elements (with disabled attribute or aria-disabled="true")
15
+ * will be included in the roving tabindex. Defaults to true (disabled elements are included).
16
+ */
17
+ allowDisabled?: boolean;
13
18
  children: React.ReactNode;
14
19
  /**
15
20
  * delayMount is used to apply a delay to the mounting
@@ -72,8 +77,19 @@ declare class MrlRovingTabindex extends React.Component<RovingPropTypes> {
72
77
  */
73
78
  setElements: () => void;
74
79
  /**
75
- * Gets the components active element based on priority order.
76
- * @returns {HTMLElement | undefined} - the active HTML element
80
+ * Queries for a single element matching the selector within the container.
81
+ * @param selector - CSS selector to query
82
+ * @returns The matching element or null
83
+ */
84
+ queryElement: (selector: string) => HTMLElement | null;
85
+ /**
86
+ * Gets the active element based on priority order:
87
+ * 1. Element matching the custom `activeSelector` prop (e.g., custom radio elements)
88
+ * 2. Element with `data-roving-active` attribute (programmatically set active)
89
+ * 3. First element with `data-roving` attribute (default fallback)
90
+ *
91
+ * Disabled elements are excluded unless `allowDisabled` is true.
92
+ * @returns The active HTML element, or undefined if none found
77
93
  */
78
94
  getActiveElement: () => HTMLElement | undefined;
79
95
  /**
@@ -90,12 +106,14 @@ declare class MrlRovingTabindex extends React.Component<RovingPropTypes> {
90
106
  setElementFocus: (el: HTMLElement | undefined) => void;
91
107
  /**
92
108
  * Sets focus to an element based on a direction (`forward` or `back`)
109
+ * Disabled elements are already excluded from this.elements via CSS selector
93
110
  * @param {NavigationDirection} direction 'forward' | 'back'
94
111
  * @returns {void}
95
112
  */
96
113
  setFocusByDirection: (direction: NavigationDirection) => void;
97
114
  /**
98
115
  * Sets all tabindex for elements of this component to -1
116
+ * Also ensures disabled elements (excluded from roving tabindex) have tabindex=-1
99
117
  * @returns {void}
100
118
  */
101
119
  unsetTabbableElements: () => void;