Socket
Socket
Sign inDemoInstall

terra-props-table

Package Overview
Dependencies
Maintainers
9
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

terra-props-table - npm Package Compare versions

Comparing version 2.30.0 to 2.31.0

11

CHANGELOG.md

@@ -7,2 +7,13 @@ Changelog

2.29.0 - (April 16, 2019)
------------------
### Changed
* Minor dependency version bump
### Removed
* github-markdown-css dependency
### Fixed
* Props with custom prop types (like intlShape) now show as required if marked as such
2.28.0 - (March 26, 2019)

@@ -9,0 +20,0 @@ ------------------

12

lib/PropsTable.js

@@ -143,3 +143,3 @@ 'use strict';

* Runs component source code through react-docgen. Passing second argument to parse
* function to account for mutiple export.
* function to account for multiple export.
* @type {Object}

@@ -172,3 +172,3 @@ */

'div',
{ dir: 'ltr', className: 'markdown-body' },
{ dir: 'ltr', className: cx('props-table-markdown') },
_react2.default.createElement(

@@ -228,2 +228,8 @@ 'h2',

/**
* 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(

@@ -242,3 +248,3 @@ 'tr',

),
prop.required ? _react2.default.createElement(
customRequired || prop.required ? _react2.default.createElement(
'td',

@@ -245,0 +251,0 @@ { style: { color: '#d53700' } },

{
"name": "terra-props-table",
"main": "lib/PropsTable.js",
"version": "2.30.0",
"version": "2.31.0",
"description": "React component to render a table view for the props metadata of another react component.",

@@ -36,3 +36,3 @@ "repository": {

"react-docgen": "^2.15.0",
"terra-markdown": "^2.24.0"
"terra-markdown": "^2.25.0"
},

@@ -39,0 +39,0 @@ "scripts": {

@@ -101,3 +101,3 @@ /* eslint-disable import/no-extraneous-dependencies */

* Runs component source code through react-docgen. Passing second argument to parse
* function to account for mutiple export.
* function to account for multiple export.
* @type {Object}

@@ -132,3 +132,3 @@ */

return (
<div dir="ltr" className="markdown-body">
<div dir="ltr" className={cx('props-table-markdown')}>
<h2>

@@ -158,2 +158,8 @@ {componentName}

/**
* 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.
*/
const customRequired = (prop.type.name === 'custom' && prop.type.raw.includes('isRequired'));
return (

@@ -163,3 +169,3 @@ <tr className={tableRowClass} key={key} style={{ fontSize: '90%' }}>

<td>{(prop.type ? type : '')}</td>
{(prop.required
{(customRequired || prop.required
? <td style={{ color: '#d53700' }}>required</td>

@@ -166,0 +172,0 @@ : <td style={{ color: '#444' }}>optional</td>)}

@@ -57,3 +57,3 @@ const viewports = Terra.viewports('medium', 'large');

Terra.should.matchScreenshot('should display the title', { selector: '[class*="markdown-body"] > h2' });
Terra.should.matchScreenshot('should display the title', { selector: '[class*="props-table-markdown"] > h2' });

@@ -60,0 +60,0 @@ Terra.should.beAccessible({ viewports });

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc