UNPKG

carbon-react

Version:

A library of reusable React components for easily building user interfaces.

2 lines (1 loc) 756 B
"use strict";require("react");var e=require("../../../../__internal__/utils/helpers/events/events.js"),t=require("../locators.js");exports.characterNavigation=function(e,n){if(e&&n)return n.find((n=>{var i,r,o,a,u;return!!(null==n?void 0:n.getAttribute("data-component"))&&[t.MENU_ITEM,t.SCROLLABLE_BLOCK_PARENT].includes(n.getAttribute("data-component"))&&(null===(i=null===(r=null==(o=n)||null===(u=o.textContent)||void 0===u||null===(a=u.split("\n"))||void 0===a?void 0:a.map((e=>e.trim())).join(" "))||void 0===r?void 0:r.toLowerCase())||void 0===i?void 0:i.startsWith(e.toLowerCase()))}))},exports.menuKeyboardNavigation=function(t,n){return e.default.isHomeKey(t)?(t.preventDefault(),0):e.default.isEndKey(t)?(t.preventDefault(),n.length-1):void 0};