Ejemplo n.º 1
0
 it('should be compatible with React.PropTypes.oneOfType', function() {
   typeCheckPass(
     React.PropTypes.oneOfType([LinkPropTypes.link(React.PropTypes.number)]),
     {value: 123, requestChange: emptyFunction}
   );
   typeCheckFail(
     React.PropTypes.oneOfType([LinkPropTypes.link(React.PropTypes.number)]),
     123,
     invalidMessage
   );
   typeCheckPass(
     LinkPropTypes.link(React.PropTypes.oneOfType([React.PropTypes.number])),
     {value: 123, requestChange: emptyFunction}
   );
   typeCheckFail(
     LinkPropTypes.link(React.PropTypes.oneOfType([React.PropTypes.number])),
     {value: 'imastring', requestChange: emptyFunction},
     'Invalid prop `testProp.value` supplied to `testComponent`.'
   );
 });
Ejemplo n.º 2
0
      );
    }
  }]);

  return DeviceOrientation;
}(_react.Component);

// https://developer.mozilla.org/en-US/docs/Web/API/screen/lockOrientation


exports.default = DeviceOrientation;
var LOCK_ORIENTATIONS = ['portrait-primary', 'portrait-secondary', 'landscape-primary', 'landscape-secondary', 'portrait', 'landscape', 'default'];

var isOrientation = function isOrientation(props, propName, componentName, location, propFullName) {
  var propValue = props[propName];
  if (propValue.type !== Orientation) {
    return new Error('Invalid ' + location + ' \'' + propFullName + '\' supplied to \'' + componentName + '\', expected \'Orientation\' component.');
  }
};

DeviceOrientation.propTypes = {
  children: _react.PropTypes.oneOfType([isOrientation, _react.PropTypes.arrayOf(isOrientation)]).isRequired,
  className: _react.PropTypes.string,
  lockOrientation: _react.PropTypes.oneOfType([_react.PropTypes.oneOf(LOCK_ORIENTATIONS), _react.PropTypes.arrayOf(_react.PropTypes.oneOf(LOCK_ORIENTATIONS))]),
  onLockOrientation: _react.PropTypes.func,
  onOrientationChange: _react.PropTypes.func
};

