Exemple #1
0
 PropTypes.arrayOf(PropTypes.oneOfType([
   // pie
   categoryAndValueXYType,
   // dist-bar
   PropTypes.shape({
     key: PropTypes.string,
     values: PropTypes.arrayOf(categoryAndValueXYType),
   }),
   // area, line, compare, bar
   PropTypes.shape({
     key: PropTypes.arrayOf(PropTypes.string),
     values: PropTypes.arrayOf(numericXYType),
   }),
   // dual-line
   PropTypes.shape({
     classed: PropTypes.string,
     key: PropTypes.string,
     type: PropTypes.string,
     values: PropTypes.arrayOf(numericXYType),
     yAxis: PropTypes.number,
   }),
   // box-plot
   PropTypes.shape({
     label: PropTypes.string,
     values: PropTypes.arrayOf(boxPlotValueType),
   }),
   // bubble
   PropTypes.shape({
     key: PropTypes.string,
     values: PropTypes.arrayOf(PropTypes.object),
   }),
 ])),
Exemple #2
0
import React from 'react';
import PropTypes from 'prop-types';

import styles from './selectInput.scss';

const SelectInput = ({
  label, options, onChange, name, value
}) =>
  <div className={styles.selectInputWrapper}>
    <label className={styles.selectInputLabel}>{label}</label>
    <select value={value} onChange={e => onChange(e.target.value, name)} name={name} className={styles.selectInput}>
      {options.map(option =>
        <option key={option.value} value={option.value}>{option.text}</option>)}
    </select>
  </div>;

SelectInput.propTypes = {
  label: PropTypes.string.isRequired,
  name: PropTypes.string.isRequired,
  value: PropTypes.string.isRequired,
  onChange: PropTypes.func.isRequired,
  options: PropTypes.arrayOf(PropTypes.shape({ value: PropTypes.string.isRequired, text: PropTypes.string.isRequired }))
};

export default SelectInput;
Exemple #3
0
      { store: this.store },
      React.createElement(
        SubPopupMenu,
        _extends({}, props, { ref: function ref(c) {
            return _this2.innerMenu = c;
          } }),
        this.props.children
      )
    );
  };

  return Menu;
}(React.Component);

