Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@ndustrial/nd-react-common
Advanced tools
An NPM package of common react components to be utilized within nSight 2.0
To install this in your project, run npm login
then npm install @ndustrial/nd-react-common react react-dom react-router-dom underscore
.
NOTE: react
, react-dom
, react-router-dom
, and underscore
are peer dependencies -- you may already have these installed.
After it is installed, it can be utilized in your react project as follows:
import { Header } from '@ndustrial/nd-react-common'
import { Dropdown } from '@ndustrial/nd-react-common'
<Dropdown data={json object} filterable={false} label="Select Option"/>
JSON object to populate the dropdown list
Should the user be able to type and filter the list.
import { UserDropdown } from '@ndustrial/nd-react-common'
<UserDropdown user={json object}/>
JSON object to populate the user name and image
{
"user":
{
"id": 1,
"userName": "Bret Kruse",
"profileImage": "https://readjack.files.wordpress.com/2010/11/e-train1.jpg"
}
}
Leverages react-day-picker. Additional props available can be found in their documentation.
import { DatePickerInput } from '@ndustrial/nd-react-common';
<DatePickerInput
containerClassName="input__container"
format={'D MMMM YYYY'}
inputProps={{
autocomplete: 'off',
className: "input__input"
}}
onDayChange={(date) => onChange(date ? date.toISOString() : null)}
value={props.value ? moment(props.value).format('D MMMM YYYY') : ''}
/>
Class name applied to the outer containing div
.
An object containing props that are applied to the Input field.
Class name applied to the input field that triggers the opening of the calendar overlay.
Any other props that can be applied to an input
element can also be passed as part of the inputProps object.
Function called when selecting a date. Used to update the state of a parent component or a Redux store.
Class name applied to the calendar overlay div
.
Class name applied to the calendar overlay wrapper div
.
Any other props listed in the react-day-picker DayPickerInput documentation can also be passed.
import { List } from '@ndustrial/nd-react-common'
<List filterable={true} data={json object} name="organizations" callback={(value) => { this.callback(value); }}/>
JSON object to populate the list
Should the user be able to type and filter the list.
Used to provide a placeholder and filtering labels i.e. "Filter organizations" or "No organizations found"
Triggered when an item and selected. Returns selected object from json object
import { Table } from '@ndustrial/nd-react-common'
<Table
className="table_className"
data={[json object]}
filterable
headers={["strings"]}
isLoading
label="Table Data"
/>
Table can also be extended if you need custom rendering:
import { Table } from '@ndustrial/nd-react-common';
import PropTypes from 'prop-types';
import React from 'react';
class ExampleTable extends Table {
static propTypes = {
...Table.propTypes,
renderItem: PropTypes.func.isRequired
};
generateRows() {
if (!(this.state.data && this.state.data.length)) {
return (
<tr key="no_data">
<td colSpan={this.state.headers.length}>
No {this.props.label || 'Data'} Available
</td>
</tr>
);
}
return this.state.data.map((item) =>
this.props.renderItem({ item, handleDragEnd: this.props.handleDragEnd })
);
}
render() {
return (
<div className={`nd-table ${this.props.className}`}>
{this.renderSearchBox()}
{this.renderResults()}
<div className="nd-table__container">
<table className="dnd__source-table">
<thead>
<tr>{this.generateHeaders()}</tr>
</thead>
<tbody>
{this.renderLoader()}
{!this.props.isLoading && this.generateRows()}
</tbody>
</table>
</div>
</div>
);
}
}
export default ExampleTable;
String to be appended to the table className
Default:''
Array of JSON objects to populate the table JSON object to populate the table
Boolean that allows the table to be filterable
Default: false
Array of strings to set the headers in the table
Boolean to determine if data is being fetched for the table.
If set to true, loading indicator and text displays in the table.
Used to provide a more specific message for loading and no data available text.
Example : label = "Test Items"
Loading Test Items
No Test Items Found
Default: Data
FAQs
An NPM package of common react components
The npm package @ndustrial/nd-react-common receives a total of 7 weekly downloads. As such, @ndustrial/nd-react-common popularity was classified as not popular.
We found that @ndustrial/nd-react-common demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 13 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.