DeviceOrientation.defaultProps = {
  className: ''
};
Ejemplo n.º 3
0
var LayoutPropTypes = {
  /** `display` sets the display type of this component.
   *
   *  It works similarly to `display` in CSS, but only support 'flex' and 'none'.
   *  'flex' is the default.
   */
  display: ReactPropTypes.string,

  /** `width` sets the width of this component.
   *
   *  It works similarly to `width` in CSS, but in React Native you
   *  must use points or percentages. Ems and other units are not supported.
   *  See https://developer.mozilla.org/en-US/docs/Web/CSS/width for more details.
   */
  width: ReactPropTypes.oneOfType([
    ReactPropTypes.number,
    ReactPropTypes.string,
  ]),

  /** `height` sets the height of this component.
   *
   *  It works similarly to `height` in CSS, but in React Native you
   *  must use points or percentages. Ems and other units are not supported.
   *  See https://developer.mozilla.org/en-US/docs/Web/CSS/height for more details.
   */
  height: ReactPropTypes.oneOfType([
    ReactPropTypes.number,
    ReactPropTypes.string,
  ]),

  /** `top` is the number of logical pixels to offset the top edge of
   *  this component.
Ejemplo n.º 4
0
  routes: ?Array<RouteDef>,
  render: Function,
  createElement: ?Function,
  onError?: () => void,
  onUpdate?: () => void,
  matchContext: Object,
};

const { TABS_ROUTE } = RouteTypes;

const {
  POP: HISTORY_POP,
  REPLACE: HISTORY_REPLACE,
} = Actions;

const route = PropTypes.oneOfType([PropTypes.object, PropTypes.element]);

let backwardHistory: Array<Snapshot> = [];
let forwardHistory: Array<Snapshot> = [];

class NativeRouter extends Component<any, any, any> {

  static propTypes = {
    history: PropTypes.object.isRequired,
    children: PropTypes.oneOfType([route, PropTypes.arrayOf(route)]),
    routes: PropTypes.oneOfType([route, PropTypes.arrayOf(route)]),
    render: PropTypes.func.isRequired,
    createElement: PropTypes.func,
    onError: PropTypes.func,
    onUpdate: PropTypes.func,
    matchContext: PropTypes.object.isRequired,
Ejemplo n.º 5
0
          'active': isSelected,
          'col-xs-5': true
        })}
        style={{
          cursor: 'default'
        }}>
        <a
          onClick={this.handlesOnClick}
          style={{textAlign: 'center'}}>
          {itemText}
        </a>
      </li>
    );
  }

  handlesOnClick(event) {
    event.preventDefault();
    const { onClick, itemId } = this.props;
    onClick(itemId);
  }
}

NavItem.propTypes = {
  itemId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
  itemText: PropTypes.string.isRequired,
  isSelected: PropTypes.bool.isRequired,
  onClick: PropTypes.func.isRequired
};

export default NavItem;
Ejemplo n.º 6
0
      onPress={() => onPress(roomId, exists)}
      rippleColor="#ECECEC">
      <Avatar
        src={src}
        size={50} />

      <View style={s.infoContainer}>
        <Text style={s.name}>{name}</Text>
        <Text style={s.userCount}>{userCount} people</Text>
      </View>
    </Button>

  )
}

SearchRoomItem.defaultProps = {
  exists: true
}

SearchRoomItem.propTypes = {
  name: PropTypes.string.isRequired,
  userCount: PropTypes.number.isRequired,
  id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
  user: PropTypes.object,
  onPress: PropTypes.func,
  exists: PropTypes.bool,
  room: PropTypes.object
}

export default SearchRoomItem
Ejemplo n.º 7
0
  }

}

Legend.defaultProps = {
  announce: false
};

Legend.propTypes = {
  activeIndex: PropTypes.number,
  announce: PropTypes.bool,
  onActive: PropTypes.func,
  series: PropTypes.arrayOf(PropTypes.shape({
    label: PropTypes.string,
    value: PropTypes.oneOfType([
      PropTypes.number,
      PropTypes.node
    ]),
    units: PropTypes.oneOfType([
      PropTypes.string,
      PropTypes.shape({
        prefix: PropTypes.string,
        suffix: PropTypes.string
      })
    ]),
    colorIndex: PropTypes.oneOfType([
      PropTypes.number, // 1-6
      PropTypes.string // status
    ]),
    onClick: PropTypes.func
  })).isRequired,
  size: PropTypes.oneOf(['medium', 'large']),
Ejemplo n.º 8
0
 * Renders bars for your bar chart.
 *
 * @example ../docs/examples/Bars.md
 */
const Bars = React.createClass({

    displayName: 'Bars',

    propTypes: {
        className: React.PropTypes.string,
        /**
         * Colors
         */
        colors: React.PropTypes.oneOfType([
            React.PropTypes.oneOf(['category10', 'category20', 'category20b', 'category20c']),
            React.PropTypes.arrayOf(React.PropTypes.string),
            React.PropTypes.func
        ]),
        opacity: React.PropTypes.number,
        style: React.PropTypes.object,

        combined: React.PropTypes.bool,
        groupPadding: React.PropTypes.oneOfType([React.PropTypes.number, React.PropTypes.string, React.PropTypes.func]),
        innerPadding: React.PropTypes.oneOfType([React.PropTypes.number, React.PropTypes.string, React.PropTypes.func]),

        seriesVisible: React.PropTypes.oneOfType([React.PropTypes.bool, React.PropTypes.func]),
        seriesAttributes: React.PropTypes.oneOfType([React.PropTypes.object, React.PropTypes.func]),
        seriesStyle: React.PropTypes.oneOfType([React.PropTypes.object, React.PropTypes.func]),

        groupStyle: React.PropTypes.oneOfType([React.PropTypes.object, React.PropTypes.func]),
Ejemplo n.º 9
0
import React, { PropTypes } from 'react';
import MenuMixin from './MenuMixin';
import assign from 'object-assign';
import { getKeyFromChildrenIndex } from './util';
import Animate from 'rc-animate';

const SubPopupMenu = React.createClass({
  propTypes: {
    onSelect: PropTypes.func,
    onClick: PropTypes.func,
    onDeselect: PropTypes.func,
    onOpenChange: PropTypes.func,
    onDestroy: PropTypes.func,
    openTransitionName: PropTypes.string,
    openAnimation: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
    openKeys: PropTypes.arrayOf(PropTypes.string),
    closeSubMenuOnMouseLeave: PropTypes.bool,
    visible: PropTypes.bool,
    children: PropTypes.any,
  },

  mixins: [MenuMixin],

  onDeselect(selectInfo) {
    this.props.onDeselect(selectInfo);
  },

  onSelect(selectInfo) {
    this.props.onSelect(selectInfo);
  },
Ejemplo n.º 10
0
                                    <LineComponent index={numberOfList} {...lineWrapperProps} />
                                </LineWrapper>
                            </div>
                        );
                    })}
                </ListWrapper>
            </div>
        );
    };
};
ListComponentWithToolBar.displayName ='ListComponentWithToolBar';
ListComponentWithToolBar.propTypes = {
    GlobalGroupActionsComponent: PropTypes.func,
    isGroup: PropTypes.bool,
    lineProps: PropTypes.object,
    lineIdentifierProperty: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
    LineWrapper: PropTypes.func,
    ListWrapper: PropTypes.func,
    numberOfList: PropTypes.number,
    numberOfSelectedElement: PropTypes.number,
    scope: PropTypes.string,
    selectedElements: PropTypes.arrayOf(PropTypes.object),
    stateOfTheSelectionList: PropTypes.bool,
    toggleAllLine: PropTypes.func,
    toggleLineSelection: PropTypes.func,
    unitSearchDispatch: PropTypes.object.isRequired,
    valuesForResult: PropTypes.object.isRequired
};
ListComponentWithToolBar.defaultProps = {
    isGroup: false,
    lineProps: {},
Ejemplo n.º 11
0
var React = require('react');
var classNames = require('classnames');

var Toggle = React.createClass({

  propTypes: {
    isToggled: React.PropTypes.bool,
    onToggle: React.PropTypes.func,
    options: React.PropTypes.arrayOf(React.PropTypes.shape({
      label: React.PropTypes.oneOfType([
        React.PropTypes.string,
        React.PropTypes.number
      ]),
      value: React.PropTypes.oneOfType([
        React.PropTypes.string,
        React.PropTypes.number
      ])
    }))
  },

  _onToggle: function() {
    this.props.onToggle(!this.props.isToggled);
  },

  render: function() {
    var toggleClassName = classNames('pol-toggle', {
      'pol-toggled': this.props.isToggled
    });
    return (
      <div className={toggleClassName} onClick={this._onToggle}>
        <div className="pol-toggle-options">
Ejemplo n.º 12
0
    }

    return (getJsonFromUrl().i13n_debug === '1') ? true : false;
}

/**
 * React.js I13n Mixin
 * Append the functions needed to create an i13n node
 * @class I13nMixin
 */
var I13nMixin = {

    mixins: [I13nUtils, ViewportMixin],

    propTypes: {
        component: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.func]),
        model: React.PropTypes.oneOfType([React.PropTypes.object, React.PropTypes.func]),
        i13nModel: React.PropTypes.oneOfType([React.PropTypes.object, React.PropTypes.func]),
        isLeafNode: React.PropTypes.bool,
        bindClickEvent: React.PropTypes.bool,
        follow: React.PropTypes.bool,
        scanLinks: React.PropTypes.shape({
            enable: React.PropTypes.bool,
            tags: React.PropTypes.array
        })
    },

    /**
     * componentWillUpdate
     * @method componentWillUpdate
     */
Ejemplo n.º 13
0
import React from 'react';
import Input from './Input';

/**
 * VerticalInput
 */
class HorinzontalInput extends Input {

    renderComponent() {

        return React.createElement('div', {className: 'form-group'+this.state.validationState},
            React.createElement('label', {}, this.props.labelValue),
                Input.prototype.renderComponent.call(this));
    }
}

HorinzontalInput.propTypes = {
    type: React.PropTypes.string,
    name: React.PropTypes.string.isRequired,
    defaultValue: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.number]),
    model: React.PropTypes.object.isRequired,
    bsSize: React.PropTypes.oneOf(['xs','sm', 'md', 'lg']),
    labelValue:React.PropTypes.string
};

