How to use the airbnb-prop-types.nonNegativeInteger.isRequired function in airbnb-prop-types

To help you get started, we’ve selected a few airbnb-prop-types examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sean-ww / react-redux-datatable / src / DataTable.jsx View on Github external
import React from 'react';
import PropTypes from 'prop-types';
import BootstrapTable from 'react-bootstrap-table-next';
import filterFactory, { textFilter, selectFilter, numberFilter, customFilter } from 'react-bootstrap-table2-filter';
import { forbidExtraProps, nonNegativeInteger } from 'airbnb-prop-types';
import paginationFactory from './Pagination';

import { NO_DATA_INDICATOR } from './constants';

const propTypes = forbidExtraProps({
  dataTotalSize: nonNegativeInteger.isRequired,
  clearFilters: PropTypes.func.isRequired,
  currentPage: nonNegativeInteger.isRequired,
  keyField: PropTypes.string.isRequired,
  onExportToCSV: PropTypes.func.isRequired,
  onSearchChange: PropTypes.func.isRequired,
  onSizePerPageChange: PropTypes.func.isRequired,
  onTableChange: PropTypes.func.isRequired,
  refreshTable: PropTypes.func.isRequired,
  sizePerPage: nonNegativeInteger.isRequired,
  startClearingFilters: PropTypes.func.isRequired,
  tableColumns: PropTypes.object.isRequired,
  defaultSort: PropTypes.array,
  extraButtons: PropTypes.func,
  isFiltered: PropTypes.bool,
  noDataIndication: PropTypes.any,
  searchValue: PropTypes.string,
github sean-ww / react-redux-datatable / src / Pagination / Pagination.jsx View on Github external
import cs from 'classnames';
import React from 'react';
import PropTypes from 'prop-types';
import { forbidExtraProps, nonNegativeInteger } from 'airbnb-prop-types';
import { calculateFromTo, calculatePageCount, createListItems } from './Pagination.helpers';
import SizePerPageSelect from './SizePerPageSelect/SizePerPageSelect';
import PaginationList from './PaginationList/PaginationList';
import PaginationTotal from './PaginationTotal/PaginationTotal';
import { LIST_ITEMS } from './constants';

const propTypes = forbidExtraProps({
  dataSize: nonNegativeInteger.isRequired,
  currentPage: nonNegativeInteger.isRequired,
  currentSizePerPage: nonNegativeInteger.isRequired,
  onPageChange: PropTypes.func.isRequired,
  onSizePerPageChange: PropTypes.func.isRequired,
  paginationTotal: PropTypes.func,
});

const defaultProps = {
  paginationTotal: undefined,
};

class Pagination extends React.Component {
  state = {
    isDropDownOpen: false,
  };

  toggleDropDown = () => {
github sean-ww / react-redux-datatable / src / Pagination / Pagination.jsx View on Github external
import cs from 'classnames';
import React from 'react';
import PropTypes from 'prop-types';
import { forbidExtraProps, nonNegativeInteger } from 'airbnb-prop-types';
import { calculateFromTo, calculatePageCount, createListItems } from './Pagination.helpers';
import SizePerPageSelect from './SizePerPageSelect/SizePerPageSelect';
import PaginationList from './PaginationList/PaginationList';
import PaginationTotal from './PaginationTotal/PaginationTotal';
import { LIST_ITEMS } from './constants';

const propTypes = forbidExtraProps({
  dataSize: nonNegativeInteger.isRequired,
  currentPage: nonNegativeInteger.isRequired,
  currentSizePerPage: nonNegativeInteger.isRequired,
  onPageChange: PropTypes.func.isRequired,
  onSizePerPageChange: PropTypes.func.isRequired,
  paginationTotal: PropTypes.func,
});

const defaultProps = {
  paginationTotal: undefined,
};

class Pagination extends React.Component {
  state = {
    isDropDownOpen: false,
  };
github sean-ww / react-redux-datatable / src / DataTable.jsx View on Github external
import { forbidExtraProps, nonNegativeInteger } from 'airbnb-prop-types';
import paginationFactory from './Pagination';

import { NO_DATA_INDICATOR } from './constants';

const propTypes = forbidExtraProps({
  dataTotalSize: nonNegativeInteger.isRequired,
  clearFilters: PropTypes.func.isRequired,
  currentPage: nonNegativeInteger.isRequired,
  keyField: PropTypes.string.isRequired,
  onExportToCSV: PropTypes.func.isRequired,
  onSearchChange: PropTypes.func.isRequired,
  onSizePerPageChange: PropTypes.func.isRequired,
  onTableChange: PropTypes.func.isRequired,
  refreshTable: PropTypes.func.isRequired,
  sizePerPage: nonNegativeInteger.isRequired,
  startClearingFilters: PropTypes.func.isRequired,
  tableColumns: PropTypes.object.isRequired,
  defaultSort: PropTypes.array,
  extraButtons: PropTypes.func,
  isFiltered: PropTypes.bool,
  noDataIndication: PropTypes.any,
  searchValue: PropTypes.string,
  tableData: PropTypes.any,
});

const defaultProps = {
  defaultSort: null,
  extraButtons: null,
  isFiltered: false,
  noDataIndication: NO_DATA_INDICATOR,
  searchValue: undefined,
github sean-ww / react-redux-datatable / src / Pagination / PaginationTotal / PaginationTotal.jsx View on Github external
import React from 'react';
import { forbidExtraProps, nonNegativeInteger } from 'airbnb-prop-types';

const propTypes = forbidExtraProps({
  start: nonNegativeInteger.isRequired,
  to: nonNegativeInteger.isRequired,
  total: nonNegativeInteger.isRequired,
});

const PaginationTotal = ({ start, to, total }) => (
  <div style="{{">
    Showing {start} to {to} of {total} Results
  </div>
);

PaginationTotal.propTypes = propTypes;

export default PaginationTotal;
github sean-ww / react-redux-datatable / src / Pagination / PaginationTotal / PaginationTotal.jsx View on Github external
import React from 'react';
import { forbidExtraProps, nonNegativeInteger } from 'airbnb-prop-types';

const propTypes = forbidExtraProps({
  start: nonNegativeInteger.isRequired,
  to: nonNegativeInteger.isRequired,
  total: nonNegativeInteger.isRequired,
});

const PaginationTotal = ({ start, to, total }) =&gt; (
  <div style="{{">
    Showing {start} to {to} of {total} Results
  </div>
);

PaginationTotal.propTypes = propTypes;

export default PaginationTotal;
github sean-ww / react-redux-datatable / src / Pagination / Pagination.jsx View on Github external
import cs from 'classnames';
import React from 'react';
import PropTypes from 'prop-types';
import { forbidExtraProps, nonNegativeInteger } from 'airbnb-prop-types';
import { calculateFromTo, calculatePageCount, createListItems } from './Pagination.helpers';
import SizePerPageSelect from './SizePerPageSelect/SizePerPageSelect';
import PaginationList from './PaginationList/PaginationList';
import PaginationTotal from './PaginationTotal/PaginationTotal';
import { LIST_ITEMS } from './constants';

const propTypes = forbidExtraProps({
  dataSize: nonNegativeInteger.isRequired,
  currentPage: nonNegativeInteger.isRequired,
  currentSizePerPage: nonNegativeInteger.isRequired,
  onPageChange: PropTypes.func.isRequired,
  onSizePerPageChange: PropTypes.func.isRequired,
  paginationTotal: PropTypes.func,
});

const defaultProps = {
  paginationTotal: undefined,
};

class Pagination extends React.Component {
  state = {
    isDropDownOpen: false,
  };

  toggleDropDown = () => {
    this.setState(prevState => ({
github sean-ww / react-redux-datatable / src / DataTable.jsx View on Github external
import React from 'react';
import PropTypes from 'prop-types';
import BootstrapTable from 'react-bootstrap-table-next';
import filterFactory, { textFilter, selectFilter, numberFilter, customFilter } from 'react-bootstrap-table2-filter';
import { forbidExtraProps, nonNegativeInteger } from 'airbnb-prop-types';
import paginationFactory from './Pagination';

import { NO_DATA_INDICATOR } from './constants';

const propTypes = forbidExtraProps({
  dataTotalSize: nonNegativeInteger.isRequired,
  clearFilters: PropTypes.func.isRequired,
  currentPage: nonNegativeInteger.isRequired,
  keyField: PropTypes.string.isRequired,
  onExportToCSV: PropTypes.func.isRequired,
  onSearchChange: PropTypes.func.isRequired,
  onSizePerPageChange: PropTypes.func.isRequired,
  onTableChange: PropTypes.func.isRequired,
  refreshTable: PropTypes.func.isRequired,
  sizePerPage: nonNegativeInteger.isRequired,
  startClearingFilters: PropTypes.func.isRequired,
  tableColumns: PropTypes.object.isRequired,
  defaultSort: PropTypes.array,
  extraButtons: PropTypes.func,
  isFiltered: PropTypes.bool,
  noDataIndication: PropTypes.any,
  searchValue: PropTypes.string,
  tableData: PropTypes.any,
});
github sean-ww / react-redux-datatable / src / Pagination / PaginationTotal / PaginationTotal.jsx View on Github external
import React from 'react';
import { forbidExtraProps, nonNegativeInteger } from 'airbnb-prop-types';

const propTypes = forbidExtraProps({
  start: nonNegativeInteger.isRequired,
  to: nonNegativeInteger.isRequired,
  total: nonNegativeInteger.isRequired,
});

const PaginationTotal = ({ start, to, total }) =&gt; (
  <div style="{{">
    Showing {start} to {to} of {total} Results
  </div>
);

PaginationTotal.propTypes = propTypes;

export default PaginationTotal;