Menu.propTypes = {
  defaultSelectedKeys: PropTypes.arrayOf(PropTypes.string),
  defaultActiveFirst: PropTypes.bool,
  selectedKeys: PropTypes.arrayOf(PropTypes.string),
  defaultOpenKeys: PropTypes.arrayOf(PropTypes.string),
  openKeys: PropTypes.arrayOf(PropTypes.string),
  mode: PropTypes.oneOf(['horizontal', 'vertical', 'vertical-left', 'vertical-right', 'inline']),
  getPopupContainer: PropTypes.func,
  onClick: PropTypes.func,
  onSelect: PropTypes.func,
  onDeselect: PropTypes.func,
  onDestroy: PropTypes.func,
  openTransitionName: PropTypes.string,
  openAnimation: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
  subMenuOpenDelay: PropTypes.number,
  subMenuCloseDelay: PropTypes.number,
  forceSubMenuRender: PropTypes.bool,
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 2.3px;
  user-select: none;

  ${({ menuPlacement }) => ((!menuPlacement || !menuPlacement.includes('hasDocked')) && ContainerNotDocked)}
  ${({ menuPlacement }) => (menuPlacement && menuPlacement.includes('hasDockedTop') && ContainerHorizontal)}
  ${({ menuPlacement }) => (menuPlacement && (menuPlacement.includes('hasDockedLeft') || menuPlacement.includes('hasDockedRight')) && ContainerVertical)}
  ${({ menuPlacement }) => (menuPlacement && (menuPlacement.includes('hasDockedRight')) && ContainerVerticalRight)}
`;

const Component = ({ children, menuPlacement }) => (
  <Container menuPlacement={menuPlacement}>
    { children }
  </Container>
);

Component.propTypes = {
  children: PropTypes.oneOfType([
    PropTypes.arrayOf(PropTypes.node),
    PropTypes.node,
  ]).isRequired,
  menuPlacement: PropTypes.string,
};

Component.defaultProps = {
  menuPlacement: undefined,
};

export default Component;
Exemple #5
0
      'body',
      null,
      e('div', { id: 'root', dangerouslySetInnerHTML: content }),
      ...elements
    )
  );
}

MainTemplate.defaultProps = {
  title: 'UNPKG',
  description: 'The CDN for everything on npm',
  favicon: '/favicon.ico',
  content: h(''),
  elements: []
};

if (process.env.NODE_ENV !== 'production') {
  const htmlType = PropTypes.shape({
    __html: PropTypes.string
  });

  MainTemplate.propTypes = {
    title: PropTypes.string,
    description: PropTypes.string,
    favicon: PropTypes.string,
    data: PropTypes.any,
    content: htmlType,
    elements: PropTypes.arrayOf(PropTypes.node)
  };
}
Exemple #6
0
          documentIds={this.props.documentIds}
          documents={this.props.documents}
          isEnabled={this.props.isEnabled}
          onPublishClick={this.handlePublishClick}
          onAction={this.handlePublishActions}
          onVisibilityChange={this.props.onVisibilityChange}
          revisions={this.props.revisions}
          isPreview={this.props.isPreview}
        />
      </TranslationProvider>
    );
  }
}

PublishContainer.propTypes = {
  documentIds: PropTypes.arrayOf(PropTypes.string),
  documents: PropTypes.arrayOf(PropTypes.object),
  isEnabled: PropTypes.bool,
  isPreview: PropTypes.bool,
  onAction: PropTypes.func,
  onPublishSuccess: PropTypes.func,
  onVisibilityChange: PropTypes.func,
  revisions: PropTypes.arrayOf(PropTypes.object)
};

function composer(props, onData) {
  const viewAs = Reaction.getUserPreferences("reaction-dashboard", "viewAs", "administrator");

  if (Array.isArray(props.documentIds) && props.documentIds.length) {
    const subscription = Meteor.subscribe("Revisions", props.documentIds);
Exemple #7
0
      <ReactModal
        isOpen={this.props.showSearchBox}
        onAfterOpen={this.onModalOpen}
        onRequestClose={this.props.onClose}
        style={modalStyle}
        contentLabel="Search"
        shouldReturnFocusAfterClose={false}
      >
        <FuzzySearch
          list={formatStories(this.props.stories)}
          onSelect={this.onSelect}
          keys={['value', 'type']}
          resultsTemplate={suggestionTemplate}
          innerRef={inputRef => {
            this.inputRef = inputRef;
          }}
        />
      </ReactModal>
    );
  }
}

SearchBox.defaultProps = { stories: [] };

SearchBox.propTypes = {
  showSearchBox: PropTypes.bool.isRequired,
  stories: PropTypes.arrayOf(PropTypes.object),
  onSelectStory: PropTypes.func.isRequired,
  onClose: PropTypes.func.isRequired,
};
  return {
    ...registrationPolicy,
    buckets: registrationPolicy.buckets.filter(bucket => bucket.key !== key),
  };
}

export function updateRegistrationPolicyBucket(registrationPolicy, key, newBucket) {
  const index = registrationPolicy.buckets.findIndex(bucket => bucket.key === key);

  if (index === -1) {
    return addRegistrationPolicyBucket(registrationPolicy, newBucket);
  }

  const newBuckets = [...registrationPolicy.buckets];
  newBuckets.splice(index, 1, newBucket);

  return {
    ...registrationPolicy,
    buckets: newBuckets,
  };
}

export function getRegistrationPolicyAnythingBucket(registrationPolicy) {
  return registrationPolicy.buckets.find(bucket => bucket.anything);
}

export const RegistrationPolicyPropType = PropTypes.shape({
  buckets: PropTypes.arrayOf(RegistrationPolicyBucketPropType.isRequired).isRequired,
  prevent_no_preference_signups: PropTypes.bool,
});
Exemple #9
0
const TopRibbon = ({tabNames, routeProps}) =>
  <ul className={`tabs`}>
    {
      tabNames.map((tabName) =>
        <li title={tabName} key={tabName} className={`tabs-title`}>
          <NavLink to={{pathname:`/${tabName}`, search: routeProps.location.search, hash: routeProps.location.hash}}
            activeStyle={{color: `#0a0a0a`, background: `#e6e6e6`}}>
            {tabName}
          </NavLink>
        </li>
      )}
  </ul>