export default HorinzontalInput;
Ejemplo n.º 14
0
  /** Primary content. */
  children: PropTypes.node,

  /** Additional classes. */
  className: PropTypes.string,

  /** Shorthand for primary content. */
  content: customPropTypes.contentShorthand,

  /** A loader can be disabled or hidden. */
  disabled: PropTypes.bool,

  /** A loader can show it's unsure of how long a task will take. */
  indeterminate: PropTypes.bool,

  /** Loaders can appear inline with content. */
  inline: PropTypes.oneOfType([
    PropTypes.bool,
    PropTypes.oneOf(Loader._meta.props.inline),
  ]),

  /** Loaders can have their colors inverted. */
  inverted: PropTypes.bool,

  /** Loaders can have different sizes. */
  size: PropTypes.oneOf(Loader._meta.props.size),
}

export default Loader
Ejemplo n.º 15
0
  shouldComponentUpdate(nextProps, nextState) {
    return shallowCompare(this, nextProps, nextState);
  }

  render() {
    const { selectedValue } = this.props;
    return (
      <RadioGroup
        name="typeFicheContact"
        selectedValue={selectedValue}
        onChange={this.handlesOnChange}>
        <Radio value="information" />Information
        <Radio value="reclamation" />Réclamation
      </RadioGroup>
    );
  }

  handlesOnChange(value) {
    event.preventDefault();
    const { onChange } = this.props;
    onChange(value);
  }
}

