UNPKG

maisonsport-common-ui

Version:

Suite of styled-components to be consumed by the React-Native App and by the Web (via React-Native for Web)

74 lines (55 loc) 3.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _react = _interopRequireDefault(require("react")); var _native = _interopRequireWildcard(require("styled-components/native")); var _styledSystem = require("styled-system"); var _accessibleSystem = _interopRequireDefault(require("accessible-system")); var _theme = _interopRequireDefault(require("../../theme")); function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (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; } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _templateObject() { const data = _taggedTemplateLiteral(["\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n"]); _templateObject = function () { return data; }; return data; } function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } const textDecoration = (0, _styledSystem.system)({ textDecoration: true }); const textDecorationColor = (0, _styledSystem.system)({ textDecorationColor: true }); const textVariant = (0, _styledSystem.variant)({ scale: 'text' }); const StyledText = _native.default.Text.attrs(_accessibleSystem.default)(_templateObject(), textVariant, textDecoration, textDecorationColor, _styledSystem.color, _styledSystem.space, _styledSystem.typography, _styledSystem.flexbox, _styledSystem.fontFamily); function Text({ noWrapTheme, touchable, ...props }) { const propsCopy = { ...props }; if (touchable) delete propsCopy.pointerEvents; if (noWrapTheme) { // eslint-disable-next-line react/jsx-props-no-spreading return /*#__PURE__*/_react.default.createElement(StyledText, propsCopy); } return /*#__PURE__*/_react.default.createElement(_native.ThemeProvider, { theme: _theme.default }, /*#__PURE__*/_react.default.createElement(StyledText, propsCopy)); } Text.defaultProps = { variant: 'p', touchable: false, pointerEvents: 'none' }; var _default = Text; exports.default = _default; //# sourceMappingURL=index.js.map