TopRibbon.propTypes = {
  tabNames: PropTypes.arrayOf(PropTypes.string).isRequired,
  routeProps: PropTypes.shape(RoutePropTypes)
}


const TabContent = ({type, tabProps, commonProps, routeProps}) => {
  // Pass in the search from location
  const Tab = tabTypeComponent[type]

  return (
    Tab ? <Tab {...tabProps} {...commonProps} {...routeProps}/> : null
  )
}

TabContent.propTypes = {
  type: PropTypes.string.isRequired,
				<line shapeRendering="crispEdges" opacity={tickStrokeOpacity} stroke={tickStroke} x2={x2} y2={y2} />
				<text
					dy={dy} x={x} y={y}
					fill={tickStroke}
					fontSize={fontSize}
					fontFamily={fontFamily}
					textAnchor={textAnchor}>
					{this.props.children}
				</text>
			</g>
		);
	}
}

Tick.propTypes = {
	transform: PropTypes.arrayOf(Number),
	tickStroke: PropTypes.string,
	tickStrokeOpacity: PropTypes.number,
	textAnchor: PropTypes.string,
	fontSize: PropTypes.number,
	fontFamily: PropTypes.string,
	x: PropTypes.number,
	y: PropTypes.number,
	x2: PropTypes.number,
	y2: PropTypes.number,
	dy: PropTypes.string,
	children: PropTypes.node.isRequired,
};

Tick.drawOnCanvasStatic = (tick, ctx, result) => {
	const { scale, tickTransform, canvas_dy, x, y, x2, y2, format } = result;
                  <td className="text-center" style={{ minWidth: 80 }}>
                    {created || ''}
                  </td>
                  <td className="text-center" style={{ minWidth: 80 }}>
                    {wasted || '0'}
                  </td>
                  <td style={{ width: '25%', color: 'orange' }}>
                    {canBeImproved && ability.castEfficiency && ability.castEfficiency.suggestion && 'Can be improved.'}
                  </td>
                </tr>
              );
            })}
          </tbody>
        ))}
      </table>
    </div>
  );
};
PainComponent.propTypes = {
  abilities: PropTypes.arrayOf(PropTypes.shape({
    ability: PropTypes.shape({
      name: PropTypes.string.isRequired,
      category: PropTypes.string.isRequired,
      spellId: PropTypes.number.isRequired,
    }).isRequired,
  })).isRequired,
  categories: PropTypes.object,
};

export default PainComponent;
      {isUnstarted && renderStartingOverlay(department)}
      <img
        src={`/images/${service.image.split('.')[0]}_full.svg`}
        alt={service.title}
        className={imgCssClass}
      />
    </div>
  );
};

export default PartyLevelHeader;