TypeFicheContactRadio.propTypes = {
  onChange: PropTypes.func.isRequired,
  selectedValue: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
};

export default TypeFicheContactRadio;
Ejemplo n.º 16
0
    </ElementType>
  )
}

Header._meta = {
  name: 'Header',
  type: META.TYPES.ELEMENT,
}

Header.propTypes = {
  /** An element type to render as (string or function). */
  as: customPropTypes.as,

  /** Attach header  to other content, like a segment. */
  attached: PropTypes.oneOfType([
    PropTypes.bool,
    PropTypes.oneOf(['top', 'bottom']),
  ]),

  /** Format header to appear inside a content block. */
  block: PropTypes.bool,

  /** Primary content. */
  children: PropTypes.node,

  /** Additional classes. */
  className: PropTypes.string,

  /** Color of the header. */
  color: PropTypes.oneOf(SUI.COLORS),

  /** Shorthand for primary content. */
Ejemplo n.º 17
0
const createConnectedFields = ({ deepEqual, getIn, toJS }) => {

  const getSyncError = (syncErrors, name) => {
    const error = plain.getIn(syncErrors, name)
    // Because the error for this field might not be at a level in the error structure where
    // it can be set directly, it might need to be unwrapped from the _error property
    return error && error._error ? error._error : error
  }

  const getSyncWarning = (syncWarnings, name) => {
    const warning = plain.getIn(syncWarnings, name)
    // Because the warning for this field might not be at a level in the warning structure where
    // it can be set directly, it might need to be unwrapped from the _warning property
    return warning && warning._warning ? warning._warning : warning
  }

  class ConnectedFields extends Component {
    constructor(props) {
      super(props)

      this.handleChange = this.handleChange.bind(this)
      this.handleFocus = this.handleFocus.bind(this)
      this.handleBlur = this.handleBlur.bind(this)

      this.onChangeFns = Object.keys(props._fields).reduce((acc, name) => ({
        ...acc, [name]: event => this.handleChange(name, event)
      }), {})

      this.onFocusFns = Object.keys(props._fields).reduce((acc, name) => ({
        ...acc, [name]: () => this.handleFocus(name)
      }), {})

      this.onBlurFns = Object.keys(props._fields).reduce((acc, name) => ({
        ...acc, [name]: event => this.handleBlur(name, event)
      }), {})
    }

    shouldComponentUpdate(nextProps) {
      const nextPropsKeys = Object.keys(nextProps)
      const thisPropsKeys = Object.keys(this.props)
      return nextPropsKeys.length !== thisPropsKeys.length || nextPropsKeys.some(prop => {
        return !~propsToNotUpdateFor.indexOf(prop) && !deepEqual(this.props[ prop ], nextProps[ prop ])
      })
    }

    isDirty() {
      const { _fields } = this.props
      return Object.keys(_fields).some(name => _fields[ name ].dirty)
    }

    getValues() {
      const { _fields } = this.props
      return Object.keys(_fields).reduce((accumulator, name) =>
        plain.setIn(accumulator, name, _fields[ name ].value), {})
    }

    getRenderedComponent() {
      return this.refs.renderedComponent
    }

    handleChange(name, event) {
      const { dispatch, parse, normalize, _reduxForm } = this.props
      const value = onChangeValue(event, { name, parse, normalize })

      dispatch(_reduxForm.change(name, value))
    }

    handleFocus(name) {
      const { dispatch, _reduxForm } = this.props
      dispatch(_reduxForm.focus(name))
    }

    handleBlur(name, event) {
      const { dispatch, parse, normalize, _reduxForm } = this.props
      const value = onChangeValue(event, { name, parse, normalize })

      // dispatch blur action
      dispatch(_reduxForm.blur(name, value))

      // call post-blur callback
      if (_reduxForm.asyncValidate) {
        _reduxForm.asyncValidate(name, value)
      }
    }

    render() {
      const { component, withRef, _fields, _reduxForm, ...rest } = this.props
      const { sectionPrefix } = _reduxForm
      const { custom, ...props } = Object.keys(_fields).reduce((accumulator, name) => {
        const connectedProps = _fields[ name ]
        const { custom, ...fieldProps } = createFieldProps({ getIn, toJS },
          name,
          {
            ...connectedProps,
            ...rest,
            onBlur: this.onBlurFns[name],
            onChange: this.onChangeFns[name],
            onFocus: this.onFocusFns[name]
          }
        )
        accumulator.custom = custom
        const fieldName = sectionPrefix ? name.replace(`${sectionPrefix}.`, '') : name
        return plain.setIn(accumulator, fieldName, fieldProps)
      }, {})
      if (withRef) {
        props.ref = 'renderedComponent'
      }

      return createElement(component, { ...props, ...custom })
    }
  }

  ConnectedFields.propTypes = {
    component: PropTypes.oneOfType([ PropTypes.func, PropTypes.string ]).isRequired,
    _fields: PropTypes.object.isRequired,
    props: PropTypes.object
  }

  const connector = connect(
    (state, ownProps) => {
      const { names, _reduxForm: { initialValues, getFormState } } = ownProps
      const formState = getFormState(state)
      return {
        _fields: names.reduce((accumulator, name) => {
          const initialState = getIn(formState, `initial.${name}`)
          const initial = initialState !== undefined ? initialState : (initialValues && getIn(initialValues, name)) 
          const value = getIn(formState, `values.${name}`)
          const syncError = getSyncError(getIn(formState, 'syncErrors'), name)
          const syncWarning = getSyncWarning(getIn(formState, 'syncWarnings'), name)
          const submitting = getIn(formState, 'submitting')
          const pristine = value === initial
          accumulator[ name ] = {
            asyncError: getIn(formState, `asyncErrors.${name}`),
            asyncValidating: getIn(formState, 'asyncValidating') === name,
            dirty: !pristine,
            pristine,
            state: getIn(formState, `fields.${name}`),
            submitError: getIn(formState, `submitErrors.${name}`),
            submitFailed: getIn(formState, 'submitFailed'),
            submitting,
            syncError,
            syncWarning,
            value,
            _value: ownProps.value // save value passed in (for checkboxes)
          }
          return accumulator
        }, {})
      }
    },
    undefined,
    undefined,
    { withRef: true }
  )
  return connector(ConnectedFields)
}
Ejemplo n.º 18
0
import React, { PropTypes } from 'react';

const FormInput = ({ inputType, inputID, labelText, initialValue, handleChangeFn }) => {
  return (
    <div>
      <label htmlFor={inputID}>{labelText}</label>
      <div className='inputArea'>
        <input type={inputType} id={inputID} value={initialValue} onChange={handleChangeFn} />
      </div>
    </div>
  );
};

FormInput.propTypes = {
  inputType: PropTypes.string.isRequired,
  inputID: PropTypes.string.isRequired,
  handleChangeFn: PropTypes.func.isRequired,
  labelText: PropTypes.string,
  initialValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
};

export default FormInput;
Ejemplo n.º 19
0
import React from 'react';
import SelectField from 'material-ui/lib/select-field';
import MenuItem from 'material-ui/lib/menus/menu-item';

import MuiThemeMixin from '../mui-theme.mixin';

export default React.createClass({
    propTypes: {
        defaultValue: React.PropTypes.oneOfType([
            React.PropTypes.string,
            React.PropTypes.number,
            React.PropTypes.bool,
        ]),
        value: React.PropTypes.string.isRequired,
        onFocus: React.PropTypes.func,
        onBlur: React.PropTypes.func,
        onChange: React.PropTypes.func,
        menuItems: React.PropTypes.oneOfType([
            React.PropTypes.array,
            React.PropTypes.object,
        ]),
        includeEmpty: React.PropTypes.bool,
        emptyLabel: React.PropTypes.string,
    },

    mixins: [MuiThemeMixin],

    getDefaultProps() {
        return {
            includeEmpty: false,
            emptyLabel: '',
Ejemplo n.º 20
0
    </label>
  );

  if (!matchInputHeight) {
    return label;
  }

  return (
    <div className="form-control-input-height">
      {label}
    </div>
  );
};

FieldLabel.propTypes = {
  children: React.PropTypes.node,
  // Vertically center the element based on the height of input fields
  matchInputHeight: React.PropTypes.bool,
  // Optional boolean to show a required indicator
  required: React.PropTypes.bool,

  // Classes
  className: React.PropTypes.oneOfType([
    React.PropTypes.array,
    React.PropTypes.object,
    React.PropTypes.string
  ])
};

module.exports = FieldLabel;
Ejemplo n.º 21
0
      {children}
      {isError ? <ErrorList errors={errors} /> : <div/>}
      {help ? <p className="help-block">{help}</p> : null}
    </div>
  );
}

if (process.env.NODE_ENV !== "production") {
  Wrapper.propTypes = {
    type: PropTypes.string.isRequired,
    id: PropTypes.string,
    classNames: React.PropTypes.string,
    label: PropTypes.string,
    hidden: PropTypes.bool,
    help: PropTypes.oneOfType([
      PropTypes.string,
      PropTypes.element,
    ]),
    required: PropTypes.bool,
    displayLabel: PropTypes.bool,
    children: React.PropTypes.node.isRequired,
  };
}

Wrapper.defaultProps = {
  classNames: "",
  errorSchema: {errors: []},
  hidden: false,
  required: false,
  displayLabel: true,
};
Ejemplo n.º 22
0
   * Called when a new mention is added in the input
   *
   * Example:
   *
   * ```js
   * function(id, display) {
   *   console.log("user " + display + " was mentioned!");
   * }
   * ```
   */
  onAdd: _react.PropTypes.func,
  onRemove: _react.PropTypes.func,

  renderSuggestion: _react.PropTypes.func,

  trigger: _react.PropTypes.oneOfType([_react.PropTypes.string, _react.PropTypes.instanceOf(RegExp)]),

  isLoading: _react.PropTypes.bool,
  className: _react.PropTypes.string,
  style: _react.PropTypes.object
};

