How to use the prop-types.node function in prop-types

To help you get started, we’ve selected a few 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 uyuni-project / uyuni / web / html / src / components / tab-container.js View on Github external
/* eslint-disable */
"use strict";

const PropTypes = require('prop-types');
const React = require("react");

class TabContainer extends React.Component {
  static propTypes = {
    labels: PropTypes.arrayOf(PropTypes.node).isRequired,
    hashes: PropTypes.arrayOf(PropTypes.string).isRequired, // must start with #
    tabs: PropTypes.arrayOf(PropTypes.node).isRequired,
    initialActiveTabHash: PropTypes.string,
    onTabHashChange: PropTypes.func, // takes a hash parameter
  };

  UNSAFE_componentWillReceiveProps(nextProps) {
    this.setState({activeTabHash: this.sanitizeHash(nextProps.initialActiveTabHash, nextProps.hashes)});
  }

  sanitizeHash = (hash, hashArr) => {
    hashArr = hashArr || this.props.hashes;

    if (hashArr.indexOf(hash) >= 0) {
      return hash;
    }
github Clever / components / src / FloatingButton / FloatingButton.tsx View on Github external
} as const;

// TODO: Move to <button> component
const ColorGroup = {
  GREEN: "green",
} as const;

const propTypes = {
  animate: PropTypes.bool,

  additionalButtons: PropTypes.array,

  colorGroup: PropTypes.oneOf(Object.values(ColorGroup)),
  className: PropTypes.string,
  closeLabel: PropTypes.node,
  label: PropTypes.node,

  onClick: PropTypes.func,

  offsetX: PropTypes.string,
  offsetY: PropTypes.string,
  positionX: PropTypes.oneOf(Object.values(PositionX)),
  positionY: PropTypes.oneOf(Object.values(PositionY)),
  size: PropTypes.oneOf(Object.values(Button.Size)),
};

const defaultProps = {
  animate: true,
  label: "+",
  offsetX: "2",
  offsetY: "2",
  positionX: PositionX.RIGHT,</button>
github fannypackui / fannypack / packages / fannypack / src / Dialog / Dialog.tsx View on Github external
);
};

Dialog.Dialog = DialogDialog;
Dialog.Header = DialogHeader;
Dialog.Content = DialogContent;
Dialog.Footer = DialogFooter;
Dialog.Title = DialogTitle;
Dialog.Close = DialogClose;
Dialog.Icon = DialogIcon;

export const dialogPropTypes = {
  actionButtonsProps: PropTypes.shape(actionButtonsPropTypes),
  a11yDescriptionId: PropTypes.string,
  a11yTitleId: PropTypes.string,
  children: PropTypes.node.isRequired,
  className: PropTypes.string,
  closeButtonProps: PropTypes.shape(_omit(buttonPropTypes, 'children')),
  footer: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
  hasScroll: PropTypes.bool,
  onClickClose: PropTypes.func,
  showActionButtons: PropTypes.bool,
  showCloseButton: PropTypes.bool,
  title: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
  type: PropTypes.string,
  ...dialogDialogPropTypes
};
Dialog.propTypes = dialogPropTypes;

