UNPKG

@guruhotel/aura-hooks

Version:

🪝 Hooks library designed by the Guruhotel team for Aura UI

1 lines 882 B
exports.__esModule=!0,exports.FOCUS_SELECTOR=void 0,exports.findTabbableDescendants=function(t){return Array.from(t.querySelectorAll(e)).filter(u)},exports.focusable=o,exports.tabbable=u;const t=/input|select|textarea|button|object/,e="a, input, select, textarea, button, object, [tabindex]";function n(t){return"test"!==process.env.NODE_ENV&&"none"===t.style.display}function r(t){let e=t.getAttribute("tabindex");return null===e&&(e=""),parseInt(e,10)}function o(e){const o=e.nodeName.toLowerCase(),u=!Number.isNaN(r(e));return(t.test(o)&&!e.disabled||e instanceof HTMLAnchorElement&&e.href||u)&&function(t){if(t.getAttribute("aria-hidden")||t.getAttribute("hidden")||"hidden"===t.getAttribute("type"))return!1;let e=t;for(;e&&e!==document.body;){if(n(e))return!1;e=e.parentNode}return!0}(e)}function u(t){const e=r(t);return(Number.isNaN(e)||e>=0)&&o(t)}exports.FOCUS_SELECTOR=e;