@instructure/ui-grid
Version:
A Grid component.
54 lines (53 loc) • 2.47 kB
JavaScript
/*
* The MIT License (MIT)
*
* Copyright (c) 2015 - present Instructure, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
import PropTypes from 'prop-types';
// TODO: get numcols from theme config
const COL_WIDTHS = PropTypes.oneOfType([PropTypes.number, PropTypes.oneOf(['auto'])]);
const propTypes = {
children: PropTypes.node,
colSpacing: PropTypes.oneOf(['none', 'small', 'medium', 'large']),
rowSpacing: PropTypes.oneOf(['none', 'small', 'medium', 'large']),
textAlign: PropTypes.oneOf(['start', 'end', 'center', 'inherit']),
hAlign: PropTypes.oneOf(['start', 'center', 'end', 'space-around', 'space-between']),
vAlign: PropTypes.oneOf(['top', 'middle', 'bottom', 'stretch']),
startAt: PropTypes.oneOf(['small', 'medium', 'large', 'x-large', null]),
visualDebug: PropTypes.bool,
width: PropTypes.oneOfType([COL_WIDTHS, PropTypes.shape({
small: COL_WIDTHS,
medium: COL_WIDTHS,
large: COL_WIDTHS,
xLarge: COL_WIDTHS
})]),
offset: PropTypes.oneOfType([COL_WIDTHS, PropTypes.shape({
small: COL_WIDTHS,
medium: COL_WIDTHS,
large: COL_WIDTHS,
xLarge: COL_WIDTHS
})]),
isLastRow: PropTypes.bool,
isLastCol: PropTypes.bool,
elementRef: PropTypes.func
};
const allowedProps = ['children', 'colSpacing', 'rowSpacing', 'textAlign', 'hAlign', 'vAlign', 'startAt', 'visualDebug', 'width', 'offset', 'isLastRow', 'isLastCol', 'elementRef'];
export { propTypes, allowedProps };