export const dialogDefaultProps = {
  ...dialogDialogDefaultProps,
  actionButtonsProps: {},
github yang-wei / rd3 / src / common / charts / LegendChart.jsx View on Github external
'use strict';

const PropTypes = require('prop-types');
const React = require('react');
const createReactClass = require('create-react-class');

const Legend = require('../Legend');
const d3 = require('d3');

module.exports = createReactClass({

  displayName: 'LegendChart',

  propTypes: {
    children: PropTypes.node,
    createClass: PropTypes.string,
    colors: PropTypes.func,
    colorAccessor: PropTypes.func,
    data: PropTypes.array,
    height: PropTypes.node,
    legend: PropTypes.bool,
    legendPosition: PropTypes.string,
    margins: PropTypes.object,
    sideOffset: PropTypes.number,
    svgClassName: PropTypes.string,
    title: PropTypes.node,
    titleClassName: PropTypes.string,
    viewBox: PropTypes.string,
    width: PropTypes.node,
  },
github Sharlaan / material-ui-superselectfield / lib / types / index.js View on Github external
exports.__esModule = true;
exports.selectFieldTypes = exports.selectionsPresenterTypes = exports.floatingLabelTypes = undefined;

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

var _propTypes = require('prop-types');

var _utils = require('../utils');

var floatingLabelTypes = exports.floatingLabelTypes = {
  shrink: _propTypes.bool
};

var selectionsPresenterTypes = exports.selectionsPresenterTypes = {
  dropDownIcon: _propTypes.node,
  errorStyle: _propTypes.object,
  errorText: _propTypes.string,
  hintText: _propTypes.string,
  selectionsRenderer: _propTypes.func,
  underlineErrorStyle: _propTypes.object
};

var selectFieldTypes = exports.selectFieldTypes = {
  anchorOrigin: (0, _propTypes.shape)({
    vertical: (0, _propTypes.oneOf)(['top', 'bottom']),
    horizontal: (0, _propTypes.oneOf)(['left', 'right'])
  }),
  style: _propTypes.object,
  menuStyle: _propTypes.object,
  menuGroupStyle: _propTypes.object,
  checkPosition: (0, _propTypes.oneOf)(['', 'left', 'right']),
github microsoft / fluent-ui-react / packages / react / src / components / Menu / MenuItem.tsx View on Github external
disabled: PropTypes.bool,
    icon: customPropTypes.itemShorthandWithoutJSX,
    iconOnly: PropTypes.bool,
    index: PropTypes.number,
    itemPosition: PropTypes.number,
    itemsCount: PropTypes.number,
    onClick: PropTypes.func,
    onFocus: PropTypes.func,
    onBlur: PropTypes.func,
    pills: PropTypes.bool,
    pointing: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['start', 'end'])]),
    primary: customPropTypes.every([customPropTypes.disallow(['secondary']), PropTypes.bool]),
    secondary: customPropTypes.every([customPropTypes.disallow(['primary']), PropTypes.bool]),
    underlined: PropTypes.bool,
    vertical: PropTypes.bool,
    wrapper: PropTypes.oneOfType([PropTypes.node, PropTypes.object]),
    menu: PropTypes.oneOfType([customPropTypes.itemShorthand, customPropTypes.collectionShorthand]),
    menuOpen: PropTypes.bool,
    defaultMenuOpen: PropTypes.bool,
    onActiveChanged: PropTypes.func,
    inSubmenu: PropTypes.bool,
    indicator: customPropTypes.itemShorthandWithoutJSX,
    onMenuOpenChange: PropTypes.func,
  }

  static defaultProps = {
    as: 'a',
    accessibility: menuItemBehavior as Accessibility,
    wrapper: { as: 'li' },
  }

  static autoControlledProps = ['menuOpen']
github digirati-co-uk / canvas-panel / packages / canvas-panel-core / src / utility / functionOrMapChildren.js View on Github external
return (
      children(withProps) || <div>Could not render children from function</div>
    );
  }

  return (
    React.Children.map(children, child =&gt; {
      return React.cloneElement(child, withProps);
    }) || <div>Could not clone children</div>
  );
}

export const FunctionOrMapChildrenType = PropTypes.oneOfType([
  PropTypes.func,
  PropTypes.arrayOf(PropTypes.node),
  PropTypes.node,
]);
github Sharlaan / material-ui-superselectfield / lib / types / selectFieldTypes.js View on Github external
"'.\n            Validation failed."
            )
          }
        }
      }
    }),
  ]),
  disabled: _propTypes.bool,
  elementHeight: (0, _propTypes.oneOfType)([_propTypes.number, (0, _propTypes.arrayOf)(_propTypes.number)]),
  floatingLabel: (0, _propTypes.oneOfType)([_propTypes.string, _propTypes.node]),
  hintText: _propTypes.string,
  hintTextAutocomplete: _propTypes.string,
  hoverColor: _propTypes.string,
  innerDivStyle: _propTypes.object,
  keepSearchOnSelect: _propTypes.bool,
  menuCloseButton: _propTypes.node,
  menuFooterStyle: _propTypes.object,
  menuGroupStyle: _propTypes.object,
  menuStyle: _propTypes.object,
  multiple: _propTypes.bool,
  name: _propTypes.string,
  nb2show: _propTypes.number,
  noMatchFound: _propTypes.string,
  noMatchFoundStyle: _propTypes.object,
  onAutoCompleteTyping: _propTypes.func,
  onChange: _propTypes.func,
  onMenuOpen: _propTypes.func,
  onSelect: _propTypes.func,
  openImmediately: _propTypes.bool,
  popoverClassName: _propTypes.string,
  selectedMenuItemStyle: _propTypes.object,
  selectionsRenderer: _propTypes.func,
github shine-design / shine-design / libs / components / Input / Input.jsx View on Github external
import './style';

export default class extends Component {
    constructor(props) {
        super(props);
    }

    static propTypes = {
        ...COMMON_PROPS_TYPE,
        label: PropTypes.node,
        id: PropTypes.oneOfType([
            PropTypes.string,
            PropTypes.number
        ]),
        type: PropTypes.string,
        placeholder: PropTypes.node,
        helper: PropTypes.node,
        name: PropTypes.oneOfType([
            PropTypes.string,
            PropTypes.number
        ]),
        multiple: PropTypes.bool,
        options: PropTypes.arrayOf(PropTypes.shape({
            value: PropTypes.oneOfType([
                PropTypes.string,
                PropTypes.number
            ]),
            label: PropTypes.node,
            isChecked: PropTypes.bool,
            ...COMMON_PROPS_TYPE,
        })),
        inputStyle: PropTypes.oneOf(['pill', 'square', 'normal']),