Mention.defaultProps = {
  trigger: "@",

  onAdd: function onAdd() {
    return null;
  },
  onRemove: function onRemove() {
    return null;
  },
Ejemplo n.º 23
0
    if (this.state.time) {
      time = <span className={`${CLASS_ROOT}__time`}>{this.state.time}</span>;
    }

    return (
      <span className={classes.join(' ')}>
        {date} {time}
      </span>
    );
  }

}

const FIELD_TYPES = PropTypes.oneOf(['date', 'time']);

Timestamp.propTypes = {
  align: PropTypes.oneOf(['left', 'right']),
  fields: PropTypes.oneOfType([
    PropTypes.arrayOf(FIELD_TYPES),
    FIELD_TYPES
  ]),
  value: PropTypes.oneOfType([
    PropTypes.string, // ISO-8601 string
    PropTypes.object  // Date object
  ]).isRequired
};

Timestamp.defaultProps = {
  align: 'left'
};
Ejemplo n.º 24
0
  View,
} from 'react-native';

import {
  carbonStyles,
} from '../styles';

import {
  Container,
} from '../container';

const cs = StyleSheet.create(carbonStyles);

const propTypes = {
  children: PropTypes.oneOfType([
    PropTypes.arrayOf(PropTypes.node),
    PropTypes.node,
  ]),
  color: PropTypes.number,
  footer: PropTypes.bool,
  header: PropTypes.bool,
  style: PropTypes.any,
};

