@qlean/york-web
Advanced tools
Comparing version 0.3.6-beta-7 to 0.3.6-beta-8
@@ -1,128 +0,1 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var _styledComponents = _interopRequireDefault(require("styled-components")); | ||
var _ramda = _interopRequireDefault(require("ramda")); | ||
var _styles = require("../../utils/styles"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _templateObject3() { | ||
var data = _taggedTemplateLiteral(["\n flex-direction: ", ";\n align-items: ", ";\n justify-content: ", ";\n flex-wrap: ", ";\n "]); | ||
_templateObject3 = function _templateObject3() { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _templateObject2() { | ||
var data = _taggedTemplateLiteral(["\n flex-direction: ", ";\n align-items: ", ";\n justify-content: ", ";\n flex-wrap: ", ";\n "]); | ||
_templateObject2 = function _templateObject2() { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _templateObject() { | ||
var data = _taggedTemplateLiteral(["\n flex-direction: ", ";\n align-items: ", ";\n justify-content: ", ";\n flex-wrap: ", ";\n "]); | ||
_templateObject = function _templateObject() { | ||
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) } })); } | ||
var FlexBase = _styledComponents.default.div.withConfig({ | ||
displayName: "FlexBase", | ||
componentId: "v1u8zp-0" | ||
})(["display:flex;", " ", " ", ""], _styles.legacyMedia.mobile(_templateObject(), function (_ref) { | ||
var flexDirectionMobile = _ref.flexDirectionMobile; | ||
return flexDirectionMobile; | ||
}, function (_ref2) { | ||
var alignItemsMobile = _ref2.alignItemsMobile; | ||
return alignItemsMobile; | ||
}, function (_ref3) { | ||
var justifyContentMobile = _ref3.justifyContentMobile; | ||
return justifyContentMobile; | ||
}, function (_ref4) { | ||
var flexWrapMobile = _ref4.flexWrapMobile; | ||
return flexWrapMobile; | ||
}), _styles.legacyMedia.base(_templateObject2(), function (_ref5) { | ||
var flexDirectionBase = _ref5.flexDirectionBase; | ||
return flexDirectionBase; | ||
}, function (_ref6) { | ||
var alignItemsBase = _ref6.alignItemsBase; | ||
return alignItemsBase; | ||
}, function (_ref7) { | ||
var justifyContentBase = _ref7.justifyContentBase; | ||
return justifyContentBase; | ||
}, function (_ref8) { | ||
var flexWrapBase = _ref8.flexWrapBase; | ||
return flexWrapBase; | ||
}), _styles.legacyMedia.wide(_templateObject3(), function (_ref9) { | ||
var flexDirectionWide = _ref9.flexDirectionWide; | ||
return flexDirectionWide; | ||
}, function (_ref10) { | ||
var alignItemsWide = _ref10.alignItemsWide; | ||
return alignItemsWide; | ||
}, function (_ref11) { | ||
var justifyContentWide = _ref11.justifyContentWide; | ||
return justifyContentWide; | ||
}, function (_ref12) { | ||
var flexWrapWide = _ref12.flexWrapWide; | ||
return flexWrapWide; | ||
})); | ||
var flexDirectionTypes = { | ||
row: 'row', | ||
rowReverse: 'row-reverse', | ||
column: 'column' | ||
}; | ||
var alignItemsTypes = { | ||
center: 'center', | ||
flexStart: 'flex-start', | ||
flexEnd: 'flex-end', | ||
stretch: 'stretch' | ||
}; | ||
var justifyContentTypes = { | ||
center: 'center', | ||
flexStart: 'flex-start', | ||
flexEnd: 'flex-end', | ||
spaceBetween: 'space-between' | ||
}; | ||
var flexWrapTypes = { | ||
nowrap: 'nowrap', | ||
wrap: 'wrap', | ||
wrapReverse: 'wrap-reverse' | ||
}; | ||
var _default = (0, _styles.withResponsiveProps)([{ | ||
name: 'flexDirection', | ||
propType: _propTypes.default.oneOf(_ramda.default.values(flexDirectionTypes)) | ||
}, { | ||
name: 'alignItems', | ||
propType: _propTypes.default.oneOf(_ramda.default.values(alignItemsTypes)) | ||
}, { | ||
name: 'justifyContent', | ||
propType: _propTypes.default.oneOf(_ramda.default.values(justifyContentTypes)) | ||
}, { | ||
name: 'flexWrap', | ||
propType: _propTypes.default.oneOf(_ramda.default.values(flexWrapTypes)) | ||
}])(FlexBase); | ||
exports.default = _default; | ||
undefined |
@@ -1,63 +0,1 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var _styledComponents = _interopRequireDefault(require("styled-components")); | ||
var _ramda = _interopRequireDefault(require("ramda")); | ||
var _styles = require("../../utils/styles"); | ||
var _FlexBase = _interopRequireDefault(require("./FlexBase")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } | ||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } | ||
var columnWidth = 100 / _styles.GRID_COLUMNS; | ||
var getBaseCss = function getBaseCss(columns) { | ||
return columns ? "width: ".concat(columns * columnWidth, "%;") : 'display: none;'; | ||
}; | ||
var StyledFlexColumn = _styledComponents.default.div.withConfig({ | ||
displayName: "FlexColumn__StyledFlexColumn", | ||
componentId: "sc-1q2rcry-0" | ||
})(["padding:0 ", "px;box-sizing:border-box;", ""], _styles.GRID_GUTTER / 2, function (_ref) { | ||
var columnsMobile = _ref.columnsMobile, | ||
columnsBase = _ref.columnsBase, | ||
columnsWide = _ref.columnsWide; | ||
return "\n ".concat(_styles.media.mobile(getBaseCss(columnsMobile)), "\n ").concat(_styles.media.base(getBaseCss(columnsBase)), "\n ").concat(_styles.media.wide(getBaseCss(columnsWide)), "\n "); | ||
}); | ||
var FlexColumn = function FlexColumn(_ref2) { | ||
var children = _ref2.children, | ||
props = _objectWithoutProperties(_ref2, ["children"]); | ||
return _react.default.createElement(StyledFlexColumn, props, _react.default.createElement(_FlexBase.default, _extends({ | ||
flexDirection: "column" | ||
}, props), children)); | ||
}; | ||
FlexColumn.propTypes = { | ||
children: _propTypes.default.node | ||
}; | ||
var _default = (0, _styles.withResponsiveProps)([{ | ||
name: 'columns', | ||
propType: _propTypes.default.oneOf(_ramda.default.range(0, 13)), | ||
defaultValue: 12 | ||
}])(FlexColumn); | ||
exports.default = _default; | ||
undefined |
@@ -1,93 +0,1 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var _styledComponents = _interopRequireDefault(require("styled-components")); | ||
var _ramda = _interopRequireDefault(require("ramda")); | ||
var _styles = require("../../utils/styles"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _templateObject3() { | ||
var data = _taggedTemplateLiteral(["\n height: ", "px;\n width: ", "px;\n "]); | ||
_templateObject3 = function _templateObject3() { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _templateObject2() { | ||
var data = _taggedTemplateLiteral(["\n height: ", "px;\n width: ", "px;\n "]); | ||
_templateObject2 = function _templateObject2() { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _templateObject() { | ||
var data = _taggedTemplateLiteral(["\n height: ", "px;\n width: ", "px;\n "]); | ||
_templateObject = function _templateObject() { | ||
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) } })); } | ||
var sizes = { | ||
0: 0, | ||
1: (0, _styles.g)(1), | ||
2: (0, _styles.g)(2), | ||
3: (0, _styles.g)(3), | ||
4: (0, _styles.g)(4), | ||
6: (0, _styles.g)(6), | ||
8: (0, _styles.g)(8), | ||
12: (0, _styles.g)(12), | ||
16: (0, _styles.g)(16), | ||
20: (0, _styles.g)(20), | ||
24: (0, _styles.g)(24) | ||
}; | ||
var Separator = _styledComponents.default.div.withConfig({ | ||
displayName: "Separator", | ||
componentId: "sc-1472nu6-0" | ||
})(["flex-shrink:0;", " ", " ", ""], function (_ref) { | ||
var height = _ref.heightMobile, | ||
width = _ref.widthMobile; | ||
return _styles.legacyMedia.mobile(_templateObject(), sizes[height], sizes[width]); | ||
}, function (_ref2) { | ||
var height = _ref2.heightBase, | ||
width = _ref2.widthBase; | ||
return _styles.legacyMedia.base(_templateObject2(), sizes[height], sizes[width]); | ||
}, function (_ref3) { | ||
var height = _ref3.heightWide, | ||
width = _ref3.widthWide; | ||
return _styles.legacyMedia.wide(_templateObject3(), sizes[height], sizes[width]); | ||
}); | ||
var sizesPropTypes = _propTypes.default.oneOf(_ramda.default.map(Number, _ramda.default.keys(sizes))); | ||
var _default = (0, _styles.withResponsiveProps)([{ | ||
name: 'height', | ||
propType: sizesPropTypes, | ||
defaultValue: 0 | ||
}, { | ||
name: 'width', | ||
propType: sizesPropTypes, | ||
defaultValue: 0 | ||
}])(Separator); | ||
exports.default = _default; | ||
undefined |
@@ -1,173 +0,1 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = Text; | ||
exports.getCss = exports.getBaseCss = exports.presets = exports.htmlTags = void 0; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var _styledComponents = _interopRequireDefault(require("styled-components")); | ||
var _ramda = _interopRequireDefault(require("ramda")); | ||
var _yorkCore = require("@qlean/york-core"); | ||
var _styles = require("../../utils/styles"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } | ||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } | ||
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } | ||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } | ||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } | ||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
var htmlTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'div', 'span']; | ||
exports.htmlTags = htmlTags; | ||
var presets = { | ||
ph1: { | ||
fontSize: 70, | ||
lineHeight: 75, | ||
fontWeight: 700 | ||
}, | ||
ph2: { | ||
fontSize: 60, | ||
lineHeight: 65, | ||
fontWeight: 700 | ||
}, | ||
ph3: { | ||
fontSize: 50, | ||
lineHeight: 55, | ||
fontWeight: 700 | ||
}, | ||
h1: { | ||
fontSize: 40, | ||
lineHeight: 45, | ||
fontWeight: 700 | ||
}, | ||
h2: { | ||
fontSize: 30, | ||
lineHeight: 35, | ||
fontWeight: 700 | ||
}, | ||
h3: { | ||
fontSize: 25, | ||
lineHeight: 30, | ||
fontWeight: 700 | ||
}, | ||
h4: { | ||
fontSize: 20, | ||
lineHeight: 25, | ||
fontWeight: 700 | ||
}, | ||
h5: { | ||
fontSize: 16, | ||
lineHeight: 25, | ||
fontWeight: 700 | ||
}, | ||
text1: { | ||
fontSize: 20, | ||
lineHeight: 30, | ||
fontWeight: 500 | ||
}, | ||
text2: { | ||
fontSize: 16, | ||
lineHeight: 25, | ||
fontWeight: 500 | ||
}, | ||
link: { | ||
fontSize: 15, | ||
lineHeight: 25, | ||
fontWeight: 700, | ||
letterSpacing: 1, | ||
textTransform: 'uppercase' | ||
}, | ||
caption1: { | ||
fontSize: 14, | ||
lineHeight: 20, | ||
fontWeight: 500 | ||
}, | ||
caption2: { | ||
fontSize: 12, | ||
lineHeight: 15, | ||
fontWeight: 500 | ||
} | ||
}; | ||
exports.presets = presets; | ||
var getBaseCss = function getBaseCss(_ref) { | ||
var color = _ref.color, | ||
fontWeight = _ref.fontWeight, | ||
fontSize = _ref.fontSize, | ||
lineHeight = _ref.lineHeight, | ||
textAlign = _ref.textAlign, | ||
fontStyle = _ref.fontStyle, | ||
letterSpacing = _ref.letterSpacing, | ||
textTransform = _ref.textTransform, | ||
textDecoration = _ref.textDecoration; | ||
return "\n color: ".concat(color === 'inherit' ? 'inherit' : _yorkCore.colors[color], ";\n font-weight: ").concat(fontWeight, ";\n font-size: ").concat(fontSize, "px;\n line-height: ").concat(lineHeight, "px;\n ").concat(textAlign ? "text-align: ".concat(textAlign) : '', ";\n ").concat(fontStyle ? "font-style: ".concat(fontStyle) : '', ";\n ").concat(letterSpacing ? "letter-spacing: ".concat(letterSpacing, "px") : '', ";\n ").concat(textTransform ? "text-transform: ".concat(textTransform) : '', ";\n ").concat(textDecoration ? "text-decoration: ".concat(textDecoration) : '', ";\n"); | ||
}; | ||
exports.getBaseCss = getBaseCss; | ||
var defaultProps = { | ||
preset: 'text2', | ||
color: 'coal' | ||
}; | ||
var getCss = function getCss(initialProps) { | ||
var props = _objectSpread({}, defaultProps, initialProps); | ||
var _mergeStyleProps = (0, _styles.mergeStyleProps)([(0, _styles.unwrapResponsivePreset)('preset', presets, props), (0, _styles.unwrapResponsiveProps)(['color', 'fontWeight', 'fontSize', 'textAlign', 'lineHeight', 'textDecoration', 'textTransform'], props)]), | ||
mobileProps = _mergeStyleProps.mobileProps, | ||
baseProps = _mergeStyleProps.baseProps, | ||
wideProps = _mergeStyleProps.wideProps; | ||
return "\n font-family: \"Museo Sans\";\n margin: 0;\n ".concat(_styles.media.mobile(getBaseCss(mobileProps)), "\n ").concat(_styles.media.base(getBaseCss(baseProps)), "\n ").concat(_styles.media.wide(getBaseCss(wideProps)), "\n "); | ||
}; | ||
exports.getCss = getCss; | ||
var StyledText = _styledComponents.default.span.withConfig({ | ||
displayName: "Text__StyledText", | ||
componentId: "cpekj3-0" | ||
})(["", ""], getCss); | ||
var components = _ramda.default.pipe(_ramda.default.map(function (tag) { | ||
return [tag, StyledText.withComponent(tag)]; | ||
}), _ramda.default.fromPairs)(htmlTags); | ||
function Text(_ref2) { | ||
var htmlTag = _ref2.htmlTag, | ||
rest = _objectWithoutProperties(_ref2, ["htmlTag"]); | ||
var StyledTextComponent = components[htmlTag]; | ||
return _react.default.createElement(StyledTextComponent, rest); | ||
} | ||
Text.propTypes = _objectSpread({ | ||
htmlTag: _propTypes.default.oneOf(htmlTags) | ||
}, (0, _styles.getResponsivePropTypes)({ | ||
preset: _propTypes.default.oneOf(Object.keys(presets)), | ||
color: _propTypes.default.oneOf([].concat(_toConsumableArray(Object.keys(_yorkCore.colors)), ['inherit'])), | ||
fontWeight: _propTypes.default.oneOf([500, 700, 900]), | ||
textAlign: _propTypes.default.oneOf(['left', 'center', 'right']), | ||
lineHeight: _propTypes.default.number, | ||
fontSize: _propTypes.default.number | ||
})); | ||
Text.defaultProps = { | ||
htmlTag: 'span' | ||
}; | ||
undefined |
@@ -1,255 +0,1 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.getResponsivePropTypes = exports.mergeStyleProps = exports.unwrapResponsivePreset = exports.unwrapResponsiveProps = exports.getResponsiveProps = exports.withResponsiveProps = exports.legacyMedia = exports.media = exports.scrollToConfig = exports.headerHeight = exports.footerHeights = exports.mediaMaxWidths = exports.mediaBreakpoints = exports.borderRadiuses = exports.transitions = exports.shadows = exports.BUTTON_HOVER_STYLES = exports.MOBILE_PADDING = exports.GRID_GUTTER = exports.GRID_COLUMNS = exports.g = exports.UI_GRID_POINT = void 0; | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var _styledComponents = require("styled-components"); | ||
var _yorkCore = require("@qlean/york-core"); | ||
var _ramda = _interopRequireDefault(require("ramda")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
var UI_GRID_POINT = 5; | ||
exports.UI_GRID_POINT = UI_GRID_POINT; | ||
var g = function g() { | ||
var times = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1; | ||
return times * UI_GRID_POINT; | ||
}; | ||
exports.g = g; | ||
var GRID_COLUMNS = 12; | ||
exports.GRID_COLUMNS = GRID_COLUMNS; | ||
var GRID_GUTTER = g(4); | ||
exports.GRID_GUTTER = GRID_GUTTER; | ||
var MOBILE_PADDING = g(6); | ||
exports.MOBILE_PADDING = MOBILE_PADDING; | ||
var BUTTON_HOVER_STYLES = { | ||
black: "background-color: ".concat(_yorkCore.colors.coal, "; color: ").concat(_yorkCore.colors.white, ";"), | ||
green: "filter: brightness(110%); color: ".concat(_yorkCore.colors.white, ";"), | ||
grayLinear: "border-color: ".concat(_yorkCore.colors.grey, "; color: ").concat(_yorkCore.colors.coal, ";"), | ||
greenLinear: "filter: brightness(130%) saturate(60%); color: ".concat(_yorkCore.colors.green, ";"), | ||
greenRound: "transform: translateY(-3px); box-shadow: 0 10px 10px 0 rgba(0,59,23,0.10); color: ".concat(_yorkCore.colors.white, ";"), | ||
greenRoundLinear: "transform: translateY(-3px); box-shadow: 0 10px 10px 0 rgba(0,59,23,0.10); color: ".concat(_yorkCore.colors.green, ";"), | ||
whiteRound: "transform: translateY(-3px); box-shadow: 0 10px 10px 0 rgba(0,59,23,0.10); color: ".concat(_yorkCore.colors.coal, ";") | ||
}; | ||
exports.BUTTON_HOVER_STYLES = BUTTON_HOVER_STYLES; | ||
var shadows = { | ||
light: '0 1px 2px 0 rgba(0,0,0,0.10)', | ||
medium: '0 1px 2px rgba(0,0,0,0.25)', | ||
strong: '0 2px 6px 0 rgba(0,0,0,0.30)' | ||
}; | ||
exports.shadows = shadows; | ||
var transitions = { | ||
short: 'all 0.1s ease-in-out', | ||
medium: 'all 0.25s ease-in-out', | ||
long: 'all 0.4s ease-in-out' | ||
}; | ||
exports.transitions = transitions; | ||
var borderRadiuses = { | ||
small: '4px', | ||
medium: '6px', | ||
round: '100px', | ||
none: 'none' | ||
}; | ||
exports.borderRadiuses = borderRadiuses; | ||
var mediaBreakpoints = { | ||
base: 991, | ||
wide: 1280 | ||
}; | ||
exports.mediaBreakpoints = mediaBreakpoints; | ||
var mediaMaxWidths = { | ||
base: 940, | ||
wide: 1120, | ||
mobile: 360 | ||
}; | ||
exports.mediaMaxWidths = mediaMaxWidths; | ||
var footerHeights = { | ||
base: g(61), | ||
mobile: g(102) | ||
}; | ||
exports.footerHeights = footerHeights; | ||
var headerHeight = g(12); | ||
exports.headerHeight = headerHeight; | ||
var scrollToConfig = { | ||
duration: 750, | ||
smooth: true | ||
}; | ||
exports.scrollToConfig = scrollToConfig; | ||
var media = { | ||
mobile: function mobile(string) { | ||
return "\n @media (max-width: ".concat(mediaBreakpoints.base, "px) {\n ").concat(string, "\n }\n "); | ||
}, | ||
base: function base(string) { | ||
return "\n @media (min-width: ".concat(mediaBreakpoints.base + 1, "px) and (max-width: ").concat(mediaBreakpoints.wide - 1, "px) {\n ").concat(string, "\n }\n "); | ||
}, | ||
wide: function wide(string) { | ||
return "\n @media (min-width: ".concat(mediaBreakpoints.wide, "px) {\n ").concat(string, "\n }\n "); | ||
}, | ||
desktop: function desktop(string) { | ||
return "\n @media (min-width: ".concat(mediaBreakpoints.base + 1, "px) {\n ").concat(string, "\n }\n "); | ||
} | ||
}; | ||
exports.media = media; | ||
var legacyMedia = { | ||
mobile: function mobile() { | ||
return (0, _styledComponents.css)(["@media (max-width:", "px){", "}"], mediaBreakpoints.base, _styledComponents.css.apply(void 0, arguments)); | ||
}, | ||
base: function base() { | ||
return (0, _styledComponents.css)(["@media (min-width:", "px) and (max-width:", "px){", "}"], mediaBreakpoints.base + 1, mediaBreakpoints.wide - 1, _styledComponents.css.apply(void 0, arguments)); | ||
}, | ||
wide: function wide() { | ||
return (0, _styledComponents.css)(["@media (min-width:", "px){", "}"], mediaBreakpoints.wide, _styledComponents.css.apply(void 0, arguments)); | ||
} | ||
}; | ||
exports.legacyMedia = legacyMedia; | ||
var mediaTypes = ['Mobile', 'Base', 'Wide']; | ||
var withResponsiveProps = function withResponsiveProps(responsivePropsNames) { | ||
return function (WrappedComponent) { | ||
var HigherOrderComponent = | ||
/*#__PURE__*/ | ||
function (_PureComponent) { | ||
_inherits(HigherOrderComponent, _PureComponent); | ||
function HigherOrderComponent() { | ||
_classCallCheck(this, HigherOrderComponent); | ||
return _possibleConstructorReturn(this, _getPrototypeOf(HigherOrderComponent).apply(this, arguments)); | ||
} | ||
_createClass(HigherOrderComponent, [{ | ||
key: "render", | ||
value: function render() { | ||
var _this = this; | ||
var responsiveProps = _ramda.default.pipe(_ramda.default.map(function (_ref) { | ||
var name = _ref.name, | ||
defaultValue = _ref.defaultValue; | ||
return _ramda.default.map(function (mediaType) { | ||
var propName = "".concat(name).concat(mediaType); | ||
return [propName, _this.props[propName] || _this.props[name] || defaultValue]; | ||
}, mediaTypes); | ||
}), _ramda.default.reduce(_ramda.default.concat, []), _ramda.default.fromPairs)(responsivePropsNames); | ||
return _react.default.createElement(WrappedComponent, _extends({}, responsiveProps, this.props)); | ||
} | ||
}]); | ||
return HigherOrderComponent; | ||
}(_react.PureComponent); | ||
HigherOrderComponent.displayName = "WithResponsiveProps(".concat(WrappedComponent.name, ")"); | ||
HigherOrderComponent.propTypes = _ramda.default.pipe(_ramda.default.map(function (_ref2) { | ||
var name = _ref2.name, | ||
propType = _ref2.propType; | ||
return _ramda.default.pipe(_ramda.default.map(function (mediaType) { | ||
return ["".concat(name).concat(mediaType), propType]; | ||
}), _ramda.default.append([name, propType]))(mediaTypes); | ||
}), _ramda.default.reduce(_ramda.default.concat, []), _ramda.default.fromPairs)(responsivePropsNames); | ||
return HigherOrderComponent; | ||
}; | ||
}; | ||
exports.withResponsiveProps = withResponsiveProps; | ||
var getResponsiveProps = function getResponsiveProps(propName, props) { | ||
return _ramda.default.pick(_ramda.default.map(function (mediaType) { | ||
return "".concat(propName).concat(mediaType); | ||
}, mediaTypes), props); | ||
}; | ||
exports.getResponsiveProps = getResponsiveProps; | ||
var mediaTypePropNames = ['mobileProps', 'baseProps', 'wideProps']; | ||
var unwrapResponsiveProps = function unwrapResponsiveProps(propsNames, props) { | ||
var unwrappedProps = {}; | ||
propsNames.forEach(function (propName) { | ||
mediaTypePropNames.forEach(function (mediaType) { | ||
var responsiveValue = _ramda.default.path([mediaType, propName], props); | ||
var defaultValue = props[propName]; | ||
var value = _ramda.default.isNil(responsiveValue) ? defaultValue : responsiveValue; | ||
if (!_ramda.default.isNil(value)) { | ||
unwrappedProps = _ramda.default.assocPath([mediaType, propName], _ramda.default.isNil(responsiveValue) ? defaultValue : responsiveValue, unwrappedProps); | ||
} | ||
}); | ||
}); | ||
return unwrappedProps; | ||
}; | ||
exports.unwrapResponsiveProps = unwrapResponsiveProps; | ||
var unwrapResponsivePreset = function unwrapResponsivePreset(presetKey, presets, props) { | ||
return _ramda.default.pipe(_ramda.default.map(function (mediaType) { | ||
var responsivePresetName = _ramda.default.path([mediaType, presetKey], props); | ||
var defaultPresetName = props[presetKey]; | ||
var presetName = _ramda.default.isNil(responsivePresetName) ? defaultPresetName : responsivePresetName; | ||
if (!presetName) { | ||
// eslint-disable-next-line no-console | ||
console.warn("".concat(presetName, " preset name is not found in ").concat(JSON.stringify(presets))); | ||
} | ||
var preset = presets[presetName]; | ||
if (!preset) { | ||
// eslint-disable-next-line no-console | ||
console.warn("".concat(presetName, " preset is not found in ").concat(JSON.stringify(presets))); | ||
} | ||
return [mediaType, preset || {}]; | ||
}), _ramda.default.fromPairs)(mediaTypePropNames); | ||
}; | ||
exports.unwrapResponsivePreset = unwrapResponsivePreset; | ||
var mergeStyleProps = _ramda.default.reduce(_ramda.default.mergeDeepWithKey(function (key, l, r) { | ||
return key === 'css' ? "".concat(l, "\n").concat(r) : r; | ||
}), {}); | ||
exports.mergeStyleProps = mergeStyleProps; | ||
var getResponsivePropTypes = function getResponsivePropTypes(propTypes) { | ||
return _objectSpread({}, propTypes, _ramda.default.pipe(_ramda.default.map(function (mediaType) { | ||
return [mediaType, _propTypes.default.shape(propTypes)]; | ||
}), _ramda.default.fromPairs)(mediaTypePropNames)); | ||
}; | ||
exports.getResponsivePropTypes = getResponsivePropTypes; | ||
undefined |
{ | ||
"name": "@qlean/york-web", | ||
"version": "0.3.6-beta-7", | ||
"version": "0.3.6-beta-8", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
import PropTypes from 'prop-types'; | ||
import styled from 'styled-components'; | ||
import R from 'ramda'; | ||
import * as R from 'ramda'; | ||
@@ -5,0 +5,0 @@ import { legacyMedia, withResponsiveProps } from 'utils/styles'; |
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import styled from 'styled-components'; | ||
import R from 'ramda'; | ||
import * as R from 'ramda'; | ||
@@ -6,0 +6,0 @@ import { GRID_COLUMNS, GRID_GUTTER, media, withResponsiveProps } from 'utils/styles'; |
import PropTypes from 'prop-types'; | ||
import styled from 'styled-components'; | ||
import R from 'ramda'; | ||
import * as R from 'ramda'; | ||
@@ -5,0 +5,0 @@ import { g, withResponsiveProps, legacyMedia } from 'utils/styles'; |
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import styled from 'styled-components'; | ||
import R from 'ramda'; | ||
import * as R from 'ramda'; | ||
import { colors } from '@qlean/york-core'; | ||
@@ -6,0 +6,0 @@ |
@@ -5,3 +5,3 @@ import React, { PureComponent } from 'react'; | ||
import { colors } from '@qlean/york-core'; | ||
import R from 'ramda'; | ||
import * as R from 'ramda'; | ||
@@ -8,0 +8,0 @@ export const UI_GRID_POINT = 5; |
157013
3109