react-grid-system
Advanced tools
Comparing version 8.1.6 to 8.1.8
@@ -15,13 +15,10 @@ "use strict"; | ||
}; | ||
const getConfiguration = () => configuration; | ||
exports.getConfiguration = getConfiguration; | ||
const setConfiguration = newConfiguration => { | ||
configuration = { ...configuration, | ||
configuration = { | ||
...configuration, | ||
...newConfiguration | ||
}; | ||
}; | ||
exports.setConfiguration = setConfiguration; |
@@ -7,26 +7,14 @@ "use strict"; | ||
exports.default = exports.ScreenClassContext = exports.NO_PROVIDER_FLAG = void 0; | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var _utils = require("../../utils"); | ||
var _config = require("../../config"); | ||
var _primitives = require("../../primitives"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (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; } | ||
const NO_PROVIDER_FLAG = 'NO_PROVIDER_FLAG'; | ||
exports.NO_PROVIDER_FLAG = NO_PROVIDER_FLAG; | ||
const ScreenClassContext = /*#__PURE__*/_react.default.createContext(NO_PROVIDER_FLAG); | ||
exports.ScreenClassContext = ScreenClassContext; | ||
const ScreenClassProvider = _ref => { | ||
@@ -52,3 +40,2 @@ let { | ||
}; | ||
ScreenClassProvider.propTypes = { | ||
@@ -60,3 +47,2 @@ /** | ||
children: _propTypes.default.node.isRequired, | ||
/** | ||
@@ -67,3 +53,2 @@ * Boolean to determine whether own width should be used as source. | ||
useOwnWidth: _propTypes.default.bool, | ||
/** | ||
@@ -70,0 +55,0 @@ * Screen class to use when it cannot be determined otherwise. |
@@ -7,15 +7,8 @@ "use strict"; | ||
exports.default = void 0; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var _ScreenClassProvider = _interopRequireWildcard(require("../ScreenClassProvider")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (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; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
const ScreenClassResolver = _ref => { | ||
@@ -29,7 +22,5 @@ let { | ||
} | ||
return children(screenClassCheck); | ||
}); | ||
}; | ||
ScreenClassResolver.propTypes = { | ||
@@ -36,0 +27,0 @@ children: _propTypes.default.func.isRequired |
@@ -7,23 +7,12 @@ "use strict"; | ||
exports.default = void 0; | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var _style = _interopRequireDefault(require("./style")); | ||
var _config = require("../../config"); | ||
var _Row = require("../Row"); | ||
var _ScreenClassResolver = _interopRequireDefault(require("../../context/ScreenClassResolver")); | ||
var _primitives = require("../../primitives"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (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; } | ||
const Col = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => { | ||
@@ -79,3 +68,2 @@ let { | ||
}); | ||
Col.propTypes = { | ||
@@ -86,3 +74,2 @@ /** | ||
children: _propTypes.default.node, | ||
/** | ||
@@ -92,3 +79,2 @@ * The width of the column for screenclass `xs`, either a number between 0 and 12, or "content" | ||
xs: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.oneOf(['content'])]), | ||
/** | ||
@@ -98,3 +84,2 @@ * The width of the column for screenclass `sm`, either a number between 0 and 12, or "content" | ||
sm: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.oneOf(['content'])]), | ||
/** | ||
@@ -104,3 +89,2 @@ * The width of the column for screenclass `md`, either a number between 0 and 12, or "content" | ||
md: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.oneOf(['content'])]), | ||
/** | ||
@@ -110,3 +94,2 @@ * The width of the column for screenclass `lg`, either a number between 0 and 12, or "content" | ||
lg: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.oneOf(['content'])]), | ||
/** | ||
@@ -116,3 +99,2 @@ * The width of the column for screenclass `xl`, either a number between 0 and 12, or "content" | ||
xl: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.oneOf(['content'])]), | ||
/** | ||
@@ -122,3 +104,2 @@ * The width of the column for screenclass `xxl`, either a number between 0 and 12, or "content" | ||
xxl: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.oneOf(['content'])]), | ||
/** | ||
@@ -128,3 +109,2 @@ * The width of the column for screenclass `xxl`, either a number between 0 and 12, or "content" | ||
xxxl: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.oneOf(['content'])]), | ||
/** | ||
@@ -134,3 +114,2 @@ * A fixed width of the column for all screenclasses" | ||
width: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]), | ||
/** | ||
@@ -148,3 +127,2 @@ * The offset of this column for all screenclasses | ||
}), | ||
/** | ||
@@ -162,3 +140,2 @@ * The amount this column is pushed to the right for all screenclasses | ||
}), | ||
/** | ||
@@ -176,3 +153,2 @@ * The amount this column is pulled to the left for all screenclasses | ||
}), | ||
/** | ||
@@ -190,3 +166,2 @@ * The order this column is pulled to the left for all screenclasses | ||
}), | ||
/** | ||
@@ -196,3 +171,2 @@ * Optional styling | ||
style: _propTypes.default.objectOf(_propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])), | ||
/** | ||
@@ -202,3 +176,2 @@ * Set to apply some debug styling | ||
debug: _propTypes.default.bool, | ||
/** | ||
@@ -205,0 +178,0 @@ * Use your own component |
@@ -7,13 +7,9 @@ "use strict"; | ||
exports.default = void 0; | ||
var _utils = require("../../utils"); | ||
const hasWidth = widths => Object.keys(widths).reduce((acc, cur) => acc || widths[cur], false); | ||
const getWidth = (width, gridColumns) => { | ||
if (typeof width !== 'number') return undefined; | ||
const normalizedWidth = Math.max(0, Math.min(gridColumns, width)); | ||
return "".concat(100 / gridColumns * normalizedWidth, "%"); | ||
return `${100 / gridColumns * normalizedWidth}%`; | ||
}; | ||
var _default = _ref => { | ||
@@ -41,3 +37,2 @@ let { | ||
}; | ||
if (debug) { | ||
@@ -48,3 +43,2 @@ styles.outline = '1px solid silver'; | ||
} | ||
styles.flexBasis = '100%'; | ||
@@ -57,3 +51,2 @@ styles.flexGrow = 0; | ||
styles.left = 'auto'; | ||
_utils.screenClasses.forEach((size, index) => { | ||
@@ -69,3 +62,2 @@ if (_utils.screenClasses.indexOf(screenClass) >= index) { | ||
styles.left = getWidth(push[size], gridColumns) || styles.left; | ||
if (order[size]) { | ||
@@ -76,3 +68,2 @@ styles.order = order[size]; | ||
}); | ||
if (!hasWidth(width)) { | ||
@@ -82,3 +73,2 @@ styles.flexBasis = 0; | ||
} | ||
if (forceWidth) { | ||
@@ -90,8 +80,7 @@ styles.flexBasis = 'unset'; | ||
} | ||
return { ...styles, | ||
return { | ||
...styles, | ||
...moreStyle | ||
}; | ||
}; | ||
exports.default = _default; |
@@ -7,21 +7,11 @@ "use strict"; | ||
exports.default = void 0; | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var _style = _interopRequireDefault(require("./style")); | ||
var _config = require("../../config"); | ||
var _ScreenClassResolver = _interopRequireDefault(require("../../context/ScreenClassResolver")); | ||
var _primitives = require("../../primitives"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (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; } | ||
const Container = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => { | ||
@@ -61,3 +51,2 @@ let { | ||
}); | ||
Container.propTypes = { | ||
@@ -68,3 +57,2 @@ /** | ||
children: _propTypes.default.node.isRequired, | ||
/** | ||
@@ -74,3 +62,2 @@ * True makes the container full-width, false fixed-width | ||
fluid: _propTypes.default.bool, | ||
/** | ||
@@ -81,3 +68,2 @@ * This is in combination with fluid enabled | ||
xs: _propTypes.default.bool, | ||
/** | ||
@@ -88,3 +74,2 @@ * This is in combination with fluid enabled | ||
sm: _propTypes.default.bool, | ||
/** | ||
@@ -95,3 +80,2 @@ * This is in combination with fluid enabled | ||
md: _propTypes.default.bool, | ||
/** | ||
@@ -102,3 +86,2 @@ * This is in combination with fluid enabled | ||
lg: _propTypes.default.bool, | ||
/** | ||
@@ -109,3 +92,2 @@ * This is in combination with fluid enabled | ||
xl: _propTypes.default.bool, | ||
/** | ||
@@ -116,3 +98,2 @@ * This is in combination with fluid enabled | ||
xxl: _propTypes.default.bool, | ||
/** | ||
@@ -123,3 +104,2 @@ * This is in combination with fluid enabled | ||
xxxl: _propTypes.default.bool, | ||
/** | ||
@@ -129,3 +109,2 @@ * Optional styling | ||
style: _propTypes.default.objectOf(_propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])), | ||
/** | ||
@@ -132,0 +111,0 @@ * Use your own component |
@@ -7,3 +7,2 @@ "use strict"; | ||
exports.default = void 0; | ||
var _default = _ref => { | ||
@@ -32,42 +31,34 @@ let { | ||
}; | ||
if (fluid && !xs && !sm && !md && !lg && !xl) { | ||
return { ...styles, | ||
return { | ||
...styles, | ||
...moreStyle | ||
}; | ||
} | ||
if (screenClass === 'xs' && containerWidths[0] && !xs) { | ||
styles.maxWidth = containerWidths[0]; | ||
} | ||
if (screenClass === 'sm' && containerWidths[0] && !sm) { | ||
styles.maxWidth = containerWidths[0]; | ||
} | ||
if (screenClass === 'md' && containerWidths[1] && !md) { | ||
styles.maxWidth = containerWidths[1]; | ||
} | ||
if (screenClass === 'lg' && containerWidths[2] && !lg) { | ||
styles.maxWidth = containerWidths[2]; | ||
} | ||
if (screenClass === 'xl' && containerWidths[3] && !xl) { | ||
styles.maxWidth = containerWidths[3]; | ||
} | ||
if (screenClass === 'xxl' && containerWidths[4] && !xxl) { | ||
styles.maxWidth = containerWidths[4]; | ||
} | ||
if (screenClass === 'xxxl' && containerWidths[5] && !xxxl) { | ||
styles.maxWidth = containerWidths[5]; | ||
} | ||
return { ...styles, | ||
return { | ||
...styles, | ||
...moreStyle | ||
}; | ||
}; | ||
exports.default = _default; |
@@ -7,19 +7,10 @@ "use strict"; | ||
exports.default = exports.GutterWidthContext = void 0; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var _config = require("../../config"); | ||
var _style = _interopRequireDefault(require("./style")); | ||
var _primitives = require("../../primitives"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
const GutterWidthContext = /*#__PURE__*/_react.default.createContext(false); | ||
exports.GutterWidthContext = GutterWidthContext; | ||
const Row = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => { | ||
@@ -59,3 +50,2 @@ let { | ||
}); | ||
Row.propTypes = { | ||
@@ -66,3 +56,2 @@ /** | ||
children: _propTypes.default.node.isRequired, | ||
/** | ||
@@ -72,3 +61,2 @@ * Vertical column alignment | ||
align: _propTypes.default.oneOf(['normal', 'start', 'center', 'end', 'stretch']), | ||
/** | ||
@@ -78,3 +66,2 @@ * Horizontal column alignment | ||
justify: _propTypes.default.oneOf(['start', 'center', 'end', 'between', 'around', 'initial', 'inherit']), | ||
/** | ||
@@ -84,3 +71,2 @@ * flex-direction style attribute | ||
direction: _propTypes.default.oneOf(['column', 'row', 'column-reverse', 'row-reverse']), | ||
/** | ||
@@ -90,3 +76,2 @@ * flex-wrap style attribute | ||
wrap: _propTypes.default.oneOf(['nowrap', 'wrap', 'reverse']), | ||
/** | ||
@@ -96,3 +81,2 @@ * No gutter for this row | ||
nogutter: _propTypes.default.bool, | ||
/** | ||
@@ -102,3 +86,2 @@ * Custom gutter width for this row | ||
gutterWidth: _propTypes.default.number, | ||
/** | ||
@@ -108,3 +91,2 @@ * Optional styling | ||
style: _propTypes.default.objectOf(_propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])), | ||
/** | ||
@@ -114,3 +96,2 @@ * Set to apply some debug styling | ||
debug: _propTypes.default.bool, | ||
/** | ||
@@ -117,0 +98,0 @@ * Use your own component |
@@ -7,3 +7,2 @@ "use strict"; | ||
exports.default = void 0; | ||
var _default = _ref => { | ||
@@ -22,4 +21,5 @@ let { | ||
if (align === 'start') alignItems = 'flex-start'; | ||
if (align === 'end') alignItems = 'flex-end'; // Horizontal alignment | ||
if (align === 'end') alignItems = 'flex-end'; | ||
// Horizontal alignment | ||
let justifyContent = justify; | ||
@@ -49,12 +49,10 @@ if (justify === 'start') justifyContent = 'flex-start'; | ||
}; | ||
if (debug) { | ||
styles.background = 'rgba(128,128,128,.05)'; | ||
} | ||
return { ...styles, | ||
return { | ||
...styles, | ||
...moreStyle | ||
}; | ||
}; | ||
exports.default = _default; |
@@ -66,25 +66,13 @@ "use strict"; | ||
}); | ||
var _Col = _interopRequireDefault(require("./grid/Col")); | ||
var _Container = _interopRequireDefault(require("./grid/Container")); | ||
var _Row = _interopRequireDefault(require("./grid/Row")); | ||
var _Hidden = _interopRequireDefault(require("./utilities/Hidden")); | ||
var _Visible = _interopRequireDefault(require("./utilities/Visible")); | ||
var _ScreenClassRender = _interopRequireDefault(require("./utilities/ScreenClassRender")); | ||
var _ScreenClassProvider = _interopRequireWildcard(require("./context/ScreenClassProvider")); | ||
var _config = require("./config"); | ||
var _utils = require("./utils"); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (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; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
@@ -7,11 +7,6 @@ "use strict"; | ||
exports.default = void 0; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _reactNative = require("react-native"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); } | ||
var _default = _ref => { | ||
@@ -29,3 +24,2 @@ let { | ||
}; | ||
exports.default = _default; |
@@ -24,9 +24,5 @@ "use strict"; | ||
}); | ||
var _Div = _interopRequireDefault(require("./Div")); | ||
var _Span = _interopRequireDefault(require("./Span")); | ||
var _Window = _interopRequireDefault(require("./Window")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
@@ -7,6 +7,4 @@ "use strict"; | ||
exports.default = void 0; | ||
var _reactNative = require("react-native"); | ||
var _default = _reactNative.View; | ||
exports.default = _default; |
@@ -7,6 +7,4 @@ "use strict"; | ||
exports.default = void 0; | ||
/* global window */ | ||
var _default = typeof window !== 'undefined' ? window : undefined; | ||
exports.default = _default; |
@@ -7,9 +7,6 @@ "use strict"; | ||
exports.default = void 0; | ||
var _reactNative = require("react-native"); | ||
const WindowRef = { | ||
current: null | ||
}; | ||
const { | ||
@@ -19,3 +16,2 @@ width, | ||
} = _reactNative.Dimensions.get('window'); | ||
WindowRef.current = { | ||
@@ -22,0 +18,0 @@ innerWidth: width, |
@@ -7,17 +7,9 @@ "use strict"; | ||
exports.default = void 0; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var style = _interopRequireWildcard(require("./style")); | ||
var _ScreenClassResolver = _interopRequireDefault(require("../../context/ScreenClassResolver")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (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; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
const Hidden = _ref => { | ||
@@ -45,3 +37,2 @@ let { | ||
}; | ||
Hidden.propTypes = { | ||
@@ -52,3 +43,2 @@ /** | ||
children: _propTypes.default.node.isRequired, | ||
/** | ||
@@ -58,3 +48,2 @@ * Hide on extra small devices | ||
xs: _propTypes.default.bool, | ||
/** | ||
@@ -64,3 +53,2 @@ * Hide on small devices | ||
sm: _propTypes.default.bool, | ||
/** | ||
@@ -70,3 +58,2 @@ * Hide on medium devices | ||
md: _propTypes.default.bool, | ||
/** | ||
@@ -76,3 +63,2 @@ * Hide on large devices | ||
lg: _propTypes.default.bool, | ||
/** | ||
@@ -82,3 +68,2 @@ * Hide on xlarge devices | ||
xl: _propTypes.default.bool, | ||
/** | ||
@@ -88,3 +73,2 @@ * Hide on xxlarge devices | ||
xxl: _propTypes.default.bool, | ||
/** | ||
@@ -91,0 +75,0 @@ * Hide on xxxlarge devices |
@@ -7,3 +7,2 @@ "use strict"; | ||
exports.hidden = exports.default = void 0; | ||
const hidden = _ref => { | ||
@@ -28,5 +27,4 @@ let { | ||
}; | ||
exports.hidden = hidden; | ||
var _default = hidden; | ||
exports.default = _default; |
@@ -7,11 +7,6 @@ "use strict"; | ||
exports.default = void 0; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var _ScreenClassResolver = _interopRequireDefault(require("../../context/ScreenClassResolver")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
const ScreenClassRender = _ref => { | ||
@@ -23,3 +18,2 @@ let { | ||
}; | ||
ScreenClassRender.propTypes = { | ||
@@ -26,0 +20,0 @@ /** |
@@ -7,17 +7,9 @@ "use strict"; | ||
exports.default = void 0; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var style = _interopRequireWildcard(require("./style")); | ||
var _ScreenClassResolver = _interopRequireDefault(require("../../context/ScreenClassResolver")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (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; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
const Visible = _ref => { | ||
@@ -45,3 +37,2 @@ let { | ||
}; | ||
Visible.propTypes = { | ||
@@ -52,3 +43,2 @@ /** | ||
children: _propTypes.default.node.isRequired, | ||
/** | ||
@@ -58,3 +48,2 @@ * Show on extra small devices | ||
xs: _propTypes.default.bool, | ||
/** | ||
@@ -64,3 +53,2 @@ * Show on small devices | ||
sm: _propTypes.default.bool, | ||
/** | ||
@@ -70,3 +58,2 @@ * Show on medium devices | ||
md: _propTypes.default.bool, | ||
/** | ||
@@ -76,3 +63,2 @@ * Show on large devices | ||
lg: _propTypes.default.bool, | ||
/** | ||
@@ -82,3 +68,2 @@ * Show on xlarge devices | ||
xl: _propTypes.default.bool, | ||
/** | ||
@@ -88,3 +73,2 @@ * Show on xxlarge devices | ||
xxl: _propTypes.default.bool, | ||
/** | ||
@@ -91,0 +75,0 @@ * Show on xxxlarge devices |
@@ -7,3 +7,2 @@ "use strict"; | ||
exports.visible = exports.default = void 0; | ||
const visible = _ref => { | ||
@@ -28,5 +27,4 @@ let { | ||
}; | ||
exports.visible = visible; | ||
var _default = visible; | ||
exports.default = _default; |
@@ -7,10 +7,7 @@ "use strict"; | ||
exports.useScreenClass = exports.screenClasses = void 0; | ||
var _react = require("react"); | ||
var _config = require("./config"); | ||
var _primitives = require("./primitives"); | ||
/* global window */ | ||
/* global window */ | ||
const getViewPort = source => { | ||
@@ -20,13 +17,9 @@ if (source && source.current && source.current.clientWidth) { | ||
} | ||
if (typeof _primitives.Window !== 'undefined' && _primitives.Window.innerWidth) { | ||
return _primitives.Window.innerWidth; | ||
} | ||
return null; | ||
}; | ||
const screenClasses = ['xs', 'sm', 'md', 'lg', 'xl', 'xxl', 'xxxl']; | ||
exports.screenClasses = screenClasses; | ||
const useScreenClass = (source, fallbackScreenClass) => { | ||
@@ -41,3 +34,2 @@ const getScreenClass = () => { | ||
const viewport = getViewPort(source); | ||
if (viewport) { | ||
@@ -54,19 +46,13 @@ newScreenClass = 'xs'; | ||
} | ||
const newScreenClassIndex = screenClasses.indexOf(newScreenClass); | ||
const maxScreenClassIndex = screenClasses.indexOf(maxScreenClass); | ||
if (maxScreenClassIndex >= 0 && newScreenClassIndex > maxScreenClassIndex) { | ||
newScreenClass = screenClasses[maxScreenClassIndex]; | ||
} | ||
return newScreenClass; | ||
}; | ||
const [screenClass, setScreenClass] = (0, _react.useState)(() => getScreenClass()); | ||
(0, _react.useEffect)(() => { | ||
const handleWindowResized = () => setScreenClass(getScreenClass()); | ||
_primitives.Window.addEventListener('resize', handleWindowResized, false); | ||
return () => { | ||
@@ -78,3 +64,2 @@ _primitives.Window.removeEventListener('resize', handleWindowResized, false); | ||
}; | ||
exports.useScreenClass = useScreenClass; |
{ | ||
"name": "react-grid-system", | ||
"version": "8.1.6", | ||
"version": "8.1.8", | ||
"description": "A powerful Bootstrap-like responsive grid system for React.", | ||
@@ -41,24 +41,24 @@ "main": "./build/index.js", | ||
"dependencies": { | ||
"prop-types": "^15.8.0" | ||
"prop-types": "15.8.1" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.18.10", | ||
"@babel/core": "^7.18.10", | ||
"@babel/eslint-parser": "^7.18.9", | ||
"@babel/preset-env": "^7.18.10", | ||
"@babel/preset-react": "^7.18.6", | ||
"babel-eslint": "^10.1.0", | ||
"babel-loader": "^8.2.5", | ||
"eslint": "^8.21.0", | ||
"eslint-config-airbnb": "^19.0.4", | ||
"eslint-plugin-import": "^2.26.0", | ||
"eslint-plugin-jsx-a11y": "^6.6.1", | ||
"eslint-plugin-react": "^7.30.1", | ||
"eslint-plugin-react-hooks": "^4.6.0", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"react-styleguidist": "^11.2.0", | ||
"rimraf": "^3.0.2", | ||
"webpack": "^5.74.0" | ||
"@babel/cli": "7.20.7", | ||
"@babel/core": "7.20.12", | ||
"@babel/eslint-parser": "7.19.1", | ||
"@babel/preset-env": "7.20.2", | ||
"@babel/preset-react": "7.18.6", | ||
"babel-eslint": "10.1.0", | ||
"babel-loader": "9.1.2", | ||
"eslint": "8.32.0", | ||
"eslint-config-airbnb": "19.0.4", | ||
"eslint-plugin-import": "2.27.5", | ||
"eslint-plugin-jsx-a11y": "6.7.1", | ||
"eslint-plugin-react": "7.32.1", | ||
"eslint-plugin-react-hooks": "4.6.0", | ||
"react": "18.2.0", | ||
"react-dom": "18.2.0", | ||
"react-styleguidist": "13.0.0", | ||
"rimraf": "4.1.1", | ||
"webpack": "5.75.0" | ||
} | ||
} |
2187
91795
Updatedprop-types@15.8.1