UNPKG

carbon-react

Version:

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

2 lines (1 loc) 732 B
"use strict";var e=require("react"),t=require("../action-popover-item/action-popover-item.component.js");function r(e){return e&&e.__esModule?e:{default:e}}var i=r(e);const o=e=>{var t;return i.default.isValidElement(e)&&!!(null===(t=e.props)||void 0===t?void 0:t.disabled)},n=e=>i.default.Children.toArray(e).some((e=>"string"==typeof e||!!i.default.isValidElement(e)&&n(e.props.children)));exports.checkChildrenForString=n,exports.findFirstFocusableItem=e=>e.findIndex(((t,r)=>!o(e[r]))),exports.findLastFocusableItem=e=>{for(let t=e.length-1;t>=0;t--)if(!o(e[t]))return t;return-1},exports.getItems=e=>i.default.Children.toArray(e).filter((e=>i.default.isValidElement(e)&&e.type===t.ActionPopoverItem)),exports.isItemDisabled=o;