PartyLevelHeader.propTypes = {
  service: PropTypes.shape({
    completeSections: PropTypes.number,
    departments: PropTypes.arrayOf(PropTypes.number),
    desc: PropTypes.string,
    image: PropTypes.string,
    index: PropTypes.number,
    percentChange: PropTypes.number,
    status: PropTypes.string,
    title: PropTypes.string,
  }).isRequired,
  services: PropTypes.arrayOf(PropTypes.object).isRequired,
  department: PropTypes.shape({
    amount: PropTypes.number,
    amount2015: PropTypes.number,
    deptId: PropTypes.number,
    description: PropTypes.string,
    explainYourSpending: PropTypes.string,
    lastYearAmount: PropTypes.number,
Exemple #13
0
  render() {
    return (
      <FormRow
        id={this.props.id}
        label={this.props.label}
        controlIndex={this.props.controlIndex}
        disableMsg={this.props.disableMsg}
      >
        {this.renderControl()}
      </FormRow>
    );
  }
}

const comboBoxOptionShape = PropTypes.shape({
  label: PropTypes.string.isRequired,
  value: PropTypes.string.isRequired,
});

ListControl.propTypes = {
  id: PropTypes.string.isRequired,
  label: PropTypes.string.isRequired,
  selectedOptions: PropTypes.arrayOf(comboBoxOptionShape).isRequired,
  options: PropTypes.arrayOf(comboBoxOptionShape).isRequired,
  disableMsg: PropTypes.string,
  multiselect: PropTypes.bool.isRequired,
  controlIndex: PropTypes.number.isRequired,
  stageFilter: PropTypes.func.isRequired
};
          onClick={() => onChange(op.value)}
        >
          <span>{op.text}</span>
        </label>
      ))}
    </div>
  );
};

// validateOption make sure every supplied option has the key "value" in it
const validateOption = (
  propValue,
  key,
  componentName,
  location,
  propFullName
) => {
  if (!propValue[key].hasOwnProperty("value")) {
    return new Error(`Invalid prop ${propFullName} passed to ${componentName}`);
  }
};

FancyRadioButton.propTypes = {
  options: PropTypes.arrayOf(validateOption).isRequired,
  value: PropTypes.any.isRequired,
  onChange: PropTypes.func.isRequired,
  style: PropTypes.object
};

export default FancyRadioButton;
 *   onChange={(event) => {
 *     this.setState({selectedIndex: event.nativeEvent.selectedSegmentIndex});
 *   }}
 * />
 * ````
 */
