UNPKG

@fluentui/react-northstar

Version:
34 lines (32 loc) 2.19 kB
"use strict"; exports.__esModule = true; exports.rtlTextContainer = void 0; var React = _interopRequireWildcard(require("react")); function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } var rtlTextContainer = { getAttributes: function getAttributes(_ref) { var _ref$condition = _ref.condition, condition = _ref$condition === void 0 ? true : _ref$condition, _ref$forElements = _ref.forElements, forElements = _ref$forElements === void 0 ? [] : _ref$forElements; return condition && forElements.some(function (child) { return child && typeof child === 'string'; }) ? { dir: 'auto' } : {}; }, createFor: function createFor(_ref2) { var element = _ref2.element, _ref2$condition = _ref2.condition, condition = _ref2$condition === void 0 ? true : _ref2$condition; if (condition && element && typeof element === 'string') { return /*#__PURE__*/React.createElement("span", { dir: "auto" }, element); } return element; } }; exports.rtlTextContainer = rtlTextContainer; //# sourceMappingURL=rtlTextContainer.js.map