const defaultProps = {};

export default function ToolbarRight(props) {
  return (
    <View style={[cs.container, props.padding && cs.padding, props.style]}>
      <View
        {...props}
        style={[
Ejemplo n.º 25
0
  onChange: React.PropTypes.func,
  //------------------------------------

  min: React.PropTypes.number,
  max: React.PropTypes.number,
  step: React.PropTypes.number,

  culture: React.PropTypes.string,

  format: CustomPropTypes.numberFormat,

  name: React.PropTypes.string,

  parse: React.PropTypes.func,

  disabled: React.PropTypes.oneOfType([React.PropTypes.bool, React.PropTypes.oneOf(['disabled'])]),

  readOnly: React.PropTypes.oneOfType([React.PropTypes.bool, React.PropTypes.oneOf(['readOnly'])]),

  messages: React.PropTypes.shape({
    increment: React.PropTypes.string,
    decrement: React.PropTypes.string
  })
};

var NumberPicker = React.createClass({

  displayName: 'NumberPicker',

  mixins: [require('./mixins/WidgetMixin'), require('./mixins/TimeoutMixin'), require('./mixins/PureRenderMixin'), require('./mixins/RtlParentContextMixin')],
Ejemplo n.º 26
0
StepLabel.propTypes = {
  /**
   * Sets active styling. Overrides disabled coloring.
   */
  active: _react.PropTypes.bool,
  /**
   * The label text node
   */
  children: _react.PropTypes.node,
  /**
   * Sets completed styling. Overrides disabled coloring.
   */
  completed: _react.PropTypes.bool,
  /**
   * Sets disabled styling.
   */
  disabled: _react.PropTypes.bool,
  /**
   * The icon displayed by the step label.
   */
  icon: _react.PropTypes.oneOfType([_react.PropTypes.element, _react.PropTypes.string, _react.PropTypes.number]),
  /**
   * Override the inline-style of the root element.
   */
  style: _react.PropTypes.object
};
StepLabel.contextTypes = {
  muiTheme: _react.PropTypes.object.isRequired,
  stepper: _react.PropTypes.object
};
exports.default = StepLabel;
Ejemplo n.º 27
0
    }
  };
}

var ReactCSSTransitionGroup = React.createClass({
  displayName: 'ReactCSSTransitionGroup',

  propTypes: {
    transitionName: React.PropTypes.oneOfType([
      React.PropTypes.string,
      React.PropTypes.shape({
        enter: React.PropTypes.string,
        leave: React.PropTypes.string,
        active: React.PropTypes.string,
      }),
      React.PropTypes.shape({
        enter: React.PropTypes.string,
        enterActive: React.PropTypes.string,
        leave: React.PropTypes.string,
        leaveActive: React.PropTypes.string,
        appear: React.PropTypes.string,
        appearActive: React.PropTypes.string,
      }),
    ]).isRequired,

    transitionAppear: React.PropTypes.bool,
    transitionEnter: React.PropTypes.bool,
    transitionLeave: React.PropTypes.bool,
    transitionAppearTimeout: createTransitionTimeoutPropValidator('Appear'),
    transitionEnterTimeout: createTransitionTimeoutPropValidator('Enter'),
    transitionLeaveTimeout: createTransitionTimeoutPropValidator('Leave'),
  },
Ejemplo n.º 28
0
  height: '100%',
};

const ResponsiveContainer = props => (
  <div className="recharts-responsive-container" style={style}>
    <ContainerDimensions>
      {
        container =>
          render({
            container,
            ...props,
          })
      }
    </ContainerDimensions>
  </div>
);

ResponsiveContainer.displayName = 'ResponsiveContainer';
ResponsiveContainer.propTypes = {
  width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
  height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
  children: PropTypes.node,
};

ResponsiveContainer.defaultProps = {
  width: '100%',
  height: '100%',
};

export default ResponsiveContainer;
var View = require('View');

var ensurePositiveDelayProps = require('ensurePositiveDelayProps');
var warning = require('fbjs/lib/warning');

var PRESS_RETENTION_OFFSET = { top: 20, left: 20, right: 20, bottom: 30 };

var TouchableWithoutFeedback = React.createClass({
  displayName: 'TouchableWithoutFeedback',

  mixins: [TimerMixin, Touchable.Mixin],

  propTypes: {
    accessible: React.PropTypes.bool,
    accessibilityComponentType: React.PropTypes.oneOf(View.AccessibilityComponentType),
    accessibilityTraits: React.PropTypes.oneOfType([React.PropTypes.oneOf(View.AccessibilityTraits), React.PropTypes.arrayOf(React.PropTypes.oneOf(View.AccessibilityTraits))]),

    disabled: React.PropTypes.bool,

    onPress: React.PropTypes.func,
    onPressIn: React.PropTypes.func,
    onPressOut: React.PropTypes.func,

    onLayout: React.PropTypes.func,

    onLongPress: React.PropTypes.func,

    delayPressIn: React.PropTypes.number,

    delayPressOut: React.PropTypes.number,
Ejemplo n.º 30
0
import React from 'react';
import debounce from 'lodash.debounce';
import {shouldComponentUpdate} from 'react/lib/ReactComponentWithPureRenderMixin';


export const DebounceInput = React.createClass({
  propTypes: {
    element: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.func]),
    type: React.PropTypes.string,
    onChange: React.PropTypes.func.isRequired,
    onKeyDown: React.PropTypes.func,
    onBlur: React.PropTypes.func,
    value: React.PropTypes.oneOfType([
      React.PropTypes.string,
      React.PropTypes.number
    ]),
    minLength: React.PropTypes.number,
    debounceTimeout: React.PropTypes.number,
    forceNotifyByEnter: React.PropTypes.bool,
    forceNotifyOnBlur: React.PropTypes.bool
  },


  getDefaultProps() {
    return {
      element: 'input',
      type: 'text',
      minLength: 0,
      debounceTimeout: 100,
      forceNotifyByEnter: true,
      forceNotifyOnBlur: true