* @function FormattedDate
 * @param {object} props - Props handed to component.
 * @returns {JSX.Element} - JSX for component.
 */
const FormattedDate = (props) => {
  let { format } = props;
  if (!format) {
    // leave off year if it's this year
    const currentYear = new Date().getFullYear().toString();
    const dateYear = moment(props.date).format('YYYY');
    const year = (dateYear === currentYear) ? '' : 'YYYY, ';
    format = `MMM D, ${year}h:mm a`;
  }
  const formattedDate = moment(props.date).format(format);
  return (<span className="formatted-date">{formattedDate}</span>);
};

FormattedDate.defaultProps = {
  format: undefined,
};

FormattedDate.propTypes = {
  format: PropTypes.string,
  date: PropTypes.oneOfType([
    PropTypes.instanceOf(Date),
    PropTypes.string,
  ]).isRequired,
};

export default FormattedDate;
Ejemplo n.º 2
0
      data-for={quarter.time.toString()}
    >
      {ToolTip(quarter, heatMapMode)}
    </div>
  );
};

CellGrid.defaultProps = {
  backgroundColors: ['transparent'],
  rowIndex: 0,
  columnIndex: 0,
  heightlightedUser: '',
  disable: false,
};

CellGrid.propTypes = {
  onMouseOver: PropTypes.func.isRequired,
  onMouseLeave: PropTypes.func.isRequired,
  onMouseDown: PropTypes.func.isRequired,
  onMouseUp: PropTypes.func.isRequired,
  heatMapMode: PropTypes.bool.isRequired,
  quarter: PropTypes.shape({
    time: PropTypes.instanceOf(Date).isRequired,
    participants: PropTypes.arrayOf(PropTypes.shape({ id: PropTypes.string })).isRequired,
    notParticipants: PropTypes.arrayOf(PropTypes.shape({ id: PropTypes.string })).isRequired,
    disable: PropTypes.bool,
  }).isRequired,
};

export default cssModules(CellGrid, styles, { allowMultiple: true });
Ejemplo n.º 3
0
    } else if (!this.props.open && nextProps.open) {
      this.plugin.openModal()
    }
  }

  render () {
    return h('div', {
      ref: (container) => {
        this.container = container
      }
    })
  }
}

DashboardModal.propTypes = {
  uppy: PropTypes.instanceOf(UppyCore).isRequired,
  open: PropTypes.bool,
  onRequestClose: PropTypes.func,
  plugins: PropTypes.arrayOf(PropTypes.string),
  width: PropTypes.number,
  height: PropTypes.number,
  semiTransparent: PropTypes.bool,
  showProgressDetails: PropTypes.bool,
  hideUploadButton: PropTypes.bool,
  note: PropTypes.string,
  locale: PropTypes.object
}

