terra-props-table
Advanced tools
Comparing version 2.32.0 to 2.33.0
@@ -7,2 +7,10 @@ Changelog | ||
2.31.0 - (June 11, 2019) | ||
------------------ | ||
### Removed | ||
* Removed node_modules from .npmignore | ||
### Changed | ||
* Made required updates to consume terra-toolkit v5 and terra-dev-site v5 | ||
2.30.0 - (May 1, 2019) | ||
@@ -9,0 +17,0 @@ ------------------ |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,34 +6,26 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.default = void 0; | ||
var _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; }; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _react = require('react'); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var _react2 = _interopRequireDefault(_react); | ||
var _reactDocgen = require("react-docgen"); | ||
var _propTypes = require('prop-types'); | ||
var _terraMarkdown = _interopRequireDefault(require("terra-markdown")); | ||
var _propTypes2 = _interopRequireDefault(_propTypes); | ||
var _bind = _interopRequireDefault(require("classnames/bind")); | ||
var _reactDocgen = require('react-docgen'); | ||
var _PropsTableModule = _interopRequireDefault(require("./PropsTable.module.scss")); | ||
var _terraMarkdown = require('terra-markdown'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var _terraMarkdown2 = _interopRequireDefault(_terraMarkdown); | ||
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); } | ||
var _bind = require('classnames/bind'); | ||
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; } | ||
var _bind2 = _interopRequireDefault(_bind); | ||
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 _PropsTableModule = require('./PropsTable.module.scss'); | ||
var cx = _bind.default.bind(_PropsTableModule.default); | ||
var _PropsTableModule2 = _interopRequireDefault(_PropsTableModule); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } /* eslint-disable import/no-extraneous-dependencies */ | ||
var cx = _bind2.default.bind(_PropsTableModule2.default); | ||
var propTypes = { | ||
@@ -43,13 +35,14 @@ /** | ||
*/ | ||
componentName: _propTypes2.default.string, | ||
componentName: _propTypes.default.string, | ||
/** | ||
* Markdown source file | ||
*/ | ||
src: _propTypes2.default.string.isRequired, | ||
src: _propTypes.default.string.isRequired, | ||
/** | ||
* Type of react-docgen resolver to use for prop-types resolution. Supported values are `default` or `findAllComponentDefinitions` | ||
*/ | ||
propsResolution: _propTypes2.default.oneOf(['default', 'findAllComponentDefinitions']) | ||
propsResolution: _propTypes.default.oneOf(['default', 'findAllComponentDefinitions']) | ||
}; | ||
var defaultProps = { | ||
@@ -70,61 +63,28 @@ propsResolution: 'default' | ||
if (type.value.name === 'shape') { | ||
typeName = _react2.default.createElement( | ||
'span', | ||
null, | ||
' ', | ||
'array of objects structured like:', | ||
_react2.default.createElement( | ||
'pre', | ||
{ className: cx('props-table-pre') }, | ||
' ', | ||
formatShape(type.value.value), | ||
' ' | ||
) | ||
); | ||
typeName = _react.default.createElement("span", null, ' ', "array of objects structured like:", _react.default.createElement("pre", { | ||
className: cx('props-table-pre') | ||
}, ' ', formatShape(type.value.value), ' ')); | ||
} else { | ||
typeName = 'array of ' + type.value.name + 's'; | ||
typeName = "array of ".concat(type.value.name, "s"); | ||
} | ||
} else if (typeName === 'union') { | ||
var options = type.value.map(function (option) { | ||
var name = option.name === 'shape' ? _react2.default.createElement( | ||
'span', | ||
{ key: option.value }, | ||
' ', | ||
'an object structured like:', | ||
_react2.default.createElement( | ||
'pre', | ||
{ className: cx('props-table-pre') }, | ||
' ', | ||
formatShape(option.value), | ||
' ' | ||
) | ||
) : _react2.default.createElement( | ||
'span', | ||
{ key: option.name }, | ||
' ', | ||
option.name | ||
); | ||
var name = option.name === 'shape' ? _react.default.createElement("span", { | ||
key: option.value | ||
}, ' ', "an object structured like:", _react.default.createElement("pre", { | ||
className: cx('props-table-pre') | ||
}, ' ', formatShape(option.value), ' ')) : _react.default.createElement("span", { | ||
key: option.name | ||
}, ' ', option.name); | ||
return name; | ||
}); | ||
typeName = options.reduce(function (curr, next) { | ||
return [curr, _react2.default.createElement( | ||
'span', | ||
{ key: curr.value + '-' + next.value }, | ||
' or ' | ||
), next]; | ||
return [curr, _react.default.createElement("span", { | ||
key: "".concat(curr.value, "-").concat(next.value) | ||
}, " or "), next]; | ||
}); | ||
} else if (typeName === 'shape') { | ||
typeName = _react2.default.createElement( | ||
'span', | ||
null, | ||
' ', | ||
'an object structured like:', | ||
_react2.default.createElement( | ||
'pre', | ||
{ className: cx('props-table-pre') }, | ||
' ', | ||
formatShape(type.value), | ||
' ' | ||
) | ||
); | ||
typeName = _react.default.createElement("span", null, ' ', "an object structured like:", _react.default.createElement("pre", { | ||
className: cx('props-table-pre') | ||
}, ' ', formatShape(type.value), ' ')); | ||
} | ||
@@ -134,6 +94,7 @@ | ||
} | ||
/** | ||
* Renders a table view for the props metadata of a react component generated by react-docgen | ||
*/ | ||
var PropsTable = function PropsTable(_ref) { | ||
@@ -143,3 +104,3 @@ var componentName = _ref.componentName, | ||
src = _ref.src, | ||
customProps = _objectWithoutProperties(_ref, ['componentName', 'propsResolution', 'src']); | ||
customProps = _objectWithoutProperties(_ref, ["componentName", "propsResolution", "src"]); | ||
@@ -151,4 +112,3 @@ /** | ||
*/ | ||
var componentMetaData = void 0; | ||
var componentMetaData; | ||
/** | ||
@@ -158,11 +118,11 @@ * Alias for props object from componentMetaData | ||
*/ | ||
var componentProps = void 0; | ||
// Resolve using react-docgen's default resolver | ||
var componentProps; // Resolve using react-docgen's default resolver | ||
if (propsResolution === 'default') { | ||
componentMetaData = (0, _reactDocgen.parse)(src); | ||
componentProps = componentMetaData.props; | ||
} | ||
} // Resolve using react-docgen's findAllComponentDefinitions resolver | ||
// Resolve using react-docgen's findAllComponentDefinitions resolver | ||
if (propsResolution === 'findAllComponentDefinitions') { | ||
@@ -175,107 +135,61 @@ componentMetaData = (0, _reactDocgen.parse)(src, _reactDocgen.resolver.findAllComponentDefinitions); | ||
var tableClassNames = cx(['props-table', customProps.className]); | ||
return _react.default.createElement("div", { | ||
dir: "ltr", | ||
className: cx('props-table-markdown') | ||
}, _react.default.createElement("h2", null, componentName, ' ', "Props"), _react.default.createElement("table", _extends({}, customProps, { | ||
className: tableClassNames | ||
}), _react.default.createElement("thead", null, _react.default.createElement("tr", null, _react.default.createElement("th", { | ||
className: cx('prop-table-name') | ||
}, "Prop Name"), _react.default.createElement("th", { | ||
className: cx('prop-table-type') | ||
}, "Type"), _react.default.createElement("th", { | ||
className: cx('prop-table-required') | ||
}, "Is Required"), _react.default.createElement("th", { | ||
className: cx('prop-table-default') | ||
}, "Default Value"), _react.default.createElement("th", { | ||
className: cx('prop-table-description') | ||
}, "Description"))), _react.default.createElement("tbody", null, Object.keys(componentProps).map(function (key) { | ||
var prop = componentProps[key]; | ||
return _react2.default.createElement( | ||
'div', | ||
{ dir: 'ltr', className: cx('props-table-markdown') }, | ||
_react2.default.createElement( | ||
'h2', | ||
null, | ||
componentName, | ||
' ', | ||
'Props' | ||
), | ||
_react2.default.createElement( | ||
'table', | ||
_extends({}, customProps, { className: tableClassNames }), | ||
_react2.default.createElement( | ||
'thead', | ||
null, | ||
_react2.default.createElement( | ||
'tr', | ||
null, | ||
_react2.default.createElement( | ||
'th', | ||
{ className: cx('prop-table-name') }, | ||
'Prop Name' | ||
), | ||
_react2.default.createElement( | ||
'th', | ||
{ className: cx('prop-table-type') }, | ||
'Type' | ||
), | ||
_react2.default.createElement( | ||
'th', | ||
{ className: cx('prop-table-required') }, | ||
'Is Required' | ||
), | ||
_react2.default.createElement( | ||
'th', | ||
{ className: cx('prop-table-default') }, | ||
'Default Value' | ||
), | ||
_react2.default.createElement( | ||
'th', | ||
{ className: cx('prop-table-description') }, | ||
'Description' | ||
) | ||
) | ||
), | ||
_react2.default.createElement( | ||
'tbody', | ||
null, | ||
Object.keys(componentProps).map(function (key) { | ||
var prop = componentProps[key]; | ||
if (prop.description && prop.description.match(/@private/)) { | ||
return null; | ||
} | ||
if (prop.description && prop.description.match(/@private/)) { | ||
return null; | ||
} | ||
var type = determineType(prop.type); | ||
var type = determineType(prop.type); | ||
/** | ||
* Check if the react-docgen parser returned a custom proptype. | ||
* If so, parse the raw value to see if the custom proptype has been marked as required. | ||
*/ | ||
/** | ||
* Check if the react-docgen parser returned a custom proptype. | ||
* If so, parse the raw value to see if the custom proptype has been marked as required. | ||
*/ | ||
var customRequired = prop.type.name === 'custom' && prop.type.raw.includes('isRequired'); | ||
return _react2.default.createElement( | ||
'tr', | ||
{ className: tableRowClass, key: key, style: { fontSize: '90%' } }, | ||
_react2.default.createElement( | ||
'td', | ||
{ style: { fontWeight: 'bold' } }, | ||
key | ||
), | ||
_react2.default.createElement( | ||
'td', | ||
null, | ||
prop.type ? type : '' | ||
), | ||
customRequired || prop.required ? _react2.default.createElement( | ||
'td', | ||
{ style: { color: '#d53700' } }, | ||
'required' | ||
) : _react2.default.createElement( | ||
'td', | ||
{ style: { color: '#444' } }, | ||
'optional' | ||
), | ||
prop.defaultValue ? _react2.default.createElement( | ||
'td', | ||
{ style: { fontWeight: 'bold' } }, | ||
prop.defaultValue.value | ||
) : _react2.default.createElement( | ||
'td', | ||
{ style: { color: '#444' } }, | ||
'none' | ||
), | ||
_react2.default.createElement( | ||
'td', | ||
null, | ||
_react2.default.createElement(_terraMarkdown2.default, { src: prop.description }) | ||
) | ||
); | ||
}) | ||
) | ||
) | ||
); | ||
var customRequired = prop.type.name === 'custom' && prop.type.raw.includes('isRequired'); | ||
return _react.default.createElement("tr", { | ||
className: tableRowClass, | ||
key: key, | ||
style: { | ||
fontSize: '90%' | ||
} | ||
}, _react.default.createElement("td", { | ||
style: { | ||
fontWeight: 'bold' | ||
} | ||
}, key), _react.default.createElement("td", null, prop.type ? type : ''), customRequired || prop.required ? _react.default.createElement("td", { | ||
style: { | ||
color: '#d53700' | ||
} | ||
}, "required") : _react.default.createElement("td", { | ||
style: { | ||
color: '#444' | ||
} | ||
}, "optional"), prop.defaultValue ? _react.default.createElement("td", { | ||
style: { | ||
fontWeight: 'bold' | ||
} | ||
}, prop.defaultValue.value) : _react.default.createElement("td", { | ||
style: { | ||
color: '#444' | ||
} | ||
}, "none"), _react.default.createElement("td", null, _react.default.createElement(_terraMarkdown.default, { | ||
src: prop.description | ||
}))); | ||
})))); | ||
}; | ||
@@ -285,3 +199,3 @@ | ||
PropsTable.defaultProps = defaultProps; | ||
exports.default = PropsTable; | ||
var _default = PropsTable; | ||
exports.default = _default; |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,14 +6,12 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.default = void 0; | ||
var _react = require('react'); | ||
var _react = _interopRequireDefault(require("react")); | ||
var _react2 = _interopRequireDefault(_react); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var _propTypes = require('prop-types'); | ||
var _propTypes2 = _interopRequireDefault(_propTypes); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
// These props are used to test react-doc-gen, but they only need to be mocked | ||
/* eslint-disable react/no-unused-prop-types */ | ||
@@ -25,7 +23,9 @@ var propTypes = { | ||
*/ | ||
string: _propTypes2.default.string.isRequired, | ||
string: _propTypes.default.string.isRequired, | ||
/** | ||
* An example of type number markup. | ||
*/ | ||
number: _propTypes2.default.number, | ||
number: _propTypes.default.number, | ||
/** | ||
@@ -35,11 +35,14 @@ * An example of type boolean markup. | ||
*/ | ||
bool: _propTypes2.default.bool, | ||
bool: _propTypes.default.bool, | ||
/** | ||
* An example of type element markup. | ||
*/ | ||
element: _propTypes2.default.element, | ||
element: _propTypes.default.element, | ||
/** | ||
* An example of type node markup. | ||
*/ | ||
node: _propTypes2.default.node, | ||
node: _propTypes.default.node, | ||
/** | ||
@@ -49,25 +52,29 @@ * An example of type array markup. | ||
// eslint-disable-next-line react/forbid-prop-types | ||
array: _propTypes2.default.array, | ||
array: _propTypes.default.array, | ||
/** | ||
* A default example of type arrayOf markup. | ||
*/ | ||
arrayOfDefault: _propTypes2.default.arrayOf(_propTypes2.default.element), | ||
arrayOfDefault: _propTypes.default.arrayOf(_propTypes.default.element), | ||
/** | ||
* An example of type arrayOf(shapes) markup. | ||
*/ | ||
arrayOfShapes: _propTypes2.default.arrayOf(_propTypes2.default.shape({ | ||
stringProp: _propTypes2.default.string | ||
arrayOfShapes: _propTypes.default.arrayOf(_propTypes.default.shape({ | ||
stringProp: _propTypes.default.string | ||
})), | ||
/** | ||
* An example of type oneOfType markup with the option of a string, number or shape type. | ||
*/ | ||
oneOfType: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number, _propTypes2.default.shape({ | ||
stringProp: _propTypes2.default.string | ||
oneOfType: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number, _propTypes.default.shape({ | ||
stringProp: _propTypes.default.string | ||
})]), | ||
/** | ||
* An example of type shape markup. | ||
*/ | ||
shape: _propTypes2.default.shape({ | ||
stringProp: _propTypes2.default.string, | ||
numberProp: _propTypes2.default.number | ||
shape: _propTypes.default.shape({ | ||
stringProp: _propTypes.default.string, | ||
numberProp: _propTypes.default.number | ||
}) | ||
@@ -78,7 +85,9 @@ }; | ||
var MockComponent = function MockComponent(props) { | ||
return _react2.default.createElement('span', JSON.stringify({ props: props })); | ||
return _react.default.createElement('span', JSON.stringify({ | ||
props: props | ||
})); | ||
}; | ||
MockComponent.propTypes = propTypes; | ||
exports.default = MockComponent; | ||
var _default = MockComponent; | ||
exports.default = _default; |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,14 +6,12 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.default = void 0; | ||
var _react = require('react'); | ||
var _react = _interopRequireDefault(require("react")); | ||
var _react2 = _interopRequireDefault(_react); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var _propTypes = require('prop-types'); | ||
var _propTypes2 = _interopRequireDefault(_propTypes); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
// These props are used to test react-doc-gen, but they only need to be mocked | ||
/* eslint-disable react/no-unused-prop-types */ | ||
@@ -25,3 +23,4 @@ var propTypes = { | ||
*/ | ||
string: _propTypes2.default.string.isRequired, | ||
string: _propTypes.default.string.isRequired, | ||
/** | ||
@@ -31,7 +30,8 @@ * @private | ||
*/ | ||
privateProp: _propTypes2.default.string, | ||
privateProp: _propTypes.default.string, | ||
/** | ||
* @private Testing inline private declaration | ||
*/ | ||
anotherPrivateProp: _propTypes2.default.string | ||
anotherPrivateProp: _propTypes.default.string | ||
}; | ||
@@ -41,7 +41,9 @@ /* eslint-enable react/no-unused-prop-types */ | ||
var MockComponent = function MockComponent(props) { | ||
return _react2.default.createElement('span', JSON.stringify({ props: props })); | ||
return _react.default.createElement('span', JSON.stringify({ | ||
props: props | ||
})); | ||
}; | ||
MockComponent.propTypes = propTypes; | ||
exports.default = MockComponent; | ||
var _default = MockComponent; | ||
exports.default = _default; |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,26 +6,21 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.default = void 0; | ||
var _react = require('react'); | ||
var _react = _interopRequireDefault(require("react")); | ||
var _react2 = _interopRequireDefault(_react); | ||
var _PropsTable = _interopRequireDefault(require("../../../PropsTable")); | ||
var _PropsTable = require('../../../PropsTable'); | ||
var _MockPrivatePropsComponent = _interopRequireDefault(require("!raw-loader!../../../../src/terra-dev-site/test/props-table-test/MockPrivatePropsComponent")); | ||
var _PropsTable2 = _interopRequireDefault(_PropsTable); | ||
var _MockPrivatePropsComponent = require('!raw-loader!../../../../src/terra-dev-site/test/props-table-test/MockPrivatePropsComponent'); | ||
var _MockPrivatePropsComponent2 = _interopRequireDefault(_MockPrivatePropsComponent); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
// eslint-disable-next-line import/no-webpack-loader-syntax, import/first, import/no-unresolved, import/extensions | ||
var MockPrivatePropsTable = function MockPrivatePropsTable() { | ||
return _react2.default.createElement( | ||
'div', | ||
null, | ||
_react2.default.createElement(_PropsTable2.default, { id: 'PrivatePropsTable', src: _MockPrivatePropsComponent2.default }) | ||
); | ||
return _react.default.createElement("div", null, _react.default.createElement(_PropsTable.default, { | ||
id: "PrivatePropsTable", | ||
src: _MockPrivatePropsComponent.default | ||
})); | ||
}; | ||
// eslint-disable-next-line import/no-webpack-loader-syntax, import/first, import/no-unresolved, import/extensions | ||
exports.default = MockPrivatePropsTable; | ||
var _default = MockPrivatePropsTable; | ||
exports.default = _default; |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,31 +6,23 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.default = void 0; | ||
var _react = require('react'); | ||
var _react = _interopRequireDefault(require("react")); | ||
var _react2 = _interopRequireDefault(_react); | ||
var _PropsTable = _interopRequireDefault(require("../../../PropsTable")); | ||
var _PropsTable = require('../../../PropsTable'); | ||
var _MockComponent = _interopRequireDefault(require("!raw-loader!../../../../src/terra-dev-site/test/props-table-test/MockComponent")); | ||
var _PropsTable2 = _interopRequireDefault(_PropsTable); | ||
var _MockComponent = require('!raw-loader!../../../../src/terra-dev-site/test/props-table-test/MockComponent'); | ||
var _MockComponent2 = _interopRequireDefault(_MockComponent); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
// eslint-disable-next-line import/no-webpack-loader-syntax, import/first, import/no-unresolved, import/extensions | ||
var MockPropsTable = function MockPropsTable() { | ||
return _react2.default.createElement( | ||
'div', | ||
null, | ||
_react2.default.createElement(_PropsTable2.default, { id: 'PropsTable', src: _MockComponent2.default }), | ||
_react2.default.createElement( | ||
'p', | ||
{ 'data-terra-bottom-scroll-marker': true }, | ||
'Marker for scrolling during tests' | ||
) | ||
); | ||
return _react.default.createElement("div", null, _react.default.createElement(_PropsTable.default, { | ||
id: "PropsTable", | ||
src: _MockComponent.default | ||
}), _react.default.createElement("p", { | ||
"data-terra-bottom-scroll-marker": true | ||
}, "Marker for scrolling during tests")); | ||
}; | ||
// eslint-disable-next-line import/no-webpack-loader-syntax, import/first, import/no-unresolved, import/extensions | ||
exports.default = MockPropsTable; | ||
var _default = MockPropsTable; | ||
exports.default = _default; |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,31 +6,24 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.default = void 0; | ||
var _react = require('react'); | ||
var _react = _interopRequireDefault(require("react")); | ||
var _react2 = _interopRequireDefault(_react); | ||
var _PropsTable = _interopRequireDefault(require("../../../PropsTable")); | ||
var _PropsTable = require('../../../PropsTable'); | ||
var _MockComponent = _interopRequireDefault(require("!raw-loader!../../../../src/terra-dev-site/test/props-table-test/MockComponent")); | ||
var _PropsTable2 = _interopRequireDefault(_PropsTable); | ||
var _MockComponent = require('!raw-loader!../../../../src/terra-dev-site/test/props-table-test/MockComponent'); | ||
var _MockComponent2 = _interopRequireDefault(_MockComponent); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
// eslint-disable-next-line import/no-webpack-loader-syntax, import/first, import/no-unresolved, import/extensions | ||
var MockPropsTableWithTitle = function MockPropsTableWithTitle() { | ||
return _react2.default.createElement( | ||
'div', | ||
null, | ||
_react2.default.createElement(_PropsTable2.default, { id: 'PropsTable', src: _MockComponent2.default, componentName: 'Mock Component' }), | ||
_react2.default.createElement( | ||
'p', | ||
{ 'data-terra-bottom-scroll-marker': true }, | ||
'Marker for scrolling during tests' | ||
) | ||
); | ||
return _react.default.createElement("div", null, _react.default.createElement(_PropsTable.default, { | ||
id: "PropsTable", | ||
src: _MockComponent.default, | ||
componentName: "Mock Component" | ||
}), _react.default.createElement("p", { | ||
"data-terra-bottom-scroll-marker": true | ||
}, "Marker for scrolling during tests")); | ||
}; | ||
// eslint-disable-next-line import/no-webpack-loader-syntax, import/first, import/no-unresolved, import/extensions | ||
exports.default = MockPropsTableWithTitle; | ||
var _default = MockPropsTableWithTitle; | ||
exports.default = _default; |
{ | ||
"name": "terra-props-table", | ||
"main": "lib/PropsTable.js", | ||
"version": "2.32.0", | ||
"version": "2.33.0", | ||
"description": "React component to render a table view for the props metadata of another react component.", | ||
@@ -36,11 +36,10 @@ "repository": { | ||
"react-docgen": "^2.15.0", | ||
"terra-markdown": "^2.26.0" | ||
"terra-markdown": "^2.27.0" | ||
}, | ||
"scripts": { | ||
"compile": "npm run compile:clean && npm run compile:build", | ||
"compile:clean": "rm -rf lib", | ||
"compile:build": "babel src --out-dir lib --copy-files", | ||
"compile": "babel --root-mode upward src --out-dir lib --copy-files", | ||
"lint": "npm run lint:js && npm run lint:scss", | ||
"lint:js": "eslint --ext .js,.jsx . --ignore-path ../../.eslintignore", | ||
"lint:scss": "stylelint src/**/*.scss", | ||
"precompile": "rm -rf lib", | ||
"test": "npm run test:jest && npm run test:wdio", | ||
@@ -47,0 +46,0 @@ "test:jest": "jest --config ../../jestconfig.js", |
@@ -5,3 +5,3 @@ # Terra Props Table | ||
[![NPM version](https://badgen.net/npm/v/terra-props-table)](https://www.npmjs.org/package/terra-props-table) | ||
[![Build Status](https://badgen.net/travis/cerner/terra-core)](https://travis-ci.org/cerner/terra-core) | ||
[![Build Status](https://badgen.net/travis/cerner/terra-core)](https://travis-ci.com/cerner/terra-core) | ||
@@ -8,0 +8,0 @@ React component to render a table view for the props metadata of another react component. |
@@ -10,9 +10,9 @@ const viewports = Terra.viewports('medium', 'large'); | ||
Terra.should.matchScreenshot('should display a string prop', { selector: '#PropsTable > tbody > tr:nth-child(1)' }); | ||
Terra.it.matchesScreenshot('should display a string prop', { selector: '#PropsTable > tbody > tr:nth-child(1)' }); | ||
Terra.should.matchScreenshot('should display a number prop', { selector: '#PropsTable > tbody > tr:nth-child(2)' }); | ||
Terra.it.matchesScreenshot('should display a number prop', { selector: '#PropsTable > tbody > tr:nth-child(2)' }); | ||
Terra.should.matchScreenshot('should display a boolean prop', { selector: '#PropsTable > tbody > tr:nth-child(3)' }); | ||
Terra.it.matchesScreenshot('should display a boolean prop', { selector: '#PropsTable > tbody > tr:nth-child(3)' }); | ||
Terra.should.matchScreenshot('should display an element prop', { selector: '#PropsTable > tbody > tr:nth-child(4)' }); | ||
Terra.it.matchesScreenshot('should display an element prop', { selector: '#PropsTable > tbody > tr:nth-child(4)' }); | ||
@@ -24,7 +24,7 @@ // Need to manually scroll down so screenshots of the remaining rows can be taken | ||
Terra.should.matchScreenshot('should display a node prop', { selector: '#PropsTable > tbody > tr:nth-child(5)' }); | ||
Terra.it.matchesScreenshot('should display a node prop', { selector: '#PropsTable > tbody > tr:nth-child(5)' }); | ||
Terra.should.matchScreenshot('should display an array prop', { selector: '#PropsTable > tbody > tr:nth-child(6)' }); | ||
Terra.it.matchesScreenshot('should display an array prop', { selector: '#PropsTable > tbody > tr:nth-child(6)' }); | ||
Terra.should.matchScreenshot('should display a default arrayOf prop', { selector: '#PropsTable > tbody > tr:nth-child(7)' }); | ||
Terra.it.matchesScreenshot('should display a default arrayOf prop', { selector: '#PropsTable > tbody > tr:nth-child(7)' }); | ||
@@ -35,9 +35,9 @@ it('needs to scroll down even more', () => { | ||
Terra.should.matchScreenshot('should display an arrayOf(shapes) prop', { selector: '#PropsTable > tbody > tr:nth-child(8)' }); | ||
Terra.it.matchesScreenshot('should display an arrayOf(shapes) prop', { selector: '#PropsTable > tbody > tr:nth-child(8)' }); | ||
Terra.should.matchScreenshot('should display a oneOfType prop', { selector: '#PropsTable > tbody > tr:nth-child(9)' }); | ||
Terra.it.matchesScreenshot('should display a oneOfType prop', { selector: '#PropsTable > tbody > tr:nth-child(9)' }); | ||
Terra.should.matchScreenshot('should display a shape prop', { selector: '#PropsTable > tbody > tr:nth-child(10)' }); | ||
Terra.it.matchesScreenshot('should display a shape prop', { selector: '#PropsTable > tbody > tr:nth-child(10)' }); | ||
Terra.should.beAccessible({ viewports }); | ||
Terra.it.isAccessible({ viewports }); | ||
}); | ||
@@ -51,3 +51,3 @@ | ||
Terra.should.matchScreenshot('should not render private prop information', { selector: '#PrivatePropsTable' }); | ||
Terra.it.matchesScreenshot('should not render private prop information', { selector: '#PrivatePropsTable' }); | ||
}); | ||
@@ -61,6 +61,6 @@ | ||
Terra.should.matchScreenshot('should display the title', { selector: '[class*="props-table-markdown"] > h2' }); | ||
Terra.it.matchesScreenshot('should display the title', { selector: '[class*="props-table-markdown"] > h2' }); | ||
Terra.should.beAccessible({ viewports }); | ||
Terra.it.isAccessible({ viewports }); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
85625
971
Updatedterra-markdown@^2.27.0