const SegmentedControlIOS = createReactClass({
  displayName: 'SegmentedControlIOS',
  mixins: [NativeMethodsMixin],

  propTypes: {
    ...DeprecatedViewPropTypes,
    /**
     * The labels for the control's segment buttons, in order.
     */
    values: PropTypes.arrayOf(PropTypes.string),

    /**
     * The index in `props.values` of the segment to be (pre)selected.
     */
    selectedIndex: PropTypes.number,

    /**
     * Callback that is called when the user taps a segment;
     * passes the segment's value as an argument
     */
    onValueChange: PropTypes.func,

    /**
     * Callback that is called when the user taps a segment;
     * passes the event as an argument
    const numbers = data.map(m => m.airTempAvg).filter(isFinite)
    const min = Math.min(...numbers)
    const max = Math.max(...numbers)

    return [
        Math.min(Math.floor(min / 10) * 10, -20),
        Math.max(Math.ceil(max / 10) * 10, 10),
    ]
}

function getLabels({ x, y, utcOffset }) {
    return `${y} °C\n${format(setUTCOffset(x, utcOffset), 'dddd, MMMM D, HH[h]')}`
}

Temperature.propTypes = {
    data: PropTypes.arrayOf(PropTypes.object),
    width: PropTypes.number.isRequired,
    height: PropTypes.number.isRequired,
}

export default function Temperature({ data, width, height }) {
    if (!shouldShowGraph(data, 'airTempAvg')) {
        return null
    }

    const airTempAvg = filterDataset(data, 'airTempAvg')
    const domain = computeDomain(data)

    return (
        <div>
            <h2>Air Temperature</h2>
    );
  }
}

UserChartsComponent.defaultProps = {
  loading: {},
};

UserChartsComponent.propTypes = {
  auth: PropTypes.shape({
    authenticated: PropTypes.bool,
    user: PropTypes.shape({
      userId: PropTypes.number,
    }),
  }).isRequired,
  charts: PropTypes.arrayOf(PropTypes.object).isRequired,
  getUserCharts: PropTypes.func.isRequired,
  loading: PropTypes.shape({
    isLoading: PropTypes.bool,
    error: PropTypes.string,
  }),
  setActiveNavTab: PropTypes.func.isRequired,
};

/**
 * @function mapStateToProps
 *
 * @param {object} state - Redux state.
 * @param {object} state.auth - Authentication state.
 * @param {object} state.charts - Metadata for charts for current user.
 * @returns {object} - auth and charts properties of state.
Exemple #18
0
import PropTypes from 'prop-types';
import React from 'react';
import ReactSelect from 'react-select';

const propTypes = {
  value: PropTypes.string,
  options: PropTypes.arrayOf(PropTypes.string).isRequired,
  onConditionChange: PropTypes.func.isRequired,
  setNextFocusRef: PropTypes.func.isRequired,
  onFocus: PropTypes.func.isRequired,
  onBlur: PropTypes.func.isRequired,
  isFocused: PropTypes.bool.isRequired,
  isLoadingOptions: PropTypes.bool.isRequired,
};

const defaultProps = {
  value: undefined,
};

class ConditionName extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      isMenuOpened: false,
    };
    this.handleFocus = this.handleFocus.bind(this);
    this.handleBlur = this.handleBlur.bind(this);
  }

  getMaxLengthOfOptions() {
    const { options } = this.props;
Exemple #19
0
        onMouseUp, // temp
      }) => (
        <LinkItem
          key={_id}
          {...{
            href,
            indicator,
            title,
            sequentialId,
            onMouseUp,
          }}
        />
      ))}
    </Field>
  </div>
);

LinkItemList.propTypes = {
  label: PropTypes.string.isRequired,
  items: PropTypes.arrayOf(PropTypes.shape({
    _id: PropTypes.string,
    title: PropTypes.string,
    sequentialId: PropTypes.string,
    status: PropTypes.number,
    href: PropTypes.string,
    indicator: PropTypes.string,
  })).isRequired,
};

export default LinkItemList;
Exemple #20
0
if (__DEV__) {
  Route.propTypes = {
    children: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
    component: (props, propName) => {
      if (props[propName] && !isValidElementType(props[propName])) {
        return new Error(
          `Invalid prop 'component' supplied to 'Route': the prop is not a valid React component`
        );
      }
    },
    exact: PropTypes.bool,
    location: PropTypes.object,
    path: PropTypes.oneOfType([
      PropTypes.string,
      PropTypes.arrayOf(PropTypes.string)
    ]),
    render: PropTypes.func,
    sensitive: PropTypes.bool,
    strict: PropTypes.bool
  };

  Route.prototype.componentDidMount = function() {
    warning(
      !(
        this.props.children &&
        !isEmptyChildren(this.props.children) &&
        this.props.component
      ),
      "You should not use <Route component> and <Route children> in the same route; <Route component> will be ignored"
    );
        onChange={this.onChange}
        inputProps={{ className: 'no-change-track' }}
        {...optionAttributes}
      />
    );
  }
}

TagField.propTypes = {
  name: PropTypes.string.isRequired,
  labelKey: PropTypes.string.isRequired,
  valueKey: PropTypes.string.isRequired,
  lazyLoad: PropTypes.bool.isRequired,
  creatable: PropTypes.bool.isRequired,
  multi: PropTypes.bool.isRequired,
  disabled: PropTypes.bool,
  options: PropTypes.arrayOf(PropTypes.object),
  optionUrl: PropTypes.string,
  value: PropTypes.any,
  onChange: PropTypes.func,
  onBlur: PropTypes.func,
};

TagField.defaultProps = {
  labelKey: 'Title',
  valueKey: 'Value',
  disabled: false
};

export default TagField;
                        anchorEl={anchorEl}
                        onClose={this.handleRequestClose}
                    >
                        {hiddenFilters.map(filterElement => (
                            <FilterButtonMenuItem
                                key={filterElement.props.source}
                                filter={filterElement.props}
                                resource={resource}
                                onShow={this.handleShow}
                            />
                        ))}
                    </Menu>
                </div>
            )
        );
    }
}

FilterButton.propTypes = {
    resource: PropTypes.string.isRequired,
    filters: PropTypes.arrayOf(PropTypes.node).isRequired,
    displayedFilters: PropTypes.object.isRequired,
    filterValues: PropTypes.object.isRequired,
    showFilter: PropTypes.func.isRequired,
    translate: PropTypes.func.isRequired,
    classes: PropTypes.object,
    className: PropTypes.string,
};

export default compose(translate, withStyles(styles))(FilterButton);
Exemple #23
0
import PropTypes from 'prop-types';
import { propType } from 'graphql-anywhere';

import FeedEntry from './FeedEntry';
import ErrorBoundary from './Error';

const Feed = ({ entries = [], loggedIn, onVote, onLoadMore }) => {
  if (entries && entries.length) {
    return (
      <div>
        {entries.filter(x => x && x.repository).map(entry => (
          <ErrorBoundary key={entry.repository.full_name}>
            <FeedEntry entry={entry} loggedIn={loggedIn} onVote={onVote} />
          </ErrorBoundary>
        ))}
        <button onClick={onLoadMore}>Load more</button>
      </div>
    );
  }
  return <div />;
};

Feed.propTypes = {
  entries: PropTypes.arrayOf(propType(FeedEntry.fragments.entry).isRequired),
  loggedIn: PropTypes.bool.isRequired,
  onVote: PropTypes.func.isRequired,
  onLoadMore: PropTypes.func.isRequired,
};

export default Feed;
Exemple #24
0
    * You can provide one type or an array of many types.
    *
    * Possible values for `dataDetectorTypes` are:
    *
    * - `'phoneNumber'`
    * - `'link'`
    * - `'address'`
    * - `'calendarEvent'`
    * - `'none'`
    * - `'all'`
    *
    * @platform ios
    */
   dataDetectorTypes: PropTypes.oneOfType([
     PropTypes.oneOf(DataDetectorTypes),
     PropTypes.arrayOf(PropTypes.oneOf(DataDetectorTypes)),
   ]),
   /**
    * If `true`, caret is hidden. The default value is `false`.
    */
   caretHidden: PropTypes.bool,
 },
 getDefaultProps(): Object {
   return {
     allowFontScaling: true,
   };
 },
 /**
  * `NativeMethodsMixin` will look for this when invoking `setNativeProps`. We
  * make `this` look like an actual native component class.
  */
        const { basePath, startUndoable, resource, selectedIds } = this.props;
        startUndoable(
            crudUpdateMany(
                resource,
                selectedIds,
                { status: 'rejected' },
                basePath
            )
        );
        this.props.onExit();
    };

    render() {
        return null;
    }
}