DashboardModal.defaultProps = {
}
Ejemplo n.º 4
0
          </div>
          <GymSearchBar
            placeholder={"Search for a class"}
            onSearch={this.onSearch}
            onSuggest={this.onSuggest}
          />
          <GymClassTable
            classes={this.state.classes}
            savedClasses={this.state.savedClasses}
            editable={this.props.auth.isLoggedIn() ? true : false}
            addClass={this.addClass}
            deleteClass={this.deleteClass}
            mode={"save"}
          />
          {this.props.auth.isLoggedIn()
            ? <RecommendedClasses
                addClass={this.addClass}
                deleteClass={this.deleteClass}
              />
            : null}
        </div>
        <Alert stack={{ limit: 5, spacing: 5 }} offset={60} />
      </div>
    );
  }
}
export default Search;
Search.PropTypes = {
  auth: PropTypes.instanceOf(Auth)
};
Ejemplo n.º 5
0
 /**
  * An instance of `DocumentSelectionState`, this is some state that is responsible for
  * maintaining selection information for a document.
  *
  * Some functionality that can be performed with this instance is:
  *
  * - `blur()`
  * - `focus()`
  * - `update()`
  *
  * > You can reference `DocumentSelectionState` in
  * > [`vendor/document/selection/DocumentSelectionState.js`](https://github.com/facebook/react-native/blob/master/Libraries/vendor/document/selection/DocumentSelectionState.js)
  *
  * @platform ios
  */
 selectionState: PropTypes.instanceOf(DocumentSelectionState),
 /**
  * The start and end of the text input's selection. Set start and end to
  * the same value to position the cursor.
  */
 selection: PropTypes.shape({
   start: PropTypes.number.isRequired,
   end: PropTypes.number,
 }),
 /**
  * The value to show for the text input. `TextInput` is a controlled
  * component, which means the native value will be forced to match this
  * value prop if provided. For most uses, this works great, but in some
  * cases this may cause flickering - one common cause is preventing edits
  * by keeping value the same. In addition to simply setting the same value,
  * either set `editable={false}`, or set/update `maxLength` to prevent
Ejemplo n.º 6
0
                    </Card>)
                }
            </Motion>);

    }

    renderText() {
        return (
            <Card>
                <Card.Content>
                    <Title onTitleChange={this.onTitleChanged} onTodoStatusChange={this.onStatusChanged}
                           isComplete={this.props.todoItem.isCompleted} title={this.props.todoItem.title}/>
                </Card.Content>
            </Card>
        );
    }


}

TodoComponent.propTypes = {
    todoItem: PropTypes.instanceOf(TodoItem).isRequired,
    displayStyle: PropTypes.oneOf(Utils.values(Constants.TODO_DISPLAY_STYLE)),
    onTodoUpdated: PropTypes.func,
};

TodoComponent.defaultProps = {
    displayStyle: Constants.TODO_DISPLAY_STYLE.TITLE_ONLY,
};

export default TodoComponent;
Ejemplo n.º 7
0
      return (
        <li className="item">
          <Spinner/>
        </li>
      )
    } else {
      return (
        <li className="item">
          <h4>{this.state.item.title}</h4>
          <span>{this.state.item.score} point{this.state.item.score > 1 ? 's' : ''}</span>
          <span>by <Link to={`/user/${this.state.item.by}`}>{this.state.item.by}</Link></span>
        </li>
      )
    }
  }
}

Item.propTypes = {
  id: PropTypes.number,
  index: PropTypes.number,
  cachedItem: PropTypes.object,
  store: PropTypes.instanceOf(ItemStore).isRequired,
}

Item.defaultProps = {
  id: null,
  index: null,
  cachedItem: null
}

Ejemplo n.º 8
0
        id={'setting.verses'}
        defaultMessage={'Go to verse'}
      />
    );

    return (
      <StyledDropdown
        className={`dropdown ${className}`}
        id="verses-dropdown"
        title={title}
      >
        {this.renderMenu()}
      </StyledDropdown>
    );
  }
}

VersesDropdown.propTypes = {
  loadedVerses: PropTypes.instanceOf(Set).isRequired,
  chapter: customPropTypes.chapterType.isRequired, // Set
  onClick: PropTypes.func.isRequired,
  isReadingMode: PropTypes.bool,
  className: PropTypes.string
};

VersesDropdown.defaultProps = {
  className: ''
};

export default VersesDropdown;
import ReactDOM from "react-dom";
import PropTypes from 'prop-types';

/**
 * Render children using a Portal
 *
 * @see https://reactjs.org/docs/portals.html
 *
 * @since 1.8.0
 *
 * @param props
 * @return {{$$typeof, key, children, containerInfo, implementation}}
 * @constructor
 */
export const RenderComponentViaPortal = (props) => {
	const {children,domNode} = props;
	return ReactDOM.createPortal(
		children,
		domNode
	);
};

/**
 * Prop type definitions for a RenderComponentViaPortal component
 *
 * @type {{children: (e|*), domNode: (e|*)}}
 */
RenderComponentViaPortal.propTypes = {
	children: PropTypes.any.isRequired,
	domNode: PropTypes.instanceOf(Element).isRequired
};
Ejemplo n.º 10
0
                </p>
            );
        }

        return (
            <React.Fragment>
                {maybeCurrencySelector}
                {currencyCharts}
            </React.Fragment>
        );
    }
}

