UNPKG

stream-chat-react-native-core

Version:

The official React Native and Expo components for Stream Chat, a service for building chat applications

38 lines 2.25 kB
Object.defineProperty(exports, "__esModule", { value: true }); exports.mergeAccessibilityActions = exports.formatAccessibilityValue = exports.composeAccessibilityLabel = void 0; function _createForOfIteratorHelperLoose(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } var composeAccessibilityLabel = (...parts) => parts.filter(p => typeof p === 'string' && p.length > 0).join(', '); exports.composeAccessibilityLabel = composeAccessibilityLabel; var formatAccessibilityValue = ({ max, min = 0, now, text }) => { var value = { max, min, now: Math.min(Math.max(min, now), max) }; if (text) value.text = text; return value; }; exports.formatAccessibilityValue = formatAccessibilityValue; var mergeAccessibilityActions = (...actionLists) => { var byName = new Map(); for (var _i = 0, _actionLists = actionLists; _i < _actionLists.length; _i++) { var list = _actionLists[_i]; if (!list) continue; for (var _iterator = _createForOfIteratorHelperLoose(list), _step; !(_step = _iterator()).done;) { var action = _step.value; byName.set(action.name, action); } } return Array.from(byName.values()); }; exports.mergeAccessibilityActions = mergeAccessibilityActions; //# sourceMappingURL=a11yUtils.js.map