BulkRejectAction.propTypes = {
    basePath: PropTypes.string,
    label: PropTypes.string,
    onExit: PropTypes.func.isRequired,
    resource: PropTypes.string.isRequired,
    selectedIds: PropTypes.arrayOf(PropTypes.any).isRequired,
    startUndoable: PropTypes.func.isRequired,
};

export default connect(
    undefined,
    { startUndoable }
)(BulkRejectAction);
 outboundSmsPermission: PropTypes.bool,
 internalSmsPermission: PropTypes.bool,
 isLoggedContact: PropTypes.func,
 onLogCall: PropTypes.func,
 webphoneAnswer: PropTypes.func,
 webphoneReject: PropTypes.func,
 webphoneHangup: PropTypes.func,
 webphoneResume: PropTypes.func,
 webphoneToVoicemail: PropTypes.func,
 autoLog: PropTypes.bool,
 onViewContact: PropTypes.func,
 enableContactFallback: PropTypes.bool,
 loggingMap: PropTypes.object,
 onCallsEmpty: PropTypes.func,
 sourceIcons: PropTypes.object,
 calls: PropTypes.arrayOf(PropTypes.any).isRequired,
 onClickToDial: PropTypes.func,
 disableLinks: PropTypes.bool.isRequired,
 disableClickToDial: PropTypes.bool,
 dateTimeFormatter: PropTypes.func.isRequired,
 active: PropTypes.bool,
 renderContactName: PropTypes.func,
 renderExtraButton: PropTypes.func,
 contactDisplayStyle: PropTypes.string,
 activeContactDisplayStyle: PropTypes.string,
 currentLog: PropTypes.object,
 onCloseLogSection: PropTypes.func,
 onUpdateCallLog: PropTypes.func,
 onSaveCallLog: PropTypes.func,
 renderEditLogSection: PropTypes.func,
 renderSaveLogButton: PropTypes.func,