InOutChart.propTypes = {
    // The transactions per currencies.
    currencyToTransactions: PropTypes.instanceOf(Map).isRequired,

    // The current theme.
    theme: PropTypes.string.isRequired
};

const Export = connect((state, ownProps) => {
    let currentAccountIds = get.accountIdsByAccessId(state, ownProps.accessId);

    let currencyToTransactions = new Map();
    for (let accId of currentAccountIds) {
        let currency = get.accountById(state, accId).currency;
        if (!currencyToTransactions.has(currency)) {
            currencyToTransactions.set(currency, []);
        }
        let transactions = get.operationsByAccountId(state, accId);
Ejemplo n.º 11
0
}

ServiceTreeView.contextTypes = {
  modalHandlers: PropTypes.shape({
    createGroup: PropTypes.func
  }).isRequired,
  router: routerShape
};

ServiceTreeView.defaultProps = {
  onFilterExpressionChange() {},
  isEmpty: false
};

ServiceTreeView.propTypes = {
  filters: PropTypes.instanceOf(DSLFilterList).isRequired,
  filterExpression: PropTypes.instanceOf(DSLExpression).isRequired,
  isEmpty: PropTypes.bool,
  children: PropTypes.node,
  onFilterExpressionChange: PropTypes.func,
  services: PropTypes.arrayOf(
    PropTypes.oneOfType([
      PropTypes.instanceOf(Service),
      PropTypes.instanceOf(ServiceTree)
    ])
  ).isRequired,
  serviceTree: PropTypes.instanceOf(ServiceTree)
};

module.exports = ServiceTreeView;
Ejemplo n.º 12
0
                      checked={data[regionName]}
                      disabled={!enabled}
                      name={regionName}
                      type="checkbox"
                    />
                    {region}
                  </FieldLabel>
                </FormGroup>
              );
            })}
          </div>
        </div>
      </DSLFormWithExpressionUpdates>
    );
  }
}

NodeRegionDSLSection.defaultProps = {
  onChange() {},
  expression: new DSLExpression(""),
  defaultData: { regions: [] }
};

NodeRegionDSLSection.propTypes = {
  onChange: PropTypes.func.isRequired,
  expression: PropTypes.instanceOf(DSLExpression).isRequired,
  defaultData: PropTypes.object.isRequired
};

module.exports = NodeRegionDSLSection;
Ejemplo n.º 13
0
          'is-active': this.props.activeSection === key
        },
        val.label.replace(/\s+/g, '-').toLowerCase()
      );
      links.push(
        <li
          className={classes}
          key={key}
          onClick={this._changeState.bind(this, key)}
          role="button">
          {val.label}
        </li>
      );
    });

    return (
      <div className="profile-navigation">
        <ul className="p-list">{links}</ul>
      </div>
    );
  }
}

ProfileNavigation.propTypes = {
  activeSection: PropTypes.string.isRequired,
  changeState: PropTypes.func.isRequired,
  sectionsMap: PropTypes.instanceOf(Map).isRequired
};

module.exports = ProfileNavigation;
Ejemplo n.º 14
0
   })),
 }),
 enumFields: PropTypes.shape({
   stringEnum: PropTypes.oneOf([
     'foo',
     'bar',
     'baz',
   ]),
   intEnum: PropTypes.oneOf([
     1,
     2,
     3,
   ]),
 }),
 instanceFields: PropTypes.shape({
   instOf: PropTypes.instanceOf(ShapeClassName),
   instanceOf: PropTypes.instanceOf(ShapeDefault),
 }),
 objectFields: PropTypes.shape({
   numberObj: PropTypes.objectOf(PropTypes.number),
   boolObject: PropTypes.objectOf(PropTypes.bool),
   intStringObject: PropTypes.objectOf(PropTypes.string),
   unionObject: PropTypes.objectOf(PropTypes.oneOfType([
     PropTypes.number,
     PropTypes.string,
     PropTypes.shape({
       foo: PropTypes.string,
     }),
   ])).isRequired,
 }),
 unionFields: PropTypes.shape({