Exemple #27
0
            onclick: id => onItemClick(id),
            onmouseover: id => this.setChartFocus(id),
            onmouseout: () => this.updateChartFocus(),
          },
        }}
      />
    );
  }
}

TasksDonutChart.propTypes = {
  last: PropTypes.number.isRequired,
  older: PropTypes.number.isRequired,
  className: PropTypes.string,
  time: PropTypes.string,
  colorsPattern: PropTypes.arrayOf(PropTypes.string),
  focusedOn: PropTypes.oneOf(TASKS_DONUT_CHART_FOCUSED_ON_OPTIONS_ARRAY),
  onTotalClick: PropTypes.func,
  onLastClick: PropTypes.func,
  onOlderClick: PropTypes.func,
};

TasksDonutChart.defaultProps = {
  className: '',
  time: '24h',
  colorsPattern: COLLOR_PATTERN,
  focusedOn: TASKS_DONUT_CHART_FOCUSED_ON_OPTIONS.NORMAL,
  onTotalClick: () => null,
  onLastClick: () => null,
  onOlderClick: () => null,
};
Exemple #28
0
import { shape, string, number, object, func, oneOf, oneOfType, arrayOf, element } from 'prop-types'

export const errorType = shape({
  id: string.isRequired,
  message: string.isRequired,
})

export const validatorsType = arrayOf(
  shape({
    type: string.isRequired,
    message: string.isRequired,
    val: oneOfType([string, number]),
  })
)

export const optionsType = arrayOf(
  shape({
    id: oneOfType([number, string]).isRequired,
    label: string.isRequired,
  })
)

export const fieldType = shape({
  id: string,
  component: func.isRequired,
  props: object,
  error: errorType,
  value: oneOfType([string, number]),
})

export const columnType = shape({
Exemple #29
0
import PropTypes from 'prop-types';

export default {
  activeIndex: PropTypes.number,
  max: PropTypes.number.isRequired,
  min: PropTypes.number.isRequired,
  onActivate: PropTypes.func.isRequired,
  series: PropTypes.arrayOf(PropTypes.shape({
    label: PropTypes.string, // used in Spiral
    value: PropTypes.number.isRequired,
    colorIndex: PropTypes.string,
    onClick: PropTypes.func
  })).isRequired,
  stacked: PropTypes.bool,
  thresholds: PropTypes.arrayOf(PropTypes.shape({
    value: PropTypes.number.isRequired,
    colorIndex: PropTypes.string
  })).isRequired,
  total: PropTypes.number.isRequired,
  vertical: PropTypes.bool
};
Exemple #30
0
      }}
    />
  )
}

SEO.defaultProps = {
  lang: `en`,
  meta: [],
  keywords: [],
}

SEO.propTypes = {
  description: PropTypes.string,
  lang: PropTypes.string,
  meta: PropTypes.array,
  keywords: PropTypes.arrayOf(PropTypes.string),
  title: PropTypes.string.isRequired,
}

export default SEO

const detailsQuery = graphql`
  query DefaultSEOQuery {
    site {
      siteMetadata {
        title
        description
        author
      }
    }
  }