path
stringlengths
5
296
repo_name
stringlengths
5
85
content
stringlengths
25
1.05M
pootle/static/js/auth/components/SocialAuthError.js
Avira/pootle
/* * Copyright (C) Pootle contributors. * * This file is a part of the Pootle project. It is distributed under the GPL3 * or later license. See the LICENSE file for a copy of the license and the * AUTHORS file for copyright and authorship information. */ 'use strict'; import React from 'react'; import { PureRenderMixin } from 'react/addons'; import AuthContent from './AuthContent'; let SocialAuthError = React.createClass({ mixins: [PureRenderMixin], propTypes: { socialError: React.PropTypes.object, }, /* Layout */ render() { let errorMsg; if (this.props.socialError) { errorMsg = interpolate( gettext('An error occurred while attempting to sign in via %s.'), [this.props.socialError.provider] ); } else { errorMsg = gettext('An error occurred while attempting to sign in via your social account.'); } let errorFace = { fontSize: '400%', marginBottom: '0.5em', }; return ( <AuthContent> <h2 style={errorFace}>{`{õ_õ}`}</h2> <p>{errorMsg}</p> {this.props.socialError && <p>{`${this.props.socialError.exception.name}: ${this.props.socialError.exception.msg} `}</p> } {this.props.socialError && <a href={this.props.socialError.retry_url}> {gettext('Try again')} </a> } </AuthContent> ); } }); export default SocialAuthError;
docs/src/pages/layout/hidden/GridIntegration.js
dsslimshaddy/material-ui
// @flow weak import React from 'react'; import PropTypes from 'prop-types'; import compose from 'recompose/compose'; import { withStyles } from 'material-ui/styles'; import Paper from 'material-ui/Paper'; import Grid from 'material-ui/Grid'; import withWidth from 'material-ui/utils/withWidth'; import Typography from 'material-ui/Typography'; const styles = theme => ({ root: { flexGrow: 1, paddingTop: 42, position: 'relative', }, paper: { padding: 16, textAlign: 'center', color: theme.palette.text.secondary, minHeight: 54, }, typography: { position: 'absolute', left: 0, top: 0, padding: 5, }, }); function GridIntegration(props) { const classes = props.classes; return ( <div className={classes.root}> <Typography type="subheading" className={classes.typography}> Current width: {props.width} </Typography> <Grid container spacing={24}> <Grid item xs hidden={{ xsUp: true }}> <Paper className={classes.paper}>xsUp</Paper> </Grid> <Grid item xs hidden={{ smUp: true }}> <Paper className={classes.paper}>smUp</Paper> </Grid> <Grid item xs hidden={{ mdUp: true }}> <Paper className={classes.paper}>mdUp</Paper> </Grid> <Grid item xs hidden={{ lgUp: true }}> <Paper className={classes.paper}>lgUp</Paper> </Grid> <Grid item xs hidden={{ xlUp: true }}> <Paper className={classes.paper}>xlUp</Paper> </Grid> </Grid> </div> ); } GridIntegration.propTypes = { classes: PropTypes.object.isRequired, width: PropTypes.string, }; export default compose(withStyles(styles), withWidth())(GridIntegration);
src/screens/Shared/SearchFilterModal.js
alphasp/pxview
/* eslint-disable camelcase */ import React, { Component } from 'react'; import { StyleSheet, View, SafeAreaView } from 'react-native'; import { connect } from 'react-redux'; import qs from 'qs'; import { withTheme, Button } from 'react-native-paper'; import { connectLocalization } from '../../components/Localization'; import PXListItem from '../../components/PXListItem'; import SingleChoiceDialog from '../../components/SingleChoiceDialog'; import SearchIllustsBookmarkRangesPickerDialog from '../../components/SearchIllustsBookmarkRangesPickerDialog'; import SearchNovelsBookmarkRangesPickerDialog from '../../components/SearchNovelsBookmarkRangesPickerDialog'; import { SEARCH_TYPES, SEARCH_PERIOD_TYPES, SCREENS, } from '../../common/constants'; import { globalStyles, globalStyleVariables } from '../../styles'; const styles = StyleSheet.create({ listContainer: { flex: 1, }, searchFilterButtonContainer: { padding: 10, }, searchFilterButton: { backgroundColor: globalStyleVariables.PRIMARY_COLOR, padding: 10, alignItems: 'center', }, searchFilterButtonText: { color: '#fff', }, }); class SearchFilterModal extends Component { constructor(props) { super(props); const { searchFilter: { search_target, period, sort, start_date, end_date, bookmark_num_min, bookmark_num_max, bookmarkCountsTag, }, } = props.route.params; this.state = { target: search_target || 'partial_match_for_tags', period: period || SEARCH_PERIOD_TYPES.ALL, bookmarkCountsTag: bookmarkCountsTag || '', sort: sort || 'date_desc', startDate: start_date, endDate: end_date, likes: this.getSelectedLikesFilterValue( bookmark_num_min, bookmark_num_max, ), bookmarkNumMin: bookmark_num_min, bookmarkNumMax: bookmark_num_max, selectedFilterType: null, selectedPickerValue: null, filterList: this.getFilterList(true), }; } getFilterList = (init) => { const { i18n, user, route } = this.props; // const { startDate, endDate } = this.state; const { searchFilter: { start_date, end_date }, searchType, } = route.params; let targetOptions; if (searchType === SEARCH_TYPES.ILLUST) { targetOptions = [ { value: 'partial_match_for_tags', label: i18n.searchTargetTagPartial, }, { value: 'exact_match_for_tags', label: i18n.searchTargetTagExact, }, { value: 'title_and_caption', label: i18n.searchTargetTitleCaption, }, ]; } else { targetOptions = [ { value: 'partial_match_for_tags', label: i18n.searchTargetTagPartial, }, { value: 'exact_match_for_tags', label: i18n.searchTargetTagExact, }, { value: 'text', label: i18n.searchTargetText, }, { value: 'keyword', label: i18n.searchTargetKeyword, }, ]; } const bookmarkCountsTagOptions = [ { value: '', label: i18n.searchBookmarkCountsTagAll, }, { value: '100users入り', label: '100users入り', }, { value: '500users入り', label: '500users入り', }, { value: '1000users入り', label: '1000users入り', }, { value: '5000users入り', label: '5000users入り', }, { value: '10000users入り', label: '10000users入り', }, { value: '30000users入り', label: '30000users入り', }, { value: '50000users入り', label: '50000users入り', }, { value: '100000users入り', label: '100000users入り', }, ]; const extraPeriodOption = {}; if (init) { if (start_date && end_date) { extraPeriodOption.value = SEARCH_PERIOD_TYPES.CUSTOM_DATE; extraPeriodOption.label = `${start_date} - ${end_date}`; } } else if (this.state.startDate && this.state.endDate) { extraPeriodOption.value = SEARCH_PERIOD_TYPES.CUSTOM_DATE; extraPeriodOption.label = `${this.state.startDate} - ${this.state.endDate}`; } let periodOptions = [ { value: SEARCH_PERIOD_TYPES.ALL, label: i18n.searchPeriodAll, }, { value: SEARCH_PERIOD_TYPES.LAST_DAY, label: i18n.searchPeriodLastDay, }, { value: SEARCH_PERIOD_TYPES.LAST_WEEK, label: i18n.searchPeriodLastWeek, }, { value: SEARCH_PERIOD_TYPES.LAST_MONTH, label: i18n.searchPeriodLastMonth, }, { value: SEARCH_PERIOD_TYPES.LAST_HALF_YEAR, label: i18n.searchPeriodLastHalfYear, }, { value: SEARCH_PERIOD_TYPES.LAST_YEAR, label: i18n.searchPeriodLastYear, }, { value: SEARCH_PERIOD_TYPES.DATE, label: i18n.searchPeriodSpecifyDate, }, ]; if (extraPeriodOption.value) { periodOptions = [extraPeriodOption, ...periodOptions]; } const filterOptions = [ { key: 'target', options: targetOptions, }, { key: 'period', options: periodOptions, }, { key: 'bookmarkCountsTag', options: bookmarkCountsTagOptions, }, { key: 'sort', options: [ { value: 'date_desc', label: i18n.searchOrderNewest, }, { value: 'date_asc', label: i18n.searchOrderOldest, }, { value: 'popularity', label: i18n.searchOrderPopularity, }, ], }, ]; if (user.is_premium) { filterOptions.push({ key: 'likes', options: [ { value: null, label: i18n.searchLikesAll, }, ], }); } return filterOptions; }; getSearchTypeName = (type) => { const { i18n } = this.props; switch (type) { case 'target': return i18n.searchTarget; case 'bookmarkCountsTag': return i18n.searchBookmarkCountsTag; case 'period': return i18n.searchPeriod; case 'sort': return i18n.searchOrder; case 'likes': return i18n.searchLikes; default: return ''; } }; getSelectedFilterName = (key, options) => { if (key !== 'likes') { return options.find((o) => o.value === this.state[key]).label; } const { bookmarkNumMin, bookmarkNumMax } = this.state; if (!bookmarkNumMin && !bookmarkNumMax) { const { i18n } = this.props; return i18n.searchLikesAll; } if (!bookmarkNumMax) { return `${bookmarkNumMin}+`; } return `${bookmarkNumMin} - ${bookmarkNumMax}`; }; getSelectedLikesFilterValue = (bookmarkNumMin, bookmarkNumMax) => { if (!bookmarkNumMin && !bookmarkNumMax) { return ''; } if (!bookmarkNumMax) { return `bookmarkNumMin=${bookmarkNumMin}`; } return `bookmarkNumMin=${bookmarkNumMin}&bookmarkNumMax=${bookmarkNumMax}`; }; handleOnPressFilterOption = (filterType) => { const value = this.state[filterType]; this.setState({ selectedFilterType: filterType, selectedPickerValue: value, }); }; handleOnOkPickerDialog = (value) => { const { selectedFilterType, startDate, endDate } = this.state; if (selectedFilterType === 'period') { if (value === SEARCH_PERIOD_TYPES.DATE) { const { navigate } = this.props.navigation; navigate(SCREENS.SearchFilterPeriodDateModal, { onConfirmPeriodDate: this.handleOnConfirmPeriodDate, startDate, endDate, }); this.setState({ selectedFilterType: null, }); } else { this.setState({ [selectedFilterType]: value, selectedPickerValue: value, selectedFilterType: null, startDate: null, endDate: null, }); } } else { const newState = { [selectedFilterType]: value, selectedPickerValue: value, selectedFilterType: null, }; if (selectedFilterType === 'likes') { if (value) { const { bookmarkNumMin, bookmarkNumMax } = qs.parse(value); newState.bookmarkNumMin = bookmarkNumMin; newState.bookmarkNumMax = bookmarkNumMax; } else { newState.bookmarkNumMin = null; newState.bookmarkNumMax = null; } } this.setState(newState); } }; handleOnCancelPickerDialog = () => { this.setState({ selectedFilterType: null, }); }; handleOnConfirmPeriodDate = (startDate, endDate) => { const { goBack } = this.props.navigation; goBack(null); this.setState( { startDate, endDate, }, () => { this.setState({ filterList: this.getFilterList(), period: SEARCH_PERIOD_TYPES.CUSTOM_DATE, selectedPickerValue: SEARCH_PERIOD_TYPES.CUSTOM_DATE, }); }, ); }; handleOnPressApplyFilter = () => { const { navigation: { navigate }, } = this.props; const { target, period, sort, startDate, endDate, bookmarkNumMin, bookmarkNumMax, bookmarkCountsTag, } = this.state; navigate(SCREENS.SearchResult, { target, period, sort, startDate, endDate, bookmarkNumMin, bookmarkNumMax, bookmarkCountsTag, }); }; render() { const { i18n, navigationStateKey, route, theme } = this.props; const { word, searchType } = route.params; const { selectedFilterType, selectedPickerValue, filterList, searchTarget, period, startDate, endDate, } = this.state; return ( <SafeAreaView style={[ globalStyles.container, { backgroundColor: theme.colors.background }, ]} > <View style={styles.listContainer}> {filterList.map((list) => ( <PXListItem key={list.key} title={this.getSearchTypeName(list.key)} description={this.getSelectedFilterName(list.key, list.options)} onPress={() => this.handleOnPressFilterOption(list.key)} /> ))} </View> <View style={styles.searchFilterButtonContainer}> <Button mode="contained" onPress={this.handleOnPressApplyFilter}> {i18n.searchApplyFilter} </Button> </View> {selectedFilterType && selectedFilterType !== 'likes' && ( <SingleChoiceDialog title={this.getSearchTypeName(selectedFilterType)} items={filterList .find((f) => f.key === selectedFilterType) .options.map((option) => ({ value: option.value, label: option.label, }))} visible scrollable selectedItemValue={selectedPickerValue} onPressCancel={this.handleOnCancelPickerDialog} onPressOk={this.handleOnOkPickerDialog} /> )} {selectedFilterType === 'likes' && searchType === SEARCH_TYPES.ILLUST && ( <SearchIllustsBookmarkRangesPickerDialog navigationStateKey={navigationStateKey} word={word} searchOptions={{ search_target: searchTarget, period, start_date: startDate, end_date: endDate, }} selectedItemValue={selectedPickerValue} onPressCancel={this.handleOnCancelPickerDialog} onPressOk={this.handleOnOkPickerDialog} /> )} {selectedFilterType === 'likes' && searchType === SEARCH_TYPES.NOVEL && ( <SearchNovelsBookmarkRangesPickerDialog navigationStateKey={navigationStateKey} word={word} searchOptions={{ search_target: searchTarget, period, start_date: startDate, end_date: endDate, }} selectedItemValue={selectedPickerValue} onPressCancel={this.handleOnCancelPickerDialog} onPressOk={this.handleOnOkPickerDialog} /> )} </SafeAreaView> ); } } export default withTheme( connectLocalization( connect((state, props) => ({ user: state.auth.user, navigationStateKey: props.route.key, }))(SearchFilterModal), ), );
vj4/ui/components/react/DomComponent.js
vijos/vj4
import React from 'react'; import PropTypes from 'prop-types'; export default class DomComponent extends React.PureComponent { componentDidMount() { this.refs.dom.appendChild(this.props.childDom); } componentWillUnmount() { $(this.refs.dom).empty(); } render() { const { childDom, ...rest } = this.props; return ( <div {...rest} ref="dom"></div> ); } } DomComponent.propTypes = { childDom: PropTypes.instanceOf(HTMLElement).isRequired, };
example/__tests__/index.ios.js
onaclover/react-native-refreshable-list
import 'react-native'; import React from 'react'; import Index from '../index.ios.js'; // Note: test renderer must be required after react-native. import renderer from 'react-test-renderer'; it('renders correctly', () => { const tree = renderer.create( <Index /> ); });
client/main.js
manhhailua/meteor-react-mui-starter-app
/* global document */ import { MuiThemeProvider } from 'material-ui/styles'; import { Meteor } from 'meteor/meteor'; import React from 'react'; import { render } from 'react-dom'; import App from '../imports/ui/components/App'; Meteor.startup(() => { render( <MuiThemeProvider> <App /> </MuiThemeProvider>, document.getElementById('app'), ); });
src/components/CreateUser/index.js
git-okuzenko/react-redux
import React from 'react'; import PropTypes from 'prop-types'; import { Field, reduxForm } from 'redux-form'; import {validate} from '../../utils'; import '../../assets/styles/common/form.scss'; const renderField = (field) => { let {input, label, type, meta: { touched, error }, input: { name }} = field; let renderErrors = () => ( <div className="input-error"> <span className="error">{error}</span> </div> ); return ( <div className="form-group"> <label htmlFor={name}>{label}</label> <input type={type} {...input} className={(touched && error) ? 'form-control invalid': 'form-control'} /> {touched && error ? renderErrors(): null} </div> ); }; let CreateUserForm = ({handleSubmit}) => { let submit = () => { }; return ( <form noValidate autoComplete="off" onSubmit={handleSubmit(submit)}> <Field label="Name" name="name" component={renderField} /> <Field label="Email address" name="email" component={renderField} /> <button type="submit" className="btn btn-primary">Submit</button> </form> ); }; CreateUserForm.propTypes = { handleSubmit: PropTypes.func, pristine: PropTypes.bool, submitting: PropTypes.bool, reset: PropTypes.func }; CreateUserForm = reduxForm({ form: 'addNewUserForm', validate })(CreateUserForm); export default CreateUserForm;
app/javascript/mastodon/features/favourites/index.js
TootCat/mastodon
import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import LoadingIndicator from '../../components/loading_indicator'; import { fetchFavourites } from '../../actions/interactions'; import { ScrollContainer } from 'react-router-scroll'; import AccountContainer from '../../containers/account_container'; import Column from '../ui/components/column'; import ColumnBackButton from '../../components/column_back_button'; import ImmutablePureComponent from 'react-immutable-pure-component'; const mapStateToProps = (state, props) => ({ accountIds: state.getIn(['user_lists', 'favourited_by', Number(props.params.statusId)]), }); class Favourites extends ImmutablePureComponent { static propTypes = { params: PropTypes.object.isRequired, dispatch: PropTypes.func.isRequired, accountIds: ImmutablePropTypes.list, }; componentWillMount () { this.props.dispatch(fetchFavourites(Number(this.props.params.statusId))); } componentWillReceiveProps (nextProps) { if (nextProps.params.statusId !== this.props.params.statusId && nextProps.params.statusId) { this.props.dispatch(fetchFavourites(Number(nextProps.params.statusId))); } } render () { const { accountIds } = this.props; if (!accountIds) { return ( <Column> <LoadingIndicator /> </Column> ); } return ( <Column> <ColumnBackButton /> <ScrollContainer scrollKey='favourites'> <div className='scrollable'> {accountIds.map(id => <AccountContainer key={id} id={id} withNote={false} />)} </div> </ScrollContainer> </Column> ); } } export default connect(mapStateToProps)(Favourites);
components/CounterApp/CounterApp.js
thiagodebastos/react-future-stack
// @flow import React from 'react'; import Button from '../Button'; type Props = { counterApp: { count: number }, increment: CounterAction, decrement: CounterAction }; const Counter = (props: Props) => <div> Counter: {props.counterApp.count} <br /> <Button onClick={props.increment} primary> + </Button> <Button onClick={props.decrement}> - </Button> </div>; export default Counter;
src/components/BooleanQuestion.js
flexiform/flexiform-fill-ui
/** * Copyright 2016 ReSys OÜ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import React from 'react'; import {connectToAnswer} from '../utils/formUtils'; import Errors from './Errors'; import classnames from 'classnames'; import Item from './Item'; import Label from './Label'; import { injectIntl, FormattedMessage } from 'react-intl'; // Form item for boolean (yes/no) questions class BooleanQuestion extends Item { onChange(value) { this.props.answerQuestion(this.props.question[0], value); } // Keyboard interaction keyPress(event) { let keyCode = event.keyCode; switch (keyCode) { // Space: toggle case 32: this.onChange(!this.props.question[1].get('value')); break; // Y: yes / true case 89: this.onChange(true); break; // N: no / false case 78: this.onChange(false); break; } } render() { let q = this.question; if (!q) { return null; } let rawValue = q.get('value'); let value = null; if (rawValue === true || rawValue === 'true') { value = true; } else if (rawValue === false || rawValue === 'false') { value = false; } return ( <div className={this.getStyles()}> <Label htmlFor={this.getControlId()} required={this.isRequired()}>{q.get('label')}</Label> {this.renderDescription()} <div id={this.getControlId()}> <div className={classnames('dialob-tristate-control')} tabIndex={0} onKeyDown={this.keyPress.bind(this)}> <span className={classnames('dialob-tristate-true', {'dialob-tristate-active': (value === true)})} onClick={this.onChange.bind(this, true)}><FormattedMessage id='yes'/></span> <span className={classnames('dialob-tristate-false', {'dialob-tristate-active': (value === false)})} onClick={this.onChange.bind(this, false)}><FormattedMessage id='no'/></span> </div> </div> <Errors errors={q.get('errors')} /> </div> ); } } export const BooleanQuestionConnected = connectToAnswer(injectIntl(BooleanQuestion)); export { BooleanQuestionConnected as default, BooleanQuestion };
app/components/mapMarker/mapMarkerCalloutView.js
UsabilitySoft/Proximater
import React, { Component } from 'react'; import { AppRegistry, Text, View, Image, Button } from 'react-native'; import { styles } from './styles'; export class MapMarkerCalloutView extends Component { render() { return ( <View style={styles.calloutContainer}> <Text style={styles.calloutText}>You are here (callout view)</Text> </View> ); } }
app/javascript/mastodon/features/ui/components/column.js
tootsuite/mastodon
import React from 'react'; import ColumnHeader from './column_header'; import PropTypes from 'prop-types'; import { debounce } from 'lodash'; import { scrollTop } from '../../../scroll'; import { isMobile } from '../../../is_mobile'; export default class Column extends React.PureComponent { static propTypes = { heading: PropTypes.string, icon: PropTypes.string, children: PropTypes.node, active: PropTypes.bool, hideHeadingOnMobile: PropTypes.bool, }; handleHeaderClick = () => { const scrollable = this.node.querySelector('.scrollable'); if (!scrollable) { return; } this._interruptScrollAnimation = scrollTop(scrollable); } scrollTop () { const scrollable = this.node.querySelector('.scrollable'); if (!scrollable) { return; } this._interruptScrollAnimation = scrollTop(scrollable); } handleScroll = debounce(() => { if (typeof this._interruptScrollAnimation !== 'undefined') { this._interruptScrollAnimation(); } }, 200) setRef = (c) => { this.node = c; } render () { const { heading, icon, children, active, hideHeadingOnMobile } = this.props; const showHeading = heading && (!hideHeadingOnMobile || (hideHeadingOnMobile && !isMobile(window.innerWidth))); const columnHeaderId = showHeading && heading.replace(/ /g, '-'); const header = showHeading && ( <ColumnHeader icon={icon} active={active} type={heading} onClick={this.handleHeaderClick} columnHeaderId={columnHeaderId} /> ); return ( <div ref={this.setRef} role='region' aria-labelledby={columnHeaderId} className='column' onScroll={this.handleScroll} > {header} {children} </div> ); } }
examples/src/components/RemoteSelectField.js
katienreed/react-select
import React from 'react'; import Select from 'react-select'; var RemoteSelectField = React.createClass({ displayName: 'RemoteSelectField', propTypes: { hint: React.PropTypes.string, label: React.PropTypes.string, }, loadOptions (input, callback) { input = input.toLowerCase(); var rtn = { options: [ { label: 'One', value: 'one' }, { label: 'Two', value: 'two' }, { label: 'Three', value: 'three' } ], complete: true }; if (input.slice(0, 1) === 'a') { if (input.slice(0, 2) === 'ab') { rtn = { options: [ { label: 'AB', value: 'ab' }, { label: 'ABC', value: 'abc' }, { label: 'ABCD', value: 'abcd' } ], complete: true }; } else { rtn = { options: [ { label: 'A', value: 'a' }, { label: 'AA', value: 'aa' }, { label: 'AB', value: 'ab' } ], complete: false }; } } else if (!input.length) { rtn.complete = false; } setTimeout(function() { callback(null, rtn); }, 500); }, renderHint () { if (!this.props.hint) return null; return ( <div className="hint">{this.props.hint}</div> ); }, render () { return ( <div className="section"> <h3 className="section-heading">{this.props.label}</h3> <Select asyncOptions={this.loadOptions} className="remote-example" /> {this.renderHint()} </div> ); } }); module.exports = RemoteSelectField;
code/workspaces/web-app/src/components/modal/CreateClusterDialog.spec.js
NERC-CEH/datalab
import React from 'react'; import { shallow } from 'enzyme'; import CreateClusterDialog from './CreateClusterDialog'; describe('CreateClusterDialog', () => { const getProps = () => ({ title: 'Create Cluster Dialog Title', formName: 'createCluster', onSubmit: jest.fn().mockName('onSubmit'), onCancel: jest.fn().mockName('onCancel'), dataStorageOptions: [], clusterMaxWorkers: { lowerLimit: 1, default: 4, upperLimit: 8 }, workerMaxMemory: { lowerLimit: 0.5, default: 4, upperLimit: 8 }, workerMaxCpu: { lowerLimit: 0.5, default: 0.5, upperLimit: 2 }, projectKey: 'testproj', }); it('renders correctly passing props to child components', () => { const props = getProps(); const render = shallow(<CreateClusterDialog {...props} />); expect(render).toMatchSnapshot(); }); });
src/parser/warrior/arms/modules/core/Dots/index.js
FaideWW/WoWAnalyzer
import React from 'react'; import Analyzer from 'parser/core/Analyzer'; import StatisticsListBox, { STATISTIC_ORDER } from 'interface/others/StatisticsListBox'; import DeepWoundsUptime from './DeepWoundsUptime'; import RendUptime from './RendUptime'; class DotUptimeStatisticBox extends Analyzer { static dependencies = { deepwoundsUptime: DeepWoundsUptime, rendUptime: RendUptime, }; constructor(...args) { super(...args); this.active = Object.keys(this.constructor.dependencies) .map(name => this[name].active) .includes(true); } statistic() { return ( <StatisticsListBox position={STATISTIC_ORDER.CORE(3)} title="DoT uptimes" > {Object.keys(this.constructor.dependencies).map(name => { const module = this[name]; if (!module.active) { return null; } return ( <React.Fragment key={name}> {module.subStatistic()} </React.Fragment> ); })} </StatisticsListBox> ); } } export default DotUptimeStatisticBox;
packages/datagrid/stories/DynamicDataGrid.component.js
Talend/ui
import React from 'react'; import random from 'lodash/random'; import { IconsProvider } from '@talend/react-components'; import PropTypes from 'prop-types'; import DataGrid from '../src/components'; import serializer from '../src/components/DatasetSerializer'; import sample from './sample.json'; const ADD_ITEMS_NUMBER = 4; const LOADING_ITEM = { loaded: false, value: {}, }; /** * getRowDataInfos - this function return information about how many row of each type are loaded * * @param {array} rowData array of rowData * @return {object} state of the rowData */ export function getRowDataInfos(rowData) { return rowData.reduce( (acc, item) => { if (item.loading === false && Object.keys(item).length === 2) { // eslint-disable-next-line no-param-reassign acc.notLoaded += 1; } else if (item.loading === true) { // eslint-disable-next-line no-param-reassign acc.loading += 1; } else { // eslint-disable-next-line no-param-reassign acc.loaded += 1; } return acc; }, { loaded: 0, loading: 0, notLoaded: 0, }, ); } function getItemWithRandomValue() { return { loading: false, value: { field2: { value: random(0, 10000000), quality: 1, }, field8: { value: random(0, 10000000), quality: 0, }, field5: { value: random(0, 10000000), quality: -1, }, field4: { value: random(0, 10000000), quality: 1, }, field7: { value: random(0, 10000000), quality: 1, }, field3: { value: random(0, 10000000), quality: 1, }, field1: { value: random(0, 10000000), quality: 1, }, field0: { value: `Aéroport ${random(0, 10000000)}`, quality: 1, }, field9: { value: random(0, 10000000), quality: 1, }, field6: { value: random(0, 10000000), quality: 1, }, }, quality: 1, }; } export default class DynamicDataGrid extends React.Component { static propTypes = {}; constructor() { super(); this.addLoadingsItems = this.addLoadingsItems.bind(this); this.terminateItems = this.terminateItems.bind(this); this.changeColumnQuality = this.changeColumnQuality.bind(this); const datagridSample = { ...sample }; datagridSample.data = new Array(ADD_ITEMS_NUMBER).fill().map(() => ({ ...LOADING_ITEM })); this.state = { sample: datagridSample, loading: true, index: 1 }; setTimeout(this.terminateItems, 1000); } terminateItems() { this.setState(prevState => { const datagridSample = { ...prevState.sample }; datagridSample.data.splice( (prevState.index - 1) * ADD_ITEMS_NUMBER, ADD_ITEMS_NUMBER, ...new Array(ADD_ITEMS_NUMBER).fill().map(getItemWithRandomValue), ); return { sample: datagridSample, loading: !prevState.loading, }; }); } changeColumnQuality() { this.setState(prevState => { const datagridSample = { ...prevState.sample }; datagridSample.data = datagridSample.data.map(rowData => ({ ...rowData, value: { ...rowData.value, field5: { ...rowData.value.field5, quality: rowData.value.field5.quality === 1 ? -1 : 1, }, }, })); return { sample: datagridSample, }; }); } addLoadingsItems() { const datagridSample = { ...this.state.sample }; datagridSample.data = datagridSample.data.concat( new Array(ADD_ITEMS_NUMBER).fill().map(() => ({ ...LOADING_ITEM })), ); this.setState(prevState => ({ index: prevState.index + 1, sample: datagridSample, loading: !prevState.loading, })); setTimeout(this.terminateItems, 1000); } render() { return ( <div style={{ height: '100vh' }}> <input type="button" value={`add ${ADD_ITEMS_NUMBER} items`} onClick={this.addLoadingsItems} disabled={this.state.loading} /> <input type="button" value="change quality for 1 column(#6)" onClick={this.changeColumnQuality} disabled={this.state.loading} /> Number of data : {this.state.sample.data.length} <IconsProvider /> <DataGrid data={this.state.sample} rowSelection="multiple" rowData={null} /> </div> ); } }
blueocean-material-icons/src/js/components/svg-icons/notification/do-not-disturb-alt.js
kzantow/blueocean-plugin
import React from 'react'; import SvgIcon from '../../SvgIcon'; const NotificationDoNotDisturbAlt = (props) => ( <SvgIcon {...props}> <path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2zM4 12c0-4.4 3.6-8 8-8 1.8 0 3.5.6 4.9 1.7L5.7 16.9C4.6 15.5 4 13.8 4 12zm8 8c-1.8 0-3.5-.6-4.9-1.7L18.3 7.1C19.4 8.5 20 10.2 20 12c0 4.4-3.6 8-8 8z"/> </SvgIcon> ); NotificationDoNotDisturbAlt.displayName = 'NotificationDoNotDisturbAlt'; NotificationDoNotDisturbAlt.muiName = 'SvgIcon'; export default NotificationDoNotDisturbAlt;
boilerplates/app/src/routes/dashboard/components/completed.js
hexagonframework/antd-admin-cli
import React from 'react' import PropTypes from 'prop-types' import classnames from 'classnames' import { AreaChart, Area, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer } from 'recharts' import styles from './completed.less' import { color } from '../../../utils' function Completed ({ data }) { return ( <div className={styles.sales}> <div className={styles.title}>TEAM TOTAL COMPLETED</div> <ResponsiveContainer minHeight={360}> <AreaChart data={data}> <Legend verticalAlign="top" content={prop => { const { payload } = prop return (<ul className={classnames({ [styles.legend]: true, clearfix: true })}> {payload.map((item, key) => <li key={key}><span className={styles.radiusdot} style={{ background: item.color }} />{item.value}</li>)} </ul>) }} /> <XAxis dataKey="name" axisLine={{ stroke: color.borderBase, strokeWidth: 1 }} tickLine={false} /> <YAxis axisLine={false} tickLine={false} /> <CartesianGrid vertical={false} stroke={color.borderBase} strokeDasharray="3 3" /> <Tooltip wrapperStyle={{ border: 'none', boxShadow: '4px 4px 40px rgba(0, 0, 0, 0.05)' }} content={content => { const list = content.payload.map((item, key) => <li key={key} className={styles.tipitem}><span className={styles.radiusdot} style={{ background: item.color }} />{`${item.name}:${item.value}`}</li>) return <div className={styles.tooltip}><p className={styles.tiptitle}>{content.label}</p><ul>{list}</ul></div> }} /> <Area type="monotone" dataKey="Task complete" stroke={color.grass} fill={color.grass} strokeWidth={2} dot={{ fill: '#fff' }} activeDot={{ r: 5, fill: '#fff', stroke: color.green }} /> <Area type="monotone" dataKey="Cards Complete" stroke={color.sky} fill={color.sky} strokeWidth={2} dot={{ fill: '#fff' }} activeDot={{ r: 5, fill: '#fff', stroke: color.blue }} /> </AreaChart> </ResponsiveContainer> </div> ) } Completed.propTypes = { data: PropTypes.array, } export default Completed
examples/huge-apps/routes/Course/routes/Assignments/components/Assignments.js
mattkrick/react-router
import React from 'react' class Assignments extends React.Component { render() { return ( <div> <h3>Assignments</h3> {this.props.children || <p>Choose an assignment from the sidebar.</p>} </div> ) } } module.exports = Assignments
src/components/LikeButton/index.js
khankuan/asset-library-demo
import React from 'react'; import cx from 'classnames'; import Button from '../Button'; import Text from '../Text'; export default class LikeButton extends React.Component { static propTypes = { children: React.PropTypes.node, liked: React.PropTypes.bool, className: React.PropTypes.string, } getClasses() { const liked = this.props.liked; return cx(liked ? 'liked' : 'not-liked', this.props.className); } render() { const liked = this.props.liked; return ( <Button {...this.props} className={ this.getClasses() } type="flat"> <Text bold>{liked ? 'Liked' : 'Like'}</Text> { this.props.children } </Button> ); } }
src/ui/components/ReferenceRoute.js
BE-Webdesign/wp-rest-api-reference
/** * External dependecies. */ import React from 'react' /** * Internal dependecies. */ import EndpointsList from './EndpointsList' const ReferenceRoute = ( route ) => ( <div className="reference-route"> <h2 className="reference-route__title">Route: { route.routeName }</h2> <EndpointsList endpoints={ route.endpoints } /> </div> ) export default ReferenceRoute
src/common/Dialog/DialogContent.js
Syncano/syncano-dashboard
import React from 'react'; export default ({ children }) => ( <div className="col-flex-1"> {children} </div> );
src/components/PageHome.js
dfilipidisz/overwolf-hots-talents
import React from 'react'; class PageHome extends React.Component { render () { return ( <div> page home </div> ); } } export default PageHome;
app/javascript/mastodon/features/ui/components/list_panel.js
danhunsaker/mastodon
import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { fetchLists } from 'mastodon/actions/lists'; import { connect } from 'react-redux'; import { createSelector } from 'reselect'; import { NavLink, withRouter } from 'react-router-dom'; import Icon from 'mastodon/components/icon'; const getOrderedLists = createSelector([state => state.get('lists')], lists => { if (!lists) { return lists; } return lists.toList().filter(item => !!item).sort((a, b) => a.get('title').localeCompare(b.get('title'))).take(4); }); const mapStateToProps = state => ({ lists: getOrderedLists(state), }); export default @withRouter @connect(mapStateToProps) class ListPanel extends ImmutablePureComponent { static propTypes = { dispatch: PropTypes.func.isRequired, lists: ImmutablePropTypes.list, }; componentDidMount () { const { dispatch } = this.props; dispatch(fetchLists()); } render () { const { lists } = this.props; if (!lists || lists.isEmpty()) { return null; } return ( <div> <hr /> {lists.map(list => ( <NavLink key={list.get('id')} className='column-link column-link--transparent' strict to={`/timelines/list/${list.get('id')}`}><Icon className='column-link__icon' id='list-ul' fixedWidth />{list.get('title')}</NavLink> ))} </div> ); } }
src/svg-icons/navigation/chevron-right.js
ichiohta/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let NavigationChevronRight = (props) => ( <SvgIcon {...props}> <path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/> </SvgIcon> ); NavigationChevronRight = pure(NavigationChevronRight); NavigationChevronRight.displayName = 'NavigationChevronRight'; NavigationChevronRight.muiName = 'SvgIcon'; export default NavigationChevronRight;
app/components/Icons/index.js
Byte-Code/lm-digital-store-private-test
import React from 'react'; import PropTypes from 'prop-types'; import * as conditions from '../../utils/weatherConditions'; import styles from './styles.css'; function sunShowerIcon() { return ( <div className={styles.icon}> <div className={styles.cloud} /> <div className={styles.sun}> <div className={styles.rays} /> </div> <div className={styles.rain} /> </div> ); } function thunderStormIcon() { return ( <div className={styles.icon}> <div className={styles.cloud} /> <div className={styles.lightning}> <div className={styles.bolt} /> <div className={styles.bolt} /> </div> </div> ); } function cloudyIcon() { return ( <div className={styles.icon}> <div className={styles.cloud} /> <div className={styles.cloud} /> </div> ); } function flurriesIcon() { return ( <div className={styles.icon}> <div className={styles.cloud} /> <div className={styles.snow}> <div className={styles.flake} /> <div className={styles.flake} /> </div> </div> ); } function sunnyIcon() { return ( <div className={styles.icon}> <div className={styles.sun}> <div className={styles.rays} /> </div> </div> ); } function rainyIcon() { return ( <div className={styles.icon}> <div className={styles.cloud} /> <div className={styles.rain} /> </div> ); } const IconSelector = ({ weather }) => { switch (weather.toLowerCase()) { case conditions.clearSky: default: return sunnyIcon(); case conditions.fewClouds: case conditions.scatteredClouds: case conditions.brokenClouds: case conditions.mist: return cloudyIcon(); case conditions.showerRain: return rainyIcon(); case conditions.rain: return sunShowerIcon(); case conditions.snow: return flurriesIcon(); case conditions.thunderstorm: return thunderStormIcon(); } }; IconSelector.propTypes = { weather: PropTypes.string.isRequired }; export default IconSelector;
Step4/__tests__/index.android.js
soulmachine/react-native-starter-kit
import 'react-native'; import React from 'react'; import Index from '../index.android.js'; // Note: test renderer must be required after react-native. import renderer from 'react-test-renderer'; it('renders correctly', () => { const tree = renderer.create( <Index /> ); });
src/Parser/Monk/Mistweaver/Modules/Spells/EssenceFont.js
enragednuke/WoWAnalyzer
import React from 'react'; import SPELLS from 'common/SPELLS'; import SpellLink from 'common/SpellLink'; import Wrapper from 'common/Wrapper'; import Analyzer from 'Parser/Core/Analyzer'; const debug = false; class EssenceFont extends Analyzer { castEF = 0; targetsEF = 0; on_byPlayer_cast(event) { const spellId = event.ability.guid; if (spellId === SPELLS.ESSENCE_FONT.id) { this.castEF += 1; } } on_byPlayer_applybuff(event) { const spellId = event.ability.guid; if (spellId === SPELLS.ESSENCE_FONT_BUFF.id) { this.targetsEF += 1; } } on_byPlayer_refreshbuff(event) { const spellId = event.ability.guid; if (spellId === SPELLS.ESSENCE_FONT_BUFF.id) { this.targetsEF += 1; } } on_finished() { if (debug) { console.log(`EF Casts: ${this.castEF}`); console.log(`EF Targets Hit: ${this.targetsEF}`); console.log(`EF Avg Targets Hit per Cast: ${this.targetsEF / this.castEF}`); } } get avgTargetsHitPerEF() { return (this.targetsEF / this.castEF) || 0; } get suggestionThresholds() { return { actual: this.avgTargetsHitPerEF, isLessThan: { minor: 17, average: 14, major: 12, }, style: 'number', }; } suggestions(when) { when(this.suggestionThresholds).addSuggestion((suggest, actual, recommended) => { return suggest( <Wrapper> You are currently using not utilizing your <SpellLink id={SPELLS.ESSENCE_FONT.id} /> effectively. Each <SpellLink id={SPELLS.ESSENCE_FONT.id} /> cast should hit a total of 18 targets. Either hold the cast til 6 or more targets are injured or move while casting to increase the effective range of the spell. </Wrapper> ) .icon(SPELLS.ESSENCE_FONT.icon) .actual(`${this.avgTargetsHitPerEF.toFixed(2)} average targets hit per cast`) .recommended(`${recommended} targets hit is recommended`); }); } } export default EssenceFont;
src/pages/chart/highCharts/HighMoreComponent.js
zuiidea/antd-admin
import React from 'react' import ReactHighcharts from 'react-highcharts' import HighchartsExporting from 'highcharts-exporting' import HighchartsMore from 'highcharts-more' HighchartsMore(ReactHighcharts.Highcharts) HighchartsExporting(ReactHighcharts.Highcharts) const config = { chart: { polar: true, }, xAxis: { categories: [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', ], }, series: [ { data: [ 29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4, ], }, ], } const HighMoreComponent = () => { return <ReactHighcharts config={config} /> } export default HighMoreComponent
webapp/src/components/Footer/Footer.js
wfriesen/jerryatric
/** * React Starter Kit (https://www.reactstarterkit.com/) * * Copyright © 2014-2016 Kriasoft, LLC. All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE.txt file in the root directory of this source tree. */ import React, { Component } from 'react'; import s from './Footer.scss'; import withStyles from '../../decorators/withStyles'; import Link from '../Link'; @withStyles(s) class Footer extends Component { render() { return ( <div className={s.root}> <div className={s.container}> <span className={s.text}>© Your Company</span> <span className={s.spacer}>·</span> <a className={s.link} href="/" onClick={Link.handleClick}>Home</a> <span className={s.spacer}>·</span> <a className={s.link} href="/privacy" onClick={Link.handleClick}>Privacy</a> <span className={s.spacer}>·</span> <a className={s.link} href="/not-found" onClick={Link.handleClick}>Not Found</a> </div> </div> ); } } export default Footer;
webpack/containers/Help.js
CDCgov/SDP-Vocabulary-Service
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import { setSteps } from '../actions/tutorial_actions'; import { Button } from 'react-bootstrap'; import InfoModal from '../components/InfoModal'; class Help extends Component { constructor(props){ super(props); this.selectTab = this.selectTab.bind(this); this.selectInstruction = this.selectInstruction.bind(this); this.state = { selectedTab: props.location.state ? props.location.state.selectedTab : 'instructions', selectedInstruction: props.location.state ? '' : 'general' }; } selectTab(tabName) { if(tabName === 'instructions'){ this.setState({ selectedTab: tabName, selectedInstruction: 'general' }); } else { this.setState({ selectedTab: tabName, selectedInstruction: '' }); } } selectInstruction(instrName) { this.setState({ selectedTab: 'instructions', selectedInstruction: instrName }); } componentDidMount() { this.props.setSteps([ { title: 'Help', text: 'Click next to see a step by step walkthrough for using this page. To see more detailed information about this application and actions you can take <a class="tutorial-link" href="#help">click here to view the full Help Documentation.</a> Accessible versions of these steps are also duplicated in the help documentation.', selector: '.help-link', position: 'bottom', }, { title: 'Tutorials', text: 'Click any item in this side bar to see instructions on how to perform any of the specified activities.', selector: '.how-to-nav', position: 'right', }]); } generalInstructions() { return( <div className="tab-pane active" id="general" role="tabpanel" aria-hidden={this.state.selectedInstruction !== 'general'} aria-labelledby="general-tab"> <h1 id="general">General</h1> <p><strong>Full help resources:</strong></p> <ul> <li><a href='https://www.cdc.gov/sdp/SDPVocabularyServiceSharedServices.html' target='_blank'>Additional external help resources including a full user guide can be found by clicking here!</a></li> </ul> <p><strong>Navigation and Help Basics:</strong></p> <ul> <li>Use the top bar to log-in or navigate to various pages.</li> <li>Clicking the CDC logo in the top left will return you to the landing page at any time.</li> <li>The footer contains useful links to pages with additional information about the site, including the application version. Please reference this version number in any bug reports.</li> <li>On most pages the top right navigation bar gives a &quot;Help&quot; option. Click on this option to view documentation for various actions or see step-by-step walk throughs on some pages. The step by step walkthroughs are also available below in accessible plain text format.</li> </ul> <p><strong>Page Step By Step Instructions:</strong></p> <ul> <li><a href="#dashboard">Dashboard</a></li> <li><a href="#section-edit">Section Edit Page</a></li> <li><a href="#section-details">Section Details Page</a></li> <li><a href="#question-edit">Question Edit Page</a></li> <li><a href="#question-details">Question Details Page</a></li> <li><a href="#response-set-edit">Response Set Edit Page</a></li> <li><a href="#response-set-details">Response Set Details Page</a></li> <li><a href="#survey-edit">Survey Edit Page</a></li> <li><a href="#survey-details">Survey Details Page</a></li> <li><a href="#help-page-link">Help Page</a></li> <li><a href="#code-system-mappings-tables-edit">Code System Mappings Tables on Edit Page</a></li> </ul> <h2 id="step-by-step">Step-by-Step Walkthroughs by Page</h2> <h3 id="dashboard">Dashboard</h3> <ul> <li>Type in your search term and search across all items by default. Results include items you own and public items.</li> <li>Click on any of the type boxes to highlight them and toggle on filtering by that single item type.</li> <li>Click Advanced Link to see additional filters you can apply to your search.</li> <li>If you already have an account you can log in to unlock more features in the top right of the dashboard page.</li> <li>Click on any of the rows in the My Stuff Analytics panel to filter by items you authored.</li> <li>If you belong to a group you may use the dropdown in the right panel to select a group, this will filter all search results limiting to content owned by that group.</li> <li>Click the create menu and then select an item type to author a new item.</li> <li>Click the alerts dropdown to see any new notifications about your content.</li> <li>Click your e-mail to see various account management options.</li> </ul> <h3 id="section-edit">Section Edit Page</h3> <ul> <li>If you need to create a new question without leaving the the section use this button to author a new question from scratch.</li> <li>Type in your search keywords in the top left search bar to search for questions to add to the section.</li> <li>Click Advanced to see additional filters you can apply to your search.</li> <li>Use these search results to find the question you want to add.</li> <li>Click on the add (+) button to select a question for the section.</li> <li>Edit the various section details on the right side of the page. Select save in the top right of the page when done editing to save a private draft of the content (this content will not be public until it is published).</li> </ul> <h3 id="section-details">Section Details Page</h3> <ul> <li>Use the history side bar to switch between revisions of an item if more than one exists</li> <li>See all of the details including linked items on this section of the page. Use the buttons in the top right to do various actions with the content depending on your user permissions. For full details on what an action does please see the 'Create and Edit Content' section of the <a className="tutorial-link" href="#help">Help Documentation (linked here).</a></li> <li>At the bottom of each details page is a section for public comments. People can view and respond to these comments in threads on public content</li> </ul> <h3 id="question-edit">Question Edit Page</h3> <ul> <li>Use the input fields to edit content of the question. If the response type is open choice this panel will also give you the option to associate response sets with this quesiton at creation time</li> <li>Click the search icon to search for and add coded concepts to the question</li> <li>Alternatively, you can manually add a code system mapping - click the plus sign to add additional code system mapping to associate with the question</li> <li>The Concept Name field is what the user will see on the page</li> <li>Optionally, you can enter a code and a code system for the mapping you are adding if it belongs to an external system (such as LOINC or SNOMED)</li> <li>Click save to save a private draft of the edited content</li> </ul> <h3 id="question-details">Question Details Page</h3> <ul> <li>Use the history side bar to switch between revisions of an item if more than one exists</li> <li>See all of the details including linked items on this section of the page. Use the buttons in the top right to do various actions with the content depending on your user permissions. For full details on what an action does please see the "Create and Edit Content" section of the <a className="tutorial-link" href="#help">Help Documentation (linked here).</a></li> <li>At the bottom of each details page is a section for public comments. People can view and respond to these comments in threads on public content</li> </ul> <h3 id="response-set-edit">Response Set Edit Page</h3> <ul> <li>Use the input fields to edit content of the response set</li> <li>Click the search icon to search for and add coded responses to the response set</li> <li>Alternatively, you can manually add a response - click the plus sign to add additional responses to associate with the response set</li> <li>The Display Name field is what the user will see on the page</li> <li>Optionally, you can enter a code and a code system for the response you are adding if it belongs to an external system (such as LOINC or SNOMED)</li> <li>Click save to save a private draft of the edited content (this content will not be public until it is published)</li> </ul> <h3 id="response-set-details">Response Set Details Page</h3> <ul> <li>Use the history side bar to switch between revisions of an item if more than one exists</li> <li>See all of the details including linked items on this section of the page. Use the buttons in the top right to do various actions with the content depending on your user permissions. For full details on what an action does please see the "Create and Edit Content" section of the <a className="tutorial-link" href="#help">Help Documentation (linked here).</a></li> <li>At the bottom of each details page is a section for public comments. People can view and respond to these comments in threads on public content</li> </ul> <h3 id="survey-edit">Survey Edit Page</h3> <ul> <li>Type in your search keywords here to search for sections to add to the survey</li> <li>Click Advanced to see additional filters you can apply to your search</li> <li>Use these search results to find the section you want to add</li> <li>Click on the add button to select a section for the survey</li> <li>Edit the various survey details on the right side of the page. Select save in the top right of the page when done editing to save a private draft of the content (this content will not be public until it is published)</li> </ul> <h3 id="survey-details">Survey Details Page</h3> <ul> <li>Use the history side bar to switch between revisions of an item if more than one exists</li> <li>See all of the details including linked items on this section of the page. Use the buttons in the top right to do various actions with the content depending on your user permissions. For full details on what an action does please see the "Create and Edit Content" section of the <a className="tutorial-link" href="#help">Help Documentation (linked here).</a></li> <li>At the bottom of each details page is a section for public comments. People can view and respond to these comments in threads on public content</li> </ul> <h3 id="help-page-link">Help Page</h3> <ul> <li>Click any item in the left side bar to see instructions on how to perform any of the specified activities</li> </ul> <h3 id="code-system-mappings-tables-edit">Code System Mappings Tables on Edit Pages</h3> <ul> <li>Click the info (i) icon, or go to the Code System Mappings tab in the help documentation to see more information and examples on how to get the most out of code mappings.</li> </ul> </div> ); } accountInstructions() { return( <div className="tab-pane" id="manage-account" role="tabpanel" aria-hidden={this.state.selectedInstruction !== 'manage-account'} aria-labelledby="manage-account-tab"> <h1 id="account-management">Account Management</h1> <p><strong>Options:</strong></p> <ul> <li><a href="#logging-in">Logging In</a></li> <li><a href="#logging-out">Logging Out</a></li> <li><a href="#trouble">Trouble Logging In</a></li> </ul> <h2 className="help-section-subtitle" id="logging-in">Logging In</h2> <p>If you already have an account simply click the log-in link in the blue navigation bar in the top right of the screen. You should then be redirected to Secure Access Management Services (SAMS) to login* with your credentials. If you do not see a log-in button the browser may be logged in from a previous session. In that case see how to log out below.</p> <p id="trouble"><strong>*Trouble logging in:</strong> If you receive an error message after entering your credentials into SAMS, please email surveillanceplatform@cdc.gov to request Surveillance Data Platform Vocabulary Service SAMS Activity Group membership.</p> <h2 className="help-section-subtitle" id="logging-out">Logging Out</h2> <p>On any page you should be able to log-out by first clicking the e-mail in the top-right corner of the navigation bar, then selecting log-out from the drop-down menu that will appear. The page should refresh automatically.</p> </div> ); } searchInstructions() { return( <div className="tab-pane" id="search" role="tabpanel" aria-hidden={this.state.selectedInstruction !== 'search'} aria-labelledby="search-tab"> <h1 id="search-functionality">Search Functionality</h1> <p><strong>Features:</strong></p> <ul> <li><a href="#advanced-search">Advanced search</a></li> <li><a href="#basic-search">Basic search</a></li> <li><a href="#filtering-by-type">Filtering by type</a></li> <li><a href="#see-content-you-own">See content you own</a></li> <li><a href="#advanced-filtering">Advanced filtering</a></li> </ul> <h2 className="help-section-subtitle" id="advanced-search">Advanced Search</h2> <p>The application uses a search engine called Elasticsearch. Features of this search engine include filters in the "Advanced" search pop-up, fuzzy matching on queries that are close matches to the search terms, better weighted results, and the curation wizard.</p> <p>If a warning symbol appears next to the "Advanced" search link or you see an error message in the advanced search pop-up, the advanced search engine (Elasticsearch) is down. The advanced features, including filters and fuzzy matching, will not work while the engine is down. Please check back later or contact your system administrator at <a href="mailto:surveillanceplatform@cdc.gov">surveillanceplatform@cdc.gov</a> if the issue is persistent.</p> <h2 className="help-section-subtitle" id="basic-search">Basic Search</h2> <p>On the dashboard there is a search bar that can be used to find questions, response sets, sections, and surveys. Typing in search terms that might be found in the name, description, author e-mail, and various other relevant fields on the items.</p> <h2 className="help-section-subtitle" id="filtering-by-type">Filtering by Type</h2> <p>You can filter a search by the type of content by clicking on the analytics icons immediately below the search bar on the dashboard page. Clicking on any of those four squares on the top of the page will filter by the type specified in the square and highlight the square. Once a filter is applied you can click on the &#39;clear filter&#39; link that will appear under the icons on the dashboard.</p> <h2 className="help-section-subtitle" id="see-content-you-own">See Content You Own</h2> <p>Similar to searching by type (described above) when you are logged in to an account the dashboard will have a &quot;My Stuff&quot; section displayed on the right side of the dashboard. Clicking on any of the icons or the filter link in that panel will highlight the filter applied in blue and filter any searches down to only return private drafts and public published content that you own.</p> <h2 className="help-section-subtitle" id="see-content-your-groups-own">See Content Your Groups Own</h2> <p>Similar to searching by content you own, when you are logged in to an account that is part of an authoring group, the dashboard will have a &quot;Filter by Group&quot; section displayed on the right side of the dashboard. Selecting any of the group names from the dropdown in that panel will filter any searches down to only return content that is assigned to the specified group.</p> <h2 className="help-section-subtitle" id="advanced-filtering">Advanced Filtering</h2> <p>Under the search bars seen across the app there is an &#39;Advanced&#39; link. If you click that link it will pop up a window with additional filters that you can apply. Any filters you select will limit your searches by the selected filters. The window also has a clear filters buttons that will reset back to the default search.</p> </div> ); } viewInstructions() { return( <div className="tab-pane" id="view" role="tabpanel" aria-hidden={this.state.selectedInstruction !== 'view'} aria-labelledby="view-tab"> <h1 id="content-viewing-and-exporting">Content Viewing and Exporting</h1> <p><strong>Options:</strong></p> <ul> <li><a href="#viewing">View Content</a></li> <li><a href="#exporting">Export Content</a></li> </ul> <h2 className="help-section-subtitle" id="viewing">View Content</h2> <ul> <li>On the dashboard and various other places you will see a little summary box, or widget, displaying important information about the search result.</li> <li>Clicking the bottom link on each widget expands a box with additional information about the item.</li> <li>In most places the full details page can be seen by clicking the name / title link of the item.</li> <li>On the edit pages the name link is disabled but you can click the eyeball icon on any of the widgets to navigate to the details page.</li> </ul> <h2 className="help-section-subtitle" id="exporting">Exporting</h2> <p><strong>Epi Info </strong>(Surveys and Sections)</p> <p>On the view pages for surveys and sections there is an action button that exports the current content to Epi Info (XML). To export a survey or section and use it in Epi Info execute the following steps:</p> <ul> <li>Click on the 'Export' button on the Vocabulary service section details page (this will save a .xml file to the folder your browser directs downloads)</li> <li>Open Epi Info</li> <li>Choose the option to 'Create Forms'</li> <li>From the File menu, select 'Get Template'</li> <li>Select the .xml file you downloaded from the vocabulary service, it will be in the folder your browser downloads content into (usually the 'Downloads' folder). Click 'Open'.</li> <li>From the File menu, select 'New Project from Template'</li> <li>After selecting the template that was created from the vocabulary service .xml file, complete the rest of the fields. Click 'Ok'</li> </ul> <p><strong>REDCap </strong>(Surveys and Sections)</p> <p>On the view pages for surveys and sections there is an action button that exports the current section to REDCap. To export a survey or section and use it in REDCap execute the following steps (exact wording may differ slightly based on your version of REDCap):</p> <ul> <li>Click on the 'Export' button on the Vocabulary service survey or section details page and select 'REDCap (XML)' (this will save a .xml file to the folder your browser directs downloads)</li> <li>Open up REDCap</li> <li>Choose the option to create a new project</li> <li>On the project creation page follow the on screen instructions to add a name and various attributes to the new projects</li> <li>Look for an option titled something similar to "Start project from scratch or begin with a template?" and choose the "Upload a REDCap project XML file" option</li> <li>Click the "Choose File" button to select the .xml file you downloaded from the vocabulary service, it will be in the folder your browser downloads content into (usually the 'Downloads' folder)</li> <li>After selecting the .xml file to import and filling out the rest of the fields, click on the Create Project or Start Project button at the bottom of the page</li> </ul> <p><strong>Spreadsheet </strong> (Surveys only)</p> <p>On the view page for surveys there is an action button that exports the current survey to spreadsheet format (xlsx). To export a survey into this format, execute the following steps:</p> <ul><li>Click on the 'Export' button on the Vocabulary service survey or section details page and select 'Spreadsheet (XLSX)' (this will save a .xlsx file to the folder where your browser directs <b>downloads</b>.)</li></ul> <p><strong>PDF </strong> (Surveys and Sections)</p> <p>On the view page for surveys and sections there is an action button that exports the current content to a PDF file. To export a section or survey into this format, execute the following steps:</p> <ul><li>Click on the 'Export' button on the Vocabulary service survey or section details page and select 'Print' (this will save a .pdf file to the folder your browser directs downloads)</li></ul> </div> ); } workflowInstructions() { return( <div className="tab-pane" id="workflow" role="tabpanel" aria-hidden={this.state.selectedInstruction !== 'workflow'} aria-labelledby="workflow-tab"> <h1 id="content-workflow">Workflow Status and Content Stage</h1> <p>SDP-V has workflow statuses and content stages to support different business processes of users.</p> <p><strong>Topics:</strong></p> <ul> <li><a href="#workflow">Workflow Status</a></li> <li><a href="#stage">Content Stage</a></li> </ul> <h2 className="help-section-subtitle" id="workflow">Workflow Status</h2> <p>SDP-V content can be in either a Private or Public workflow status. Workflow status drives visibility rules in SDP-V. Workflow status is displayed as “Visibility” in the UI to clearly communicate to users who can see which content.</p> <ul> <li> <strong>PRIVATE</strong> – When content is created or imported in SDP-V, it is in Private workflow status. Content in this workflow status has restricted visibility based on ownership and role and can be modified until the author or authoring group is ready to publish it (see Public workflow status below). <ul> <li><strong>Visibility: </strong>Content in private workflow status is only visible to the user who authored it, users that belong to a group that the content is added to, and to all Publishers in the system.</li> <li><strong>Ability to Modify Content: </strong>Only the Author or group members may make changes to the private draft content. The private content can be edited as desired until it is ready to be sent to a Publisher for review. SDP-V tracks changes to private draft content on the Change History tab.</li> <li><strong>Content Stages: </strong>Users can use the “draft”, “comment only”, or “trial use” content stages. The “draft” content stage is the default stage; “trial use” and “comment only” are optional content stages for this workflow status. To support multiple business cases, the user may place content in private workflow status into these 3 content stages bi-directionally in any order (e.g., draft, comment only, trial use, comment only) or may only use the "draft" content stage.</li> </ul> </li> <li> <strong>PUBLIC</strong> – Whenever an author or authoring group is ready to share their content publicly, an author must send a request to their program Publisher to change the workflow status in SDP-V. Content must be reviewed and approved by a Publisher in SDP-V to change the workflow status to Public; this action is known as “publishing” is SDP-V. <ul> <li><strong>Visibility: </strong>Public content is visible to everyone who visits the SDP-V website including users without authenticated accounts (publicly available). This allows for authors to share their SDP-V content with a wide public health audience. Once a version is public, it cannot be set back to private. An author can use the content stage attribute to indicate which public version is ready for use versus other stages of maturity (see definitions below).</li> <li><strong>Ability to Modify Content: </strong>Only the Author or group members of public content may choose to revise it. Revising public content results in a new version of the content in private status that can be modified as described above until it is ready to be published publicly. SDP-V maintains a version history for public content so that users can see how content has evolved over time.</li> <li><strong>Content Stages: </strong>Users can use the “published”, “comment only”, or “trial use” content stages. The “published” content stage is the default stage; “trial use” and “comment only” are optional content stages for this workflow status. To support multiple business cases, the user may place content in the public workflow status into these 3 content stages in any order (e.g., comment only, trial use, comment only, published) or may only use the "published" content stage.</li> </ul> </li> </ul> <p><strong>Note:</strong>Content in the public workflow status indicates that a program was ready to share content publicly to promote transparency, harmonization, standardization, and the goals of SDP-V and may not be authoritative. Users interested in using public content are encouraged to reach out to the appropriate program or system with any questions about content and consider the indicated content stage.</p> <h2 className="help-section-subtitle" id="stage">Content Stage</h2> <p>An attribute of the content being presented that represents content maturity. Response sets, questions, sections, and surveys added to SDP-V do not need to advance through each content stage described below before sharing their content publicly (publishing content as described above). The content stage attribute offers users flexibility to accurately communicate the maturity of their content at different stages of the vocabulary life cycle with other users.</p> <ul> <li> <strong>DRAFT</strong> – Content that is being worked on by its Authors and Publisher. It is generally not considered to be “complete” and unlikely ready for comment. Content at this Level should not be used. This is the initial status assigned to newly created content. <ul><li>This content stage can be used for content is that is in private workflow status.</li></ul> </li> <li> <strong>COMMENT ONLY</strong> – Content that is being worked on by its Authors and Publisher. It is generally not considered to be “complete” but is ready for viewing and comment. Content at this Level should not be used. <ul><li>This content stage can be used for content is that is in either private and public workflow status.</li></ul> </li> <li> <strong>TRIAL USE</strong> – Content that the Authors and Publisher believe is ready for User viewing, testing and/or comment. It is generally “complete”, but not final. Content at this Level should not be used to support public health response. <ul><li>This content stage can be used for content that is in either private and public workflow status.</li></ul> </li> <li> <strong>PUBLISHED</strong> – The most recent version of content. It is ready for viewing, downloading, comments, use for public health response. <ul><li>This content stage can be used for content that is in public workflow status.</li></ul> </li> <li> <strong>RETIRED</strong> – Content that is no longer the most recent version (not latest). However, this content could be used with no known risk. <ul><li>This content stage can be used for content that is in public workflow status. Only publishers can move content to this content stage. Authors who would like to retire content should contact their program publisher. Content that is "retired" is hidden from dashboard search results by default unless an advanced filter is toggled to show retired content.</li></ul> </li> <li> <strong>DUPLICATE</strong> – Content that the Author and Publisher believe is a duplicate of other content in the SDP-V repository. Content marked as “Duplicate” should not be used when creating new SDP-V surveys. If content marked as “Duplicate” is used on an existing SDP-V survey, it should be replaced during the next revision. <ul><li>This content stage is assigned whenever users identify duplicate content using the curation wizard. This content stage cannot be assigned by users outside of the curation wizard.</li></ul> </li> </ul> </div> ); } editInstructions() { return( <div className="tab-pane" id="create-and-edit" role="tabpanel" aria-hidden={this.state.selectedInstruction !== 'create-and-edit'} aria-labelledby="create-and-edit-tab"> <h1 id="content-creation-and-editing">Content Creation and Editing</h1> <p><strong>Options:</strong></p> <ul> <li><a href="#create-new-content">Create New Content</a></li> <li><a href="#edit-content">Edit Content</a></li> <li><a href="#revise-content">Revise Content</a></li> <li><a href="#extend-content">Extend Content</a></li> </ul> <h2 className="help-section-subtitle" id="create-new-content">Create New Content</h2> <ul> <li>To start a new private draft of any item click on the &quot;Create&quot; drop down in the top navigation bar on the dashboard.</li> <li>On the creation / editing page change any fields that need to be updated and press save - this saves a private draft of the first version of the new item that will need to get published by a publisher before it will be publicly visible to others.</li> <li>If you try to navigate away before saving the changes a prompt will ask if you want to navigate away without saving or save before you leave.</li> </ul> <h2 className="help-section-subtitle" id="edit-content">Edit Content</h2> <p><strong>Note:</strong> You can only edit your own private content, or content that belongs to a group where you are a member - once your content is made public you will be given the option to create a new revision or extension (a copy with a separate version history) of the content.</p> <ul> <li>When looking at the search result for the item you want to edit click on the menu button in the bottom right and select edit.</li> <li>When on the details page of an item the edit or revise button should appear in the top right above the item information.</li> <li>On the edit page change any fields that need to be updated and press save.</li> </ul> <h2 className="help-section-subtitle" id="revise-content">Revise Content</h2> <p><strong>Note:</strong> You can only revise your own public content, or public content that belongs to a group where you are a member. Saving a revision will save a private draft of that revision until you publish the new version.</p> <ul> <li>When looking at the search result for the item you want to revise click on the menu button in the bottom right and select revise</li> <li>When on the details page of an item the edit or revise button should appear in the top right above the item information</li> <li>On the revision editing page change any fields that need to be updated and press save - this saves a private draft of the new version that will need to get published by a publisher before it will be publicly visible to others.</li> </ul> <h2 className="help-section-subtitle" id="extend-content">Extend Content</h2> <p><strong>Note:</strong> You can only extend public content. Unlike revising, you do not need to own or be part of a group that owns content in order to create an extension (use it as a template with its own version history). Saving an extension will save a private draft that is the first version (new revision history) with a link to the content it was extended from (shown as the parent of the item).</p> <ul> <li>When looking at the search result for the item you want to extend click on the menu button in the bottom right and select extend</li> <li>When on the details page of a public item the extend button should appear in the top right above the item information</li> <li>On the extension editing page change any fields that need to be updated and press save - this saves a private draft of the first version of the extended item that will need to get published by a publisher before it will be publicly visible to others.</li> </ul> </div> ); } curationInstructions() { return ( <div className="tab-pane" id="curation" role="tabpanel" aria-hidden={this.state.selectedInstruction !== 'curation'} aria-labelledby="curation-tab"> <h1 id="curation-wizard">Curation Wizard</h1> <p>Description: The curation wizard shows the user questions and response sets in the SDP-V repository that are similar to content on user’s survey. This feature automates the identification of similar questions and response sets created by other programs to maximize harmonization opportunities within SDP-V before private content is published or during the revision of a public SDP-V survey. The user may select an existing question or response set from the SDP-V repository to replace private draft content on their survey or link public content on their survey to another question or response in the service to indicate to other users what content in the repository is the preferred replacement.</p> <p>Value: These replacements and linkages will help curate and reduce redundancy while promoting reuse. Use of this feature will also enable proper population of system usage statistics in SDP-V to show use of content across CDC programs and systems (e.g., different users must link to the same question in the repository for usage across sections, surveys, programs, and surveillance systems to be transparent in the service). This feature will also help to prevent duplicate questions and response sets from cluttering the repository so that content is easier to search, browse, and use.</p> <p><strong>How to Find Similar Questions and Response Sets in SDP-V (Surveys)</strong></p> <p>The Curation Wizard feature will be available on the Survey Details page if the algorithm detects similar questions and/or response sets from your survey in the SDP-V repository.</p> <p>To start the curation wizard, execute the following steps:</p> <ul> <li> Click on the 'Curate' button on the Survey details page (the number in parentheses indicates the total questions and/or response sets on the survey with similar content in SDP-V detected) <ul> <li> If no similar questions and/or response sets are detected on the survey, then the “Curate” button will not appear to the user. </li> </ul> </li> <li> The Curate Survey Content Page contains two tabs. <ul> <li> The ‘Questions’ tab is the default view and lists all questions on the survey with potential duplicates in the repository (the number in parentheses indicates the total questions on the survey with similar content detected in SDP-V). </li> <li> The ‘Response Sets’ tab lists all response sets on the survey with potential duplicates in the repository (the number in parentheses indicates the total response sets on the survey with similar content detected in SDP-V). </li> </ul> </li> <li> Select ‘View’ to see similar questions or response sets in the SDP-V repository with significant overlap in various fields (at least 75%). <ul> <li>Click on the Section Name hyperlink to view the section details where the potential duplicate questions were identified on the user’s survey</li> </ul> </li> <li> Scroll through ‘Potential Duplicate Questions’ or ‘Potential Duplicate Response Sets’ by using the left and right arrows on the right-side of the screen <ul> <li>Click on the Section Name hyperlink to view the section details where the potential duplicate questions were identified on the user’s survey</li> </ul> </li> <li> Click on the Question Name hyperlink to view the question details of the suggested replacement questions that were identified by the matching algorithm <ul> <li>If the potential duplicate Question or Response Set visibility is “private”: Select ‘Replace’ to mark the private draft question or response set on the user’s survey as a duplicate and replace it with the selected question or response set. A prompt will appear for confirmation of the replacement along with details of the change that states the current question or response set will be replaced everywhere it is used in the vocabulary service and be deleted. This action cannot be undone.</li> <li>If the duplicate Question or Response Set visibility is “public”: A “Link” button appears instead of “Replace”. Selecting “Link” will mark the question or response set as “Duplicate” and move the question or response set to the “Duplicate” content stage. The potential duplicate question or response set details page will provide a link to the question or response set that the author selected (by clicking “Link to”). This action allows authors to indicate which item is a preferred replacement to promote harmonization and reduce redundancy.</li> </ul> </li> </ul> <h2>Curation Wizard ‘Replace’ Function</h2> <p>Whenever a user chooses to replace a private question or response set on their survey with an existing question or response set in SDP-V, only some fields are updated. This is to prevent the user from losing information that has already been entered.</p> <p><strong>Questions</strong></p> <p>Whenever a user replaces a duplicate question on their private survey with a suggested replacement question, the replacement question is linked to the private survey. The following list shows which fields will change:</p> <ul> <li>Question Name</li> <li>Question Description</li> <li>Response Type</li> <li>Question Category</li> <li>Question Subcategory</li> <li>Code Mappings</li> </ul> <p>The following fields and relationships will not change:</p> <ul> <li>Response Set (if choice question)</li> <li>Program Defined Variable Name</li> </ul> <p><strong>Note: </strong>Since there are many valid question and response set pairs, questions and response sets are assessed independently using the curation wizard. For instance, a program can harmonize a question (like ‘How old are you?’) with another program while choosing to use a different valid response set than that same program (like 5-year age categories compared to 10-year age categories).</p> <p><strong>Response Sets</strong></p> <p>Whenever a user replaces a duplicate response set on their private survey with a suggested replacement response set, the replacement response set is linked to the private survey. The following list shows which fields will change:</p> <ul> <li>Response Set Name</li> <li>Response Set Description</li> <li>Responses</li> </ul> <p><strong>Curation Wizard Match Score Algorithm</strong></p> <p>The match score algorithm identifies questions and response sets in the SDP-V repository that are like content on a user’s survey based on a match of at least 75% overlap in the fields.</p> <p>The match score algorithm compares the following fields to find similar questions:</p> <ul> <li>Question Name</li> <li>Question Description</li> <li>Question Category and Subcategory</li> <li>Code Mappings and Code System</li> </ul> <p>The match score algorithm compares the following fields to find similar response sets:</p> <ul> <li>Response Set Name</li> <li>Response Description</li> <li>Responses and Response Code Systems</li> </ul> </div> ); } importInstructions() { return( <div className="tab-pane" id="import" role="tabpanel" aria-hidden={this.state.selectedInstruction !== 'import'} aria-labelledby="import-tab"> <h1 id="import-content">Importing Content</h1> <br/> <ul> <li><a href="#message-mapping-guide">Importing Message Mapping Guide (MMG) Data Elements and Value Sets</a> <ol> <li><a href="#message-mapping-guide-import-MMG">How to Import MMG Content Through SDP-V User Interface</a></li> <li><a href="#message-mapping-import-requirements">MMG Spreadsheet Import Template Content and Formatting Requirements</a></li> <li><a href="#MMG-content-organization">Content Organization: How to Identify Sections, Templates, or Repeating Groups within the MMG Spreadsheet Import Template</a></li> </ol> </li> <li><a href="#generic-spreadsheet-guide">Importing Questions and Response Sets Using SDP-V Generic Import Template</a> <ol> <li><a href="#generic-spreadsheet-import">How to Import Content using the Generic Import Template through the SDP-V User Interface</a></li> <li><a href="#generic-content-organization">Content Organization: How to Identify Sections, Templates, or Repeating Groups within the Generic Spreadsheet Import Template</a></li> <li><a href="#generic-associate-rs">How to Associate Response Sets with Choice Questions on Import</a></li> <li><a href="#generic-local-rs">How to Create User-defined (“Local”) Response Sets Using the SDP-V Import Template</a></li> <li><a href="#generic-add-code-system-mappings">How to Add Multiple Code System Mappings to Content Using the SDP-V Import Template</a></li> </ol> </li> </ul> <h3><p id="message-mapping-guide">Importing Message Mapping Guide (MMG) Data Elements and Value Sets</p></h3> <p>This feature is to support the bulk import of vocabulary content from Nationally Notifiable Disease Message Mapping Guides (MMGs).</p> <h4><strong><p id="message-mapping-guide-import-MMG">How to Import MMG Content Through SDP-V User Interface</p></strong></h4> <p>On the taskbar, there is an action button to create content. To create a SDP-V survey using content from a Message Mapping Guide (MMG) formatted spreadsheet, execute the following steps:</p> <ul> <li>Click on the 'Create' button on the Vocabulary service taskbar and select 'Import Spreadsheet'</li> <li>Select the MMG formatted file you wish to import by clicking 'Choose File' </li> <li>Select ‘MMG Import’ as the format of the file you wish to import </li> </ul> <br/> <h4><p id="message-mapping-import-requirements"><strong>MMG Spreadsheet Import Template Content and Formatting Requirements</strong></p></h4> <p>The following table shows the expected MMG Column Names and how they map to Vocabulary Service. <strong>Each column is necessary for import, even if left blank. Each column should be spelled exactly as appears in quotes in the table below.</strong> </p> <br/> <table className="set-table table"> <caption><strong>Table 1. MMG Import: Required Spreadsheet Column Names and Associated Vocabulary Service Item on Import</strong></caption> <thead> <tr> <th id="mmg-display-name-column">MMG Import Column Name</th> <th id="vocab-service-item-column">Vocabulary Service Item</th> </tr> </thead> <tbody> <tr> <td headers="mmg-display-name-column">'Data Element (DE) Name'</td> <td headers="vocab-service-item-column">Question Name and ‘Concept Name Column’ in Code System Mappings Table on Question Details</td> </tr> <tr> <td headers="mmg-display-name-column">'DE Identifier Sent in HL7 Message'</td> <td headers="vocab-service-item-column">Concept Identifier’ Column in Code System Mappings Tableon Question Details Page*</td> </tr> <tr> <td headers="mmg-display-name-column">'Data Element Description'</td> <td headers="vocab-service-item-column">Question Description</td> </tr> <tr> <td headers="mmg-display-name-column">'DE Code System'</td> <td headers="vocab-service-item-column">‘Code System Identifier’ Column in Code System Mappings Table on Question Details Page *</td> </tr> <tr> <td headers="mmg-display-name-column">'Value Set Name (VADS Hyperlink)'</td> <td headers="vocab-service-item-column"><p>Response Set </p>Note: A data element will be associated with a PHIN VADS value set in SDP-V if a valid PHIN VADS hyperlink is provided in the same row of the SDP-V MMG import spreadsheet. The hyperlink provided in the cell must be in the following format to be recognized by the SDP-V MMG Importer: https://phinvads.cdc.gov/vads/ViewValueSet.action?oid=2.16.840.1.114222.4.11.819. The PHIN VADS URL must end in “oid=identifier” in order to be accurately parsed by the importer. Embedded hyperlinks such as ‘Yes No Indicator (HL7)’ will not be recognized by the importer; this will result in the question not being linked to the appropriate PHIN VADS value set in SDP-V. <br/> If a valid PHIN VADS hyperlink is not provided, the SDP-V MMG importer will look for a tab with the same name as the value in this cell. The value set tab is expected to contain the value set values organized into the following column headers: ‘Concept Code’, ‘Concept Name’, ‘Code System OID’, ‘Code System Name’, and ‘Code System Version’. If a tab with the same name is not found, an error message will be displayed. </td> </tr> <tr> <td headers="mmg-display-name-column">'PHIN Variable Code System' OR 'Local Variable Code System'</td> <td headers="vocab-service-item-column">Program Defined Variable Name associated with a question</td> </tr> <tr> <td headers="mmg-display-name-column">'Data Type'</td> <td headers="vocab-service-item-column">Question Response Type</td> </tr> </tbody> </table><br/> <ul> <li>The content in each tab in the spreadsheet that contains all required columns will be imported and tagged with the 'Tab Name'.</li> <li>If there are multiple spreadsheets that contain all required columns, they will be imported as separate sections on the same SDP-V survey.</li> <li>The user importing content into SDP-V using this template will be assigned as the author of the survey. This SDP-V survey can then be added to a collaborative authoring group in the service to provide access to additional authors. </li> <li>Content will be imported into SDP-V in ‘Private’ workflow status and “Draft” content stage.</li> </ul> <br/> <p><strong>NOTE:</strong> If a required column from the table is missing, the user will receive an error message and the content will not be imported.</p> <br/> <h4 id="MMG-content-organization"><p><strong>Content Organization: How to Identify Sections, Templates, or Repeating Groups within the MMG Spreadsheet Import Template</strong></p></h4> <p> Sections, templates, or repeating groups are created by listing data elements between 'START: insert section name' and 'END: insert section name' rows; the ‘START’ and ‘END’ markers must be in the ‘PHIN Variable’ column. Each row between these markers are imported as data elements within that grouping (called sections in the vocabulary service). Sub-sections or sub-groupings may be created by including additional 'START: ' and 'END: ' markers within a parent section or grouping. </p> <ul> <li>The beginning of a section is indicated by the prefix 'START: ' (including a space after the colon) in the 'PHIN Variable' column</li> <li>The end of a section is indicated by the prefix 'END: '(including a space after the colon) in the 'PHIN Variable' column</li> <li> The text following the 'START: ' and 'END: ' pre-fixes will be imported as the Section Name in the vocabulary service <ul> <li>Example: Data element information in rows between START: Laboratory and END: Laboratory markers will be imported into SDP-V as a group of questions and associated response sets into a Section called “Laboratory”.</li> </ul> </li> <li>The section name following the 'START: ' prefix must exactly match the section name following the 'END: ' prefix in order for the section to be correctly imported. </li> <li>Notes should not be included in the same row as the section name (e.g., after the ‘START:’ or ‘END:’ pre-fixes’)</li> <li>Text following a ‘NOTE:’ pre-fix will not be imported. </li> </ul> <br/> <br/> <h3><p id="generic-spreadsheet-guide">Importing Questions and Response Sets Using SDP-V Generic Import Template</p></h3> <br/> <p>The purpose of this feature is to support the creation of SDP-V surveys by importing large amounts of questions and response sets from existing data dictionaries, surveys, and other formats into the SDP Vocabulary Service (SDP-V) using a spreadsheet template.</p> <br/> <h4><p id="generic-spreadsheet-import"><strong>i. How to Import Content Using the Generic Import Template through the SDP-V User Interface</strong></p></h4> <p>On the taskbar, there is an action button to create content. To create a SDP-V survey using content from the generic SDP-V template formatted spreadsheet, execute the following steps:</p> <ol> <li>Click on the 'Create' button on the Vocabulary service taskbar and select 'Import Spreadsheet'</li> <li>Select the SDP-V template formatted file you wish to import by clicking 'Choose File'</li> <li>Select 'Generic Import' as the format of the file you wish to import</li> </ol> <p>The following tables lists the Generic Import Column Names and the import priority. <strong>Each required column is necessary for import, even if left blank. Each column should be spelled exactly as appears in quotes in the table below.</strong> The generic import column names map directly to the Vocabulary Service items (e.g., 'Question Description' in Generic SDP-V template spreadsheet imported as 'Question Description' in SDP-V). </p> <table className="set-table table"> <caption><strong>Table 2A. SDP-V Generic Import: Spreadsheet Column Names, Priority and Description - Survey Metadata Tab </strong></caption> <thead> <tr> <th id="generic-display-name-column">'Survey Metadata' Tab Column Headers</th> <th id="generic-display-priority">Priority</th> <th id="generic-display-desc">Description</th> </tr> </thead> <tbody> <tr> <td headers="generic-display-name-column">'Survey Name (R)'</td> <td headers="generic-display-priority">Required</td> <td headers="generic-display-desc">The information contained in this column on the 'Survey Metadata' tab is imported as the Survey name</td> </tr> <tr> <td headers="generic-display-name-column">'Survey Description (O)'</td> <td headers="generic-display-priority">Optional</td> <td headers="generic-display-desc">The information contained in this column on the ‘Survey Metadata’ tab is imported as the Survey description. This information can alternatively be added through the SDP-V user interface after import.</td> </tr> <tr> <td headers="generic-display-name-column">‘Survey Keyword Tags (O)’</td> <td headers="generic-display-priority">Optional</td> <td headers="generic-display-desc">Tags are text strings that are either keywords or short phrases created by users to facilitate content discovery, organization, and reuse. For instance, a survey called “Traumatic brain injury” may be tagged with “Concussion” to help other users find that survey who may not think of searching for the term “traumatic brain injury”. Multiple keyword tags can be separated with semicolon. </td> </tr> <tr> <td headers="generic-display-name-column">‘Concept Name (C)’</td> <td headers="generic-display-priority">Conditional</td> <td headers="generic-display-desc">Term from a controlled vocabulary to designate a unit of meaning or idea (e.g., ‘Genus Salmonella (organism)’). A controlled vocabulary includes external code systems, such as LOINC or SNOMED-CT, or internally developed vocabularies such as PHIN VADS. For each row that has data entered in this column, the following additional columns are required: Concept Identifier (C) and Code System Identifier (C). </td> </tr> <tr> <td headers="generic-display-name-column">‘Concept Identifier (C)’</td> <td headers="generic-display-priority">Conditional</td> <td headers="generic-display-desc">This is text or a code used to uniquely identify a concept in a controlled vocabulary (e.g., 27268008). Note that if you have selected a code system mapping that has already been used in SDP-V or is selected from the results from "Search for external coded items", this field will be automatically populated. For each row that has data entered in this column, the following additional columns are required: Concept Name (C) and Code System Identifier (C).</td> </tr> <tr> <td headers="generic-display-name-column">‘Code System Identifier (C)’</td> <td headers="generic-display-priority">Conditional</td> <td headers="generic-display-desc">This is the unique designator for a code system also referred to as a controlled vocabulary, in which concepts and value sets are defined (e.g. 2.16.840.1.113883.6.96). LOINC, SNOMED-CT, and RxNorm are code systems. Note that if you have mapped a code system to a question or response set that has already been mapped in SDP-V or returned from an external code system search, the code system identifier field will be automatically populated. For each row that has data entered in this column, the following additional columns are required: Concept Name (C) and Concept Identifier (C).</td> </tr> <tr> <td headers="generic-display-name-column">‘Code System Mappings Table (O)’</td> <td headers="generic-display-priority">Optional</td> <td headers="generic-display-desc">ONLY use when associating MORE THAN ONE code system mapping per item (e.g., survey, section, or question). A user can create multiple Code System Mappings for a single items (survey, section, question) by creating Code System Mappings tables on separate tabs within the SDP-V generic import spreadsheet. After import, the SDP-V item details page will be populated with values from a code system mappings table where the value in this cell matches the name of a tab in the import spreadsheet with the naming convention "CSM #", where # is a number assigned by the user to identify the mappings table in this template (e.g., CSM 1, CSM 2, CSM 3...). The CSM tab must contain the following headers (described above): Concept Name (R), Concept Identifier (R), and Code System Identifier (R). </td> </tr> </tbody> </table> <table className="set-table table"> <caption><strong>Table 2B. SDP-V Generic Import: Spreadsheet Column Names, Priority and Description - Section Metadata Tab </strong></caption> <thead> <tr> <th id="generic-display-name-column-b">'Section Metadata' Tab Column Headers</th> <th id="generic-display-priority-b">Priority</th> <th id="generic-display-desc-b">Description</th> </tr> </thead> <tbody> <tr> <td headers="generic-display-name-column-b">'Section Name (R)'</td> <td headers="generic-display-priority-b">Required</td> <td headers="generic-display-desc-b">The information contained in this column on the 'Section Metadata' tab is imported as the Section name</td> </tr> <tr> <td headers="generic-display-name-column-b">'Section Description (O)'</td> <td headers="generic-display-priority-b">Optional</td> <td headers="generic-display-desc-b">The information contained in this column on the ‘Section Metadata’ tab is imported as the Section description. This information can alternatively be added through the SDP-V user interface after import.</td> </tr> <tr> <td headers="generic-display-name-column-b">‘Section Keyword Tags’ (O)</td> <td headers="generic-display-priority-b">Optional</td> <td headers="generic-display-desc-b">Tags are text strings that are either keywords or short phrases created by users to facilitate content discovery, organization, and reuse. For instance, a section called “Prescription Drug Misuse and Abuse” may be tagged with “Opioid” to help other users find that section who may not think of searching for the term “prescription drug”. Multiple keyword tags can be separated with semicolon. </td> </tr> <tr> <td headers="generic-display-name-column-b-b">'Concept Name (C)'</td> <td headers="generic-display-priority-b">Conditional</td> <td headers="generic-display-desc-b">Term from a controlled vocabulary to designate a unit of meaning or idea (e.g., ‘Genus Salmonella (organism)’). A controlled vocabulary includes external code systems, such as LOINC or SNOMED-CT, or internally developed vocabularies such as PHIN VADS. For each row that has data entered in this column, the following additional columns are required: Concept Identifier (C) and Code System Identifier (C). </td> </tr> <tr> <td headers="generic-display-name-column-b">'Concept Identifier (C)'</td> <td headers="generic-display-priority-b">Conditional</td> <td headers="generic-display-desc-b">This is text or a code used to uniquely identify a concept in a controlled vocabulary (e.g., 27268008). Note that if you have selected a code system mapping that has already been used in SDP-V or is selected from the results from "Search for external coded items", this field will be automatically populated. For each row that has data entered in this column, the following additional columns are required: Concept Name (C) and Code System Identifier (C).</td> </tr> <tr> <td headers="generic-display-name-column-b">'Code System Identifier (C)'</td> <td headers="generic-display-priority-b">Conditional</td> <td headers="generic-display-desc-b">This is the unique designator for a code system also referred to as a controlled vocabulary, in which concepts and value sets are defined (e.g. 2.16.840.1.113883.6.96). LOINC, SNOMED-CT, and RxNorm are code systems. Note that if you have mapped a code system to a question or response set that has already been mapped in SDP-V or returned from an external code system search, the code system identifier field will be automatically populated. For each row that has data entered in this column, the following additional columns are required: Concept Name (C) and Concept Identifier (C).</td> </tr> <tr> <td headers="generic-display-name-column-b">'Code System Mappings Table (O)'</td> <td headers="generic-display-priority-b">Optional</td> <td headers="generic-display-desc-b">ONLY use when associating MORE THAN ONE code system mapping per item (e.g., survey, section, or question). A user can create multiple Code System Mappings for a single items (survey, section, question) by creating Code System Mappings tables on separate tabs within the SDP-V generic import spreadsheet. After import, the SDP-V item details page will be populated with values from a code system mappings table where the value in this cell matches the name of a tab in the import spreadsheet with the naming convention "CSM #", where # is a number assigned by the user to identify the mappings table in this template (e.g., CSM 1, CSM 2, CSM 3...). The CSM tab must contain the following headers (described above): Concept Name (R), Concept Identifier (R), and Code System Identifier (R). </td> </tr> </tbody> </table> <table className="set-table table"> <caption><strong>Table 2C. SDP-V Generic Import: Spreadsheet Column Names, Priority and Description - Survey Questions Tab </strong></caption> <thead> <tr> <th id="generic-display-name-column-c">'Survey Questions' Tab Column Headers</th> <th id="generic-display-priority-c">Priority</th> <th id="generic-display-desc-c">Description</th> </tr> </thead> <tbody> <tr> <td headers="generic-display-name-column-c">'Question Text (R)'</td> <td headers="generic-display-priority-c">Required</td> <td headers="generic-display-desc-c">Each row between Section ‘START:’ and ‘END’ markers will be imported as questions within that section. Questions must be associated with a section in SDP-V.</td> </tr> <tr> <td headers="generic-display-name-column-c">'Question Description (R)'</td> <td headers="generic-display-priority-c">Required</td> <td headers="generic-display-desc-c">The information contained in this column is imported as the question description.</td> </tr> <tr> <td headers="generic-display-name-column-c">'Question Response Type (R)'</td> <td headers="generic-display-priority-c">Required</td> <td headers="generic-display-desc-c">The information contained in this column is imported as the question response type. <ul> <li>The allowed response types are: Attachment, Boolean, Choice, Date, Date Time, Decimal, Instant, Integer, Open Choice, Quantity, Reference, String, Text, Time, or URL</li> <li>The 14 allowed response types are defined at https://www.hl7.org/fhir/valueset-item-type.html </li> </ul> </td> </tr> <tr> <td headers="generic-display-name-column-c">‘Other Allowed? (O)’</td> <td headers="generic-display-priority-c">Optional</td> <td headers="generic-display-desc-c">This attribute can only be used for Choice type questions and allows users to indicated if “Other” is an allowed response option in addition to the values specified in a defined response set. For choice type questions, allowed values in the import template are "Yes" or "No". If this cell is left blank or “No” is specified, then the “Other allowed?” attribute will be null. If this cell in the import spreadsheet includes the value “Yes”, the “Other allowed?” attribute will be checked on import for the indicated question.</td> </tr> <tr> <td headers="generic-display-name-column-c">'Response Set Name (I)'</td> <td headers="generic-display-priority-c">Informational</td> <td headers="generic-display-desc-c">This column is to help the user of the template catalog the local response set tables that are being created in the Response Set tabs. The information in this column is for workflow purposes only and will not be imported. The Response Set Name will be assigned to local response sets based on values in the response set tables in each response set tab.</td> </tr> <tr> <td headers="generic-display-name-column-c">'Local Response Set Table (C)'</td> <td headers="generic-display-priority-c">Conditional</td> <td headers="generic-display-desc-c">The information contained in this column allows a user to specify a PHIN VADS value set to associate with a question or to create a new response set in SDP-V to be associated with the question on import (referred to as a local response set) if one does not already exist in the repository.<br/> <strong>Associate a question with an existing PHIN VADS value set:</strong> <ul> <li>Enter the PHIN VADS URL in the cell.</li> <li>If you provide a PHIN VADS URL, the value set information will be parsed from PHIN VADS and linked to the appropriate question in SDP-V upon import. The PHIN VADS URL must contain “oid= identifier” in order to be accurately parsed by the importer. </li> <ul> <li>An example of a valid PHIN VADS URL is: https://phinvads.cdc.gov/vads/ViewValueSet.action?oid=2.16.840.1.114222.4.11.7552</li> </ul> <li>Alternatively, PHIN VADS value sets can be found by searching SDP-V and linking them with the question through the user interface after the SDP-V survey has been created on import.</li> <li>If this column is left blank, the content owner will be able to add response set information to questions through the SDP-V user interface after import.</li> </ul> <br/> <strong>Create and associate a local response set on import:</strong> <ul> <li>A local response set will be created on import and associated with the question in the same row where the value in this cell matches the name of a tab in the spreadsheet with the naming convention 'RS ID#', where ID# is a number assigned by the user to identify the response set in this template (e.g., RS 1, RS 2, RS 3...) <ul><li>The RS ID# tab will contain the response set table that will be imported as the response set</li></ul> </li> </ul> Note: A user may create as many local response sets as needed, but it is best practice to check SDP-V for existing response sets before doing so to prevent creating duplicate response sets in SDP-V. </td> </tr> <tr> <td headers="generic-display-name-column-c">'Question Category (O)'</td> <td headers="generic-display-priority-c">Optional</td> <td headers="generic-display-desc-c">The information contained in this column is imported as the Question Category. <ul><li>The following are allowed values: Screening, Clinical, Demographics, Treatment, Laboratory, Epidemiological, Vaccine, or Public Health Emergency Preparedness & Response</li></ul> Note: This information is optional, but it is best practice to complete it since it will help other users find related content within SDP-V.</td> </tr> <tr> <td headers="generic-display-name-column-c">'Question Subcategory (O)'</td> <td headers="generic-display-priority-c">Optional</td> <td headers="generic-display-desc-c">The information contained in this column is imported as the Question Subcategory. <ul> <li>The Question Subcategory field is only valid if the Question Category is either "Epidemiological" or "Emergency Preparedness". <ul> <li>The following are allowed values for "Epidemiological" category: Travel, Contact or Exposure, Drug Abuse, or Sexual Behavior. </li> <li>The following are allowed values for "Emergency Preparedness" category: Managing & Commanding, Operations, Planning/Intelligence, Logistics, and Financial/Administration.</li> </ul> </li> </ul> Note: This information is optional, but it is best practice to complete since it will help other users find related content within SDP-V. </td> </tr> <tr> <td headers="generic-display-name-column-c">'Question Data Collection Method (O)'</td> <td headers="generic-display-priority-c">Optional</td> <td headers="generic-display-desc-c">The purpose of this attribute is to help other authors quickly find questions that were used to collect data from a source in a similar manner (e.g., phone interview vs paper-based survey vs electronic data exchange). The Data Collection Method attribute should represent the manner in which the question is used to collect data in a real-world setting. This is not necessarily the same as how CDC is receiving the data. For instance, a question on a survey may be worded to collect information from respondents over the phone, but respondent information may be sent to CDC in an electronic file; in this case, “Facilitated by Interviewer (Phone)” should be selected as the Data Collection Method rather than “electronic (machine to machine). The allowed values for this attribute are: Electronic (e.g., machine to machine), Record review, Self-administered (Web or Mobile), Self-Administered (Paper), Facilitated by Interviewer (Phone) and Facilitated by Interviewer (In-Person). In the import spreadsheet, one value can be specified. After import, the user can select multiple values in the UI. </td> </tr> <tr> <td headers="generic-display-name-column-c">'Question Content Stage (O)'</td> <td headers="generic-display-priority-c">Optional</td> <td headers="generic-display-desc-c"> An attribute of the content being presented that represents content maturity. The content stage attribute offers users flexibility to accurately communicate the maturity of their content at different stages of the vocabulary life cycle with other users. If this field is left blank, the question will be imported in the “draft” content stage. Users may also select “comment only” or “trial use. Content stages are defined as follows: <br/><strong>DRAFT</strong> – Content that is being worked on by its Authors and Publisher. It is generally not considered to be “complete” and unlikely ready for comment. Content at this Level should not be used. <br/><strong>COMMENT ONLY</strong> – Content that is being worked on by its Authors and Publisher. It is generally not considered to be “complete” but is ready for viewing and comment. Content at this Level should not be used. <br/><strong>TRIAL USE</strong> – Content that the Authors and Publisher believe is ready for User viewing, testing and/or comment. It is generally “complete”, but not final. Content at this Level should not be used to support public health response. </td> </tr> <tr> <td headers="generic-display-name-column-c">'Question Keyword Tags (O)'</td> <td headers="generic-display-priority-c">Optional</td> <td headers="generic-display-desc-c">Tags are text strings that are either keywords or short phrases created by users to facilitate content discovery, organization, and reuse. For instance, a question about “Prescription Drug Misuse and Abuse” may be tagged with “Opioid” to help other users find that question who may not think of searching for the term “prescription drug”. Multiple keyword tags can be separated with semicolon. </td> </tr> <tr> <td headers="generic-display-name-column-c">'Program Defined Variable Name (O)'</td> <td headers="generic-display-priority-c">Optional</td> <td headers="generic-display-desc-c">Program-defined Variable Name is associated with questions at the section level. The purpose of this is to allow each program to use its local program variable names to identify a question, such as those used in data analysis by a program, without changing the properties of the question itself. Since this attribute is not a property of the question, it allows for users across SDP-V to reuse the same questions while allowing programs to meet its use case requirements. </td> </tr> <tr> <td headers="generic-display-name-column-c">'Concept Name (C)'</td> <td headers="generic-display-priority-c">Conditional</td> <td headers="generic-display-desc-c">Term from a controlled vocabulary to designate a unit of meaning or idea (e.g., ‘Genus Salmonella (organism)’). A controlled vocabulary includes external code systems, such as LOINC or SNOMED-CT, or internally developed vocabularies such as PHIN VADS. For each row that has data entered in this column, the following additional columns are required: Concept Identifier (C) and Code System Identifier (C). </td> </tr> <tr> <td headers="generic-display-name-column-c">'Concept Identifier (C)'</td> <td headers="generic-display-priority-c">Conditional</td> <td headers="generic-display-desc-c">This is text or a code used to uniquely identify a concept in a controlled vocabulary (e.g., 27268008). Note that if you have selected a code system mapping that has already been used in SDP-V or is selected from the results from "Search for external coded items", this field will be automatically populated. For each row that has data entered in this column, the following additional columns are required: Concept Name (C) and Code System Identifier (C).</td> </tr> <tr> <td headers="generic-display-name-column-c">'Code System Identifier (C)'</td> <td headers="generic-display-priority-c">Conditional</td> <td headers="generic-display-desc-c">This is the unique designator for a code system also referred to as a controlled vocabulary, in which concepts and value sets are defined (e.g. 2.16.840.1.113883.6.96). LOINC, SNOMED-CT, and RxNorm are code systems. Note that if you have mapped a code system to a question or response set that has already been mapped in SDP-V or returned from an external code system search, the code system identifier field will be automatically populated. For each row that has data entered in this column, the following additional columns are required: Concept Name (C) and Concept Identifier (C).</td> </tr> <tr> <td headers="generic-display-name-column-c">'Code System Mappings Table (O)'</td> <td headers="generic-display-priority-c">Optional</td> <td headers="generic-display-desc-c">The purpose of Tags is to facilitate content discovery and reuse. A user can create tags by creating tags tables on separate tabs within the SDP-V generic import spreadsheet. A question will be tagged with values from a tag table where the value in this cell matches the name of a tab in the spreadsheet with the naming convention "CSM #", where # is a number assigned by the user to identify the tags table in this template (e.g., CSM 1, CSM 2, CSM 3...).</td> </tr> <tr> <td headers="generic-display-name-column-c">'RS Notes (I)'</td> <td headers="generic-display-priority-c">Informational</td> <td headers="generic-display-desc-c">This column is to help the user of the template keep track of actions that may need to be completed after imported, such as the need to extend an existing response set in SDP-V. The information in this column is for workflow purposes and will not be imported.</td> </tr> </tbody> </table><br/> <p>The content in each tab in the spreadsheet that contains all required columns will be imported and tagged with the “Tab Name”. If there are multiple spreadsheets that contain all required columns, they will be imported as separate sections on the same SDP-V survey.</p> <p><strong>NOTE:</strong> If a required column from the table is missing, the user will receive an error message and the content will not be imported.</p> <br/> <h4 id="generic-content-organization"><p><strong>Content Organization: How to Identify Sections, Templates, or Repeating Groups within the Generic Spreadsheet Import Template</strong></p></h4> <p>Sections, templates, or repeating groups are created by listing data elements between 'START: insert section name' and 'END: insert section name' rows. Each row between these markers are imported as data elements within that grouping (called sections in the vocabulary service). Sub-sections or sub-groupings may be created by including additional 'START: ' and 'END: ' markers within a parent section or grouping</p> <ul> <li>The beginning of a section is indicated by the prefix 'START: ' (including a space after the colon)</li> <li>The end of a section is indicated by the prefix 'END: '(including a space after the colon)</li> <li>The text following the 'START: ' and 'END: ' pre-fixes will be imported as the Section Name in the vocabulary service</li> <li>The section name following the 'START: ' prefix must exactly match the section name following the 'END: ' prefix in order for the section to be correctly imported. </li> <li>Notes should not be included in the same row as the section name (e.g., after the ‘START:’ or ‘END:’ pre-fixes’)</li> <li>Text following a ‘NOTE:’ pre-fix will not be imported. </li> </ul> <br/> <h4 id="generic-associate-rs"><strong>How to Associate Response Sets with Choice Questions on Import</strong></h4> <p><strong>There are 3 options for Choice Questions for import into SDP-V:</strong></p> <ol> <li>A PHIN VADS response value can be associated with a question by providing a valid PHIN VADS value set URL <ul> <li>If you provide a PHIN VADS URL, the value set information will be parsed from PHIN VADS and linked to the appropriate question in SDP-V upon import. The PHIN VADS URL must contain “oid= identifier” in order to be accurately parsed by the importer. </li> <li>An example of a valid PHIN VADS URL is: https://phinvads.cdc.gov/vads/ViewValueSet.action?oid=2.16.840.1.114222.4.11.7552</li> </ul> </li> <li>A local response set can be created in the template and associated with the appropriate question on import. </li> <li>The response set information can be left blank and the user can add response information through the SDP-V user interface</li> </ol> <p><strong>BEST PRACTICE:</strong> Check SDP-V for existing response sets before importing local response sets to prevent creating duplicate response sets in SDP-V. The SDP Vocabulary Service imports value sets from PHIN VADS on a weekly basis and other users have added response sets which are available to be reused or extended within SDP-V. Where applicable, existing SDP-V response sets should be reused or extended before creating new ones; this will allow SDP-V to show the relationship between response set and program and surveillance system usage. This will allow other users to see which response sets are most commonly used.</p> <br/> <h4 id="generic-local-rs"><strong>How to Create User-defined (“Local”) Response Sets Using the SDP-V Import Template</strong></h4> <p>A "local" response set is a response set defined within this template and does not already exist in either SDP-V or PHIN VADS. "Local" tells the importer to look for a response set tab within this template for more information.</p> <ol><li><strong>Populate Distinct Response Set Information on Separate Response Set Tabs in the Spreadsheet (Tab naming convention: RS #)</strong></li> <br/> <table className="set-table table"> <caption><strong>Table 3. Response Set Tab Column Listings</strong></caption> <thead> <tr> <th id="generic-rs-name-column">Column Name</th> <th id="generic-rs-description-column">Description</th> </tr> </thead> <tbody> <tr> <td headers="generic-rs-name-column">Response Set Name (R)</td> <td headers="generic-rs-description-column">The information contained in the first cell is imported as the ‘Response Set Name’.</td> </tr> <tr> <td headers="generic-rs-name-column">Response Set Description (O)</td> <td headers="generic-rs-description-column">The information contained in this column is imported as the ‘Response Set Description’ values in the response set table created in SDP-V. </td> </tr> <tr> <td headers="generic-rs-name-column">Display Name (R)</td> <td headers="generic-rs-description-column">The information contained in this column is imported as the ‘Display Name’ values in the response set table created in SDP-V. </td> </tr> <tr> <td headers="generic-rs-name-column">Response (R)</td> <td headers="generic-rs-description-column">The information contained in this column is imported as the ‘Response’ values in the response set table created in SDP-V.</td> </tr> <tr> <td headers="generic-rs-name-column">Code System Identifier (optional)</td> <td headers="generic-rs-description-column">The information contained in this column is imported as the ‘Code System Identifier (optional)’ values in the response set table created in SDP-V.</td> </tr> </tbody> </table> <br/> <li><strong>2. Associate response set table #’s with appropriate question by entering the following values in the same row as the question text:</strong></li> <ul> <li>‘Local Response Set Table (C)’ (column F) – A local response set will be associated with the question in the same row where the value in this cell matches the name of a tab in the spreadsheet with the naming convention RS ID#, where ID# is a number assigned by the user to identify the response set in this template (e.g., RS 1, RS 2, RS 3...) <ul><li>The tab name identifies where the response set table information for a question is located</li></ul> </li> </ul> </ol> <br/> <h4 id="generic-add-code-system-mappings"><strong>How to Add Multiple Code System Mappings to Content Using the SDP-V Import Template</strong></h4> <p> The purpose of Code System Mappings (CSM) is to identify the governed concepts from code systems like LOINC, SNOMED, PHIN VADS, etc that are associated with response sets, questions, sections, or surveys in SDP-V. That is, the Code System Mappings table identifies how content in SDP-V is represented in another code system. <br/> A user can create a single mapping by filling in the Concept Name, Concept Identifier, and Code System Identifier cells on each tab for the respective content (e.g., question, section, or survey). However, in some cases, a user may want to map their content to multiple representations. The SDP-V Generic Importer supports multiple Code Systems Mappings; to import multiple CSM, you will need to create CSM tables on separate tabs within the SDP-V generic import spreadsheet. This feature should only be used when associating MORE THAN ONE code system mapping per item (e.g., survey, section, or question). Alternatively, users can add the CSMs manually through the UI. </p> <ol><li><strong>1. Populate Code System Mappings Tables on Separate Tabs in the Spreadsheet (Tab naming convention: CSM #)</strong></li> <table className="set-table table"> <caption><strong>Table 4. Response Set Tab Column Listings</strong></caption> <thead> <tr> <th id="generic-tag-name-column">Column Name</th> <th id="generic-tag-description-column">Description</th> </tr> </thead> <tbody> <tr> <td headers="generic-tag-name-column">Concept Name (R)</td> <td headers="generic-tag-description-column">Term from a controlled vocabulary to designate a unit of meaning or idea (e.g., ‘Genus Salmonella (organism)’). A controlled vocabulary includes external code systems, such as LOINC or SNOMED-CT, or internally developed vocabularies such as PHIN VADS. For each row that has data entered in this column, the following additional columns are required: Concept Identifier (C) and Code System Identifier (C). </td> </tr> <tr> <td headers="generic-tag-name-column">Concept Identifier (R)</td> <td headers="generic-tag-description-column">This is text or a code used to uniquely identify a concept in a controlled vocabulary (e.g., 27268008). Note that if you have selected a code system mapping that has already been used in SDP-V or is selected from the results from "Search for external coded items", this field will be automatically populated. For each row that has data entered in this column, the following additional columns are required: Concept Name (C) and Code System Identifier (C).</td> </tr> <tr> <td headers="generic-tag-name-column">Code System Identifier (optional)</td> <td headers="generic-tag-description-column">This is the unique designator for a code system also referred to as a controlled vocabulary, in which concepts and value sets are defined (e.g. 2.16.840.1.113883.6.96). LOINC, SNOMED-CT, and RxNorm are code systems. Note that if you have mapped a code system to a question or response set that has already been mapped in SDP-V or returned from an external code system search, the code system identifier field will be automatically populated. For each row that has data entered in this column, the following additional columns are required: Concept Name (C) and Concept Identifier (C).</td> </tr> </tbody> </table> <br/> <li><strong>2. Associate CSM tables #’s with appropriate Question, Section, or Survey by entering the following values in the same row as the mapped content:</strong></li> <ul> <li>‘Code System Mappings Table (O)’– After import, the SDP-V item details page will be populated with values from the code system mappings table where the value in this cell matches the name of a tab in the import spreadsheet with the naming convention "CSM #", where # is a number assigned by the user to identify the mappings table in this template (e.g., CSM 1, CSM 2, CSM 3...). The CSM tab must contain the following headers (described above): Concept Name (R), Concept Identifier (R), and Code System Identifier (R). <ul><li>The tab name identifies where the CMS table information for a particular question, section, or survey is located in the import spreadsheet </li></ul> </li> </ul> </ol> </div> ); } taggingInstructions() { // Need to update this section with single word tagging instructions return( <div className="tab-pane" id="tagging" role="tabpanel" aria-hidden={this.state.selectedInstruction !== 'tagging'} aria-labelledby="tagging-tab"> <h1 id="tagging-content">Keyword Tags</h1> <h2>Purpose</h2> <p>Tags are text strings that are either keywords or short phrases created by users to facilitate content discovery, organization, and reuse. For instance, a survey called “’Traumatic brain injury” may be tagged with “Concussion” to help other users find that survey who may not think of searching for the term “traumatic brain injury”.<br/>The purpose of tags is not to identify unique concept identifiers or code systems associated with specific content. To specify code system mappings for your vocabulary, please see the “Code System Mappings” help documentation for additional information.</p> <p><strong>Mutability: </strong>Since keyword tags should only be used to facilitate content discovery and organization, keyword tags can be changed (added or deleted) at any time by the author to meet user needs and to optimize search results. The history of tags is not saved and a new version of content is not created whenever tags are changed.</p> <p><strong>Discoverability: </strong>Tags are included in the dashboard search algorithm so other users can find content that has been tagged with the same keyword(s) entered in the dashboard search bar. </p> <p><strong>How to add a tag: </strong>Tags are listed near the top of the details page under either the response set, question, section or survey name and version number next to the “Tags:” header. Tags may be added or removed by selecting “Update Tags” on the right-side of the screen across from the “Tags:” header. Tags may be either a single word or a short keyword phrase. After selecting “Update Tags”, a tag may be created by simply typing a keyword or short phrase and hitting the “enter” or “tab” key between tag entries and then selecting “Save”. </p> <p><strong>How to remove a tag: </strong>After a tag is successfully created, the UI will wrap the tag in a green box and an “x” will appear allowing the user to delete the tag in the future. To remove a tag, simply click on the “x” next to tag (within the green wrapping) and then select “Save”. Alternatively, tags can be added or removed on the content edit page.</p> </div> ); } mappingInstructions() { // Need to update this section with single word tagging instructions return( <div className="tab-pane" id="mapping" role="tabpanel" aria-hidden={this.state.selectedInstruction !== 'mapping'} aria-labelledby="mapping-tab"> <h1 id="mapping-content">Code System Mappings Help</h1> <h2>Purpose</h2> <p>The purpose of the Code System Mappings table is to identify the governed concepts from code systems like LOINC, SNOMED, PHIN VADS, etc that are associated with response sets, questions, sections, or surveys in SDP-V. That is, the Code System Mappings table identifies how content in SDP-V is represented in another code system.<br/>The Code System Mappings table should only include mapping to governed concepts. Non-governed concepts or keywords should not be added to the Code System Mappings table. If you would like to add keywords to your response set, question, section, or survey to facilitate content discovery or organization, please see the “Keyword Tags” help documentation for information on how to use the “Tags” feature.</p> <p><strong>Mutability: </strong>Any changes to entries in the Code System Mappings table are versioned since code system mappings are a property of the vocabulary itself. This allows users to update the Code System Mappings while maintaining legacy mappings in older SDP-V content versions if needed.</p> <p><strong>Discoverability: </strong>Code System Mappings table fields are included in the dashboard search algorithm so other users can find questions, sections, and surveys with specific concept names, concept identifiers or code system identifiers in SDP-V. For instance, a user can enter “27268008” into the dashboard search box to find content in SDP-V associated with that concept identifier. </p> <h2>Definitions</h2> <p><strong>Concept Name: </strong>Term from a controlled vocabulary to designate a unit of meaning or idea (e.g., ‘Genus Salmonella (organism)’). A controlled vocabulary includes external code systems, such as LOINC or SNOMED-CT, or internally developed vocabularies such as PHIN VADS.</p> <p><strong>Concept Identifier: </strong>This is text or a code used to uniquely identify a concept in a controlled vocabulary (e.g., 27268008). Note that if you have selected a code system mapping that has already been used in SDP-V or is selected from the results from "Search for external coded items", this field will be automatically populated.</p> <p><strong>Code System Identifier: </strong>This is the unique designator for a code system also referred to as a controlled vocabulary, in which concepts and value sets are defined (e.g. 2.16.840.1.113883.6.96). LOINC, SNOMED-CT, and RxNorm are code systems. Note that if you have mapped a code system to a question or response set that has already been mapped in SDP-V or returned from an external code system search, the code system identifier field will be automatically populated.</p> <h2>Example Code System Mappings Table</h2> <table className="set-table table"> <caption><strong></strong></caption> <thead> <tr> <th id="concept-name">Concept Name</th> <th id="concept-identifier">Concept Identifier</th> <th id="code-sytem-identifier">Code System Identifier</th> </tr> </thead> <tbody> <tr> <td headers="concept-name">Genus Salmonella (organism)</td> <td headers="concept-identifier">27268008</td> <td headers="code-sytem-identifier">2.16.840.1.113883.6.96</td> </tr> <tr> <td headers="concept-name">Genus Campylobacter (organism)</td> <td headers="concept-identifier">35408001</td> <td headers="code-sytem-identifier">2.16.840.1.113883.6.96</td> </tr> </tbody> </table><br/> <p><strong>How to Search for Previously Used Code Mappings</strong><br/>To determine if a code system mapping has been used before in SDP-V, start typing in the concept name column of the table. A drop-down list of all previously used concept names that match the text entered in the field will appear. A user can navigate the list and select a concept name that was previously used. If a concept name is selected from the list, the concept identifier and code system identifier fields will be populated with existing values already entered in SDP-V.</p> <p><strong>How to Search for Code Mappings from an External Code Systems</strong><br/>Rather than requiring you to copy and paste codes from other code systems, SDP-V allows you to search for codes from specific external code systems by clicking on the “Search for external coded items” magnifying glass icon to the right of the code system mappings header. This opens the Search Codes dialog box. You may select a particular code system from the drop-down menu, or enter a search term to search across multiple code systems. This code search functionality searches codes from PHIN VADS. You may add coded values from these search results to the code mappings table by clicking the “Add” selection beside each result.</p> <p><strong>How to Create a New Code System Mapping</strong><br/>A new code system mapping may be created by simply typing a new concept name, concept identifier, and code system identifier. A new code mapping should only be created if an existing code mapping does not meet a user’s needs.</p> </div> ); } commentInstructions() { return( <div className="tab-pane" id="comment" role="tabpanel" aria-hidden={this.state.selectedInstruction !== 'comment'} aria-labelledby="comment-tab"> <h1 id="commenting-on-content">Commenting on Content</h1> <h2 id="public-comments">Public Comments</h2> <p>To post public comments, you must have a user account. Any comments posted will appear as posted “by user name”, where the user name that appears is the First Name and Last Name stored in the user profile.</p> <p><strong>Steps:</strong></p> <ul> <li>Login to SDP-V. </li> <li>Navigate to the details page of the content you wish to post public comments on</li> <li>Scroll down below the descriptive and linked content sections</li> <li>To start a new comment thread fill in the box immediately under the "Public Comments" header</li> <li>To reply to someone else's comment (which will automatically notify the user of your reply) click the "reply" link immediately under the comment</li> </ul> <h2 id="private-comments">Private Comments</h2> <p>Users can post comments about changes made to private draft content if they are either the author or a member of a collaborative authoring group with permission to edit the content. These comments are saved on the Change History tab and log the date and time that the comment was saved and the user who created it. Visibility of the Change History tab is restricted to authors, authoring group members, and publishers (e.g., private comments).</p> <p><strong>Steps:</strong></p> <ul> <li>Login to SDP-V</li> <li>Navigate to the details page of the private draft content you wish to post a private comment</li> <li>Select Edit</li> <li>Type in the “Notes/Comment About Changes Made (Optional)” textbox</li> <li>Click Save</li> <li>Comments will appear on the “Change History” tab on the Details page.</li> </ul> </div> ); } adminInstructions() { return( <div className="tab-pane" id="admin" role="tabpanel" aria-hidden={this.state.selectedInstruction !== 'admin'} aria-labelledby="admin-tab"> <h1 id="admin-panel">Admin Panel</h1> <p><strong>Getting to the panel (requires administrator role):</strong></p> <ul> <li>When logged in to an account with administrator privileges, navigate to the account dropdown (click the email and gear-icon link in the top right of the application)</li> <li>Click the Admin Panel menu item to navigate to the main administration page</li> <li>The page has a number of tabs with different utilities described in detail below</li> </ul> <p><strong>Tabs:</strong></p> <ul> <li><a href="#admin-list">Admin List</a></li> <li><a href="#publisher-list">Publisher List</a></li> <li><a href="#prog-sys-list">Program and System Lists</a></li> <li><a href="#group-list">Group List</a></li> <li><a href="#elasticsearch-admin-tab">Elasticsearch</a></li> </ul> <h2 className="help-section-subtitle" id="admin-list">Admin List</h2> <p>This list will populate with all of the users who have administrative privileges. The admin role allows access to all content and all functionality in the application. To the right of each user name and email is a remove button that will revoke the admin role from that user. The admin role can be granted by typing in the email of a user and clicking the plus button. The user will then appear on the admin list or an error will be displayed explaining any issues with the addition.</p> <h2 className="help-section-subtitle" id="publisher-list">Publisher List</h2> <p>For usage instructions please see the information about the Admin List above. Adding members to this list allows them to see private content they did not author and publish that content to make it public.</p> <h2 className="help-section-subtitle" id="prog-sys-list">Program and System Lists</h2> <p>On the Program List and System List tabs an administrator can see a current list of all surveillance programs and systems currently available for users to work under. The admin can use the input fields and click the add button to make another program / system available for in the users profile drop down.</p> <h2 className="help-section-subtitle" id="group-list">Group List</h2> <p>On the group list tab an administrator can add new groups and curate the user membership lists for any of the groups in the application. For any group click on the Manage Users button in the right column to see a list of current users and add or remove users by email.</p> <h2 className="help-section-subtitle" id="elasticsearch-admin-tab">Elasticsearch</h2> <p>The Elasticsearch tab is used to synchronize the Elasticsearch database with any activity stored in the Vocabulary service database while Elasticsearch may have been down. This page should only be used according to the instructions given on the page by an experienced administrator. Actions on this page could cause Elasticsearch to become temporarily unavailable.</p> </div> ); } instructionsTab() { return( <div className={`tab-pane ${this.state.selectedTab === 'instructions' && 'active'}`} id="instructions" role="tabpanel" aria-hidden={this.state.selectedTab !== 'instructions'} aria-labelledby="instructions-tab"> <div className="col-md-3 how-to-nav no-print"> <h2 className="showpage_sidenav_subtitle"> <text className="sr-only">Version History Navigation Links</text> <ul className="list-inline"> <li className="subtitle_icon"><span className="fa fa-graduation-cap " aria-hidden="true"></span></li> <li className="subtitle">Learn How To:</li> </ul> </h2> <ul className="nav nav-pills nav-stacked" role="tablist"> <li id="general-tab" className="active" role="tab" onClick={() => this.selectInstruction('general')} aria-selected={this.state.selectedInstruction === 'general'} aria-controls="general"><a data-toggle="tab" href="#general">General</a></li> <li id="manage-account-tab" role="tab" onClick={() => this.selectInstruction('manage-account')} aria-selected={this.state.selectedInstruction === 'manage-account'} aria-controls="manage-account"><a data-toggle="tab" href="#manage-account">Manage Account</a></li> <li id="search-tab" role="tab" onClick={() => this.selectInstruction('search')} aria-selected={this.state.selectedInstruction === 'search'} aria-controls="search"><a data-toggle="tab" href="#search">Search</a></li> <li id="view-tab" role="tab" onClick={() => this.selectInstruction('view')} aria-selected={this.state.selectedInstruction === 'view'} aria-controls="view"><a data-toggle="tab" href="#view">View and Export Content</a></li> <li id="workflow-tab" role="tab" onClick={() => this.selectInstruction('workflow')} aria-selected={this.state.selectedInstruction === 'workflow'} aria-controls="workflow"><a data-toggle="tab" href="#workflow">Workflow Status and Content Stage</a></li> <li id="create-and-edit-tab" role="tab" onClick={() => this.selectInstruction('create-and-edit')} aria-selected={this.state.selectedInstruction === 'create-and-edit'} aria-controls="create-and-edit"><a data-toggle="tab" href="#create-and-edit">Create and Edit Content</a></li> <li id="curation-tab" role="tab" onClick={() => this.selectInstruction('curation')} aria-selected={this.state.selectedInstruction === 'curation'} aria-controls="curation"><a data-toggle="tab" href="#curation">Curation Wizard</a></li> <li id="import-tab" role="tab" onClick={() => this.selectInstruction('import')} aria-selected={this.state.selectedInstruction === 'import'} aria-controls="import"><a data-toggle="tab" href="#import">Import Content</a></li> <li id="tagging-tab" role="tab" onClick={() => this.selectInstruction('tagging')} aria-selected={this.state.selectedInstruction === 'tagging'} aria-controls="tagging"><a data-toggle="tab" href="#tagging">Tagging Content</a></li> <li id="mapping-tab" role="tab" onClick={() => this.selectInstruction('mapping')} aria-selected={this.state.selectedInstruction === 'mapping'} aria-controls="mapping"><a data-toggle="tab" href="#mapping">Code System Mappings</a></li> <li id="comment-tab" role="tab" onClick={() => this.selectInstruction('comment')} aria-selected={this.state.selectedInstruction === 'comment'} aria-controls="comment"><a data-toggle="tab" href="#comment">Comment on Content</a></li> <li id="admin-tab" role="tab" onClick={() => this.selectInstruction('admin')} aria-selected={this.state.selectedInstruction === 'admin'} aria-controls="admin"><a data-toggle="tab" href="#admin">Admin Panel</a></li> </ul> </div> <div className="tab-content col-md-8"> {this.generalInstructions()} {this.searchInstructions()} {this.accountInstructions()} {this.viewInstructions()} {this.workflowInstructions()} {this.editInstructions()} {this.curationInstructions()} {this.importInstructions()} {this.taggingInstructions()} {this.mappingInstructions()} {this.commentInstructions()} {this.adminInstructions()} </div> </div> ); } glossaryTab() { return ( <div className="tab-pane" id="glossary" role="tabpanel" aria-hidden={this.state.selectedTab !== 'glossary'} aria-labelledby="glossary-tab"> <h1 id="glossaryTab">Glossary</h1> <br/> <p><strong>Author –</strong> An actor (organization, person, or program) responsible for creating and/or maintaining a data collection item, a code set, a value set, or a data collection instrument</p> <p><strong>Code –</strong> a succinct label for a concept, variable, value, or question</p> <p><strong>Code System –</strong> a collection of unique codes pertaining to one or more topic areas and maintained as a unit; aka code set</p> <p><strong>Data Collection Instrument –</strong> a method for collecting data from or about subjects using tests, questionnaires, inventories, interview schedules or guides, and survey plans</p> <p><strong>Data Collection Item –</strong> A question or data element used to indicate the name and meaning of a datum. It may be identified by a code in a code system, and it may be associated with keywords or search tags from a code system</p> <p><strong>Data Collection Item Group –</strong> a set of data collection items such as questions that are used together in data collection instruments, for example as questionnaire sections, message segments, or SDV-Sections</p> <p><strong>Data Collection Specification -</strong> a set of data terms or questions, definitions, and data value constraints used to describe information collected manually or electronically for surveillance purposes and may also prescribe organization and collection instructions, guidelines, or logic. Examples include an HL7 V2.x message mapping guide, and HL7 CDA implementation guide</p> <p><strong>Data Element –</strong> A unit of data or a variable defined for evaluating and processing. It typically is associated with a code name, a description, and a set of expected values. It may have other associated metadata.</p> <p><strong>Question –</strong> a data collection item that has a natural language expression used to solicit a value for a data variable. A question may be identified by a code name that stands for the question.</p> <p><strong>SDP-V Survey –</strong> a kind of data collection specification created in the SDP Vocabulary Service. It is a selection of questions and response sets (grouped into sections) used together to define the contents of a data collection instrument such as a survey instrument.</p> <p><strong>Survey Instrument -</strong> a data collection instrument in which the collection is done by asking questions and receiving responses. A survey can be implemented as a paper or electronic form, or as a live interview. This is also called a questionnaire</p> <p><strong>Value –</strong> an item of data that can be assigned to a data element or a response to a question</p> <p><strong>Value Set –</strong> a set of value choices that are applicable to one or more data collection items (e.g. data elements or questions). In the case where the data collection item is a question, a value set is also referred to as a response set.</p> </div> ); } whatsnewTab() { return ( <div className={`tab-pane ${this.state.selectedTab === 'whatsnew' && 'active'}`} id="whatsnew" role="tabpanel" aria-hidden={this.state.selectedTab !== 'whatsnew'} aria-labelledby="whatsnew-tab"> <h1 id="whatsnewTab">What&lsquo;s New</h1> <br/> <p>Here you can find the latest news and information about the CDC Vocabulary Service. Read our latest release notes to learn how the application is continuously improving, learn about updates to user documentation, and find other announcements important to the user community.</p> <br/> <strong>Find Out What&lsquo;s New In:</strong> <br/> <br/> <ol> <a href="#announcements">Announcements</a><br/> <a href="#releasenotes">Release Notes </a> <small> (<a href="#1.1">1.1</a>,&nbsp; <a href="#1.2">1.2</a>,&nbsp; <a href="#1.3">1.3</a>,&nbsp; <a href="#1.4">1.4</a>,&nbsp; <a href="#1.5">1.5</a>,&nbsp; <a href="#1.6">1.6</a>,&nbsp; <a href="#1.7">1.7</a>,&nbsp; <a href="#1.8">1.8</a>,&nbsp; <a href="#1.9">1.9</a>,&nbsp; <a href="#1.10">1.10</a>,&nbsp; <a href="#1.11">1.11</a>,&nbsp; <a href="#1.12">1.12</a>,&nbsp; <a href="#1.13">1.13</a>,&nbsp; <a href="#1.14">1.14</a>,&nbsp; <a href="#1.15">1.15</a>,&nbsp; <a href="#1.16">1.16</a>,&nbsp; <a href="#1.17">1.17</a>,&nbsp; <a href="#1.18">1.18</a>,&nbsp; <a href="#1.19">1.19</a>,&nbsp; <a href="#1.20">1.20</a>,&nbsp; <a href="#1.21">1.21</a>,&nbsp; <a href="#1.22">1.22</a>,&nbsp; <a href="#1.23">1.23</a>) </small><br/> <a href="#userdocupdates">User Documentation Updates</a> </ol> <br/> <h4 id="Announcements"><strong>Announcements</strong></h4> <ol>This section will be periodically updated with announcements relevant to the user community. Please check back for updates.</ol> <br/> <h4 id="releasenotes"><strong>Release Notes</strong></h4> <ul> <li id="1.23"><strong>Release <a href='https://publichealthsurveillance.atlassian.net/wiki/spaces/SVS/pages/1264353282/SDP+Vocabulary+Service+Release+1.23' target='_blank'>1.23</a></strong> <small>(August 4, 2020)</small></li> <ol> <li>Response type default update to "Choice" when creating a Question.</li> <li>Updated Section Edit page with Type Filter allowing a user to easily distiguish between filtering between Questions and Sections.</li> <li>Added a Position info button to Create Section page.</li> <li>Updated API to return the latest version.</li> <li>Updated EPI Info export mapping.</li> <li>Description textbox updated in Details section to dynamically scale.</li> <InfoModal show={this.state.showInfoImportFileBug} header="Known Bug: File Import" body={<p> <ul> <u>Status</u>: Deferred <br/> <u>Summary</u>: <br/> When a user attempts to import a file using the 'Import Spreadsheet' option, the user may encounter a 'Server 500' error stating that the import was not successful.<br/> <u>Expected Result</u>: <br/>Dependant on file size, an error message is presented to the user with a '500 Server Error'.<br/> <u>Actual Result</u>: <br/>Processing of the imported spreadsheet continues to process and the upload is successful.<br/> <u>Content Requirements for Successful Import of the Spreadsheet</u>: <ul> <li>Formatting (i.e. Tab name or header name changes) of the Excel import spreadsheet file has not been changed.</li> <li>Content is enterred and saved with accuracy.</li> </ul> </ul></p>} hideInfo={()=>this.setState({showInfoImportFileBug: false})} /> <li>File Import Error <i>(Known Bug<Button bsStyle='link' style={{ padding: 3 }} onClick={() => this.setState({showInfoImportFileBug: true})}><i className="fa fa-info-circle" aria-hidden="true"></i><text className="sr-only">Click for info about this item</text></Button>)</i>.</li> <li>Security updates include acorn, arrify, coffeescript, del, devise, esquery, estraverse, fast-levenshtein, flat-cache, generate-function, glob, globby, handlebars, is-my-json-valid, is-property, jquery, json, js-yaml, lodash, nio4r, node-sass, nokogiri, nokogiri x64 and x86, optionator, path-parse, puma, rack, resolve, rimraf, swagger-cli, webpack, webpack-bundle-analyzer, websocket-extensions, word-wrap.</li> <li>Updated privacy policy link.</li> </ol> <li id="1.22"><strong>Release <a href='https://publichealthsurveillance.atlassian.net/wiki/spaces/SVS/pages/592838675/SDP+Vocabulary+Service+Release+1.22' target='_blank'>1.22</a></strong> <small>(August 6, 2019)</small></li> <ol> <li>Removed clickable filters and highlighting from dashboard items.</li> <li>Per usability testing feedback, components and detail sections have been reordered across the service for ease of readablity.</li> <li>Content stage filter badges have been added for ease of identification and use.</li> <li>Response Type and Category selections are now multi-select.</li> <li>Multi-select drop-downs do not disappear when a user selects multiple items.</li> <li>Duplicate content when viewing 'Author Recommended Response Sets' and 'Response Set Linked on Sections' have been removed.</li> <li>'Response Set Linked on Sections' has been renamed to 'Alternative Response Set Options'.</li> <li>SDP-V will return and store EPI Info published data.</li> </ol> <li id="1.21"><strong>Release <a href='https://publichealthsurveillance.atlassian.net/wiki/spaces/SVS/pages/579338249/SDP+Vocabulary+Service+Release+1.21' target='_blank'>1.21</a></strong> <small>(June 28, 2019)</small></li> <ol> <li>Users can now preview response sets linked to questions on the dashboard by clicking the 'preview' button on the right side of the search result expansion.</li> <li>The metrics API and admin dashboard now report a count of the number of collaborative authoring groups.</li> <li>The application now has a reusable info button that has been added to various places that required clarifications on language and use of functionality around the application.</li> <li>Various improvements were made to the dashboard based on the usability testing, including: <ul> <li>Increase visibility of object type color-coding scheme</li> <li>Object filters consolidated under the search bar and made to look more like filters</li> <li>Improve clarity of Program and System counts on dashboard with updated colors</li> <li>Rearranged layout and descreased size or eliminated unnecessary and unimportant information to reduce visual clutter</li> </ul> </li> </ol> <li id="1.20"><strong>Release <a href='https://publichealthsurveillance.atlassian.net/wiki/spaces/SVS/pages/571015169/SDP+Vocabulary+Service+Release+1.20' target='_blank'>1.20</a></strong> <small>(May 30, 2019)</small></li> <ol> <li>Implemented logic to determine if PHIN VADS link is valid and if the OID exists</li> <li>Added ability to create an Epi Info web-based Survey using SDP-V content</li> <li>Implemented versions of content on dashboard search results</li> <li>Implemented the abiliy to remove advanced filters from the dashboard</li> <li>Implemented the ability to indicate which Response Set is linked on Sections/Surveys when a user navigates to the Question details page</li> <li>Users have the ability to identify a new position for Question/Sections on Survey and Section edit pages</li> <li>Added the ability to view 'Hide retired content' on the dashboard</li> <li>Implemented sorting of search results to show most rescent version at the top</li> </ol> <li id="1.19"><strong>Release <a href='https://publichealthsurveillance.atlassian.net/wiki/spaces/SVS/pages/564461569/SDP+Vocabulary+Service+Release+1.19' target='_blank'>1.19</a></strong> <small>(May 2, 2019)</small></li> <ol> <li>Collaborator role has been implemented</li> <li>Implemented Dashboard Search Result Report Feature that allows users to export dashboard search results into a spreadsheet format</li> <li>Implemented metrics tab on admin panel to allow administrators to view system metrics</li> <li>Aggregate metrics have been exposed in the API</li> <li>Added pagination to linked content to accommodate application growth and ensure performance and page responsiveness as linked content increases on pages</li> <li>Curation wizard feature has been extended to allow administrators and publishers to view suggested replacement questions on surveys</li> <li>Additional google tags have been implemented for analytics</li> <li>Bug fixes</li> </ol> <li id="1.18"><strong>Release <a href='https://publichealthsurveillance.atlassian.net/wiki/spaces/SVS/pages/524910593/SDP+Vocabulary+Service+Release+1.18' target='_blank'>1.18</a></strong> <small>(Apr 5, 2019)</small></li> <ol> <li>Authors have the ability to request that publishers retired content</li> <li>'Draft' visibility has been changed to 'Private' and 'Published' visibility has been changed to 'Public' to attributes more intuitive</li> <li>"Access denied" message updated for authenticated and non-authenticated users to promote collaboration on private content</li> </ol> <li id="1.17"><strong>Release <a href='https://publichealthsurveillance.atlassian.net/wiki/spaces/SVS/pages/491061249/SDP+Vocabulary+Service+Release+1.17' target='_blank'>1.17</a></strong> <small>(Mar 8, 2019)</small></li> <ol> <li>Added advanced search feature on create Questions page</li> <li>Implemented "matched on fields" values to increase transparency of dashboard results</li> <li>Curation Wizard updates, including:</li> <ol type="a"> <li>“Mark as Reviewed” capability to filter out previously reviewed suggestions</li> <li>Filter out "Retired" content from suggestions</li> <li>Optimize match algorithm</li> </ol> <li>Added Curation History Tab to Response Sets and Questions</li> </ol> <li id="1.16"><strong>Release <a href='https://publichealthsurveillance.atlassian.net/wiki/spaces/SVS/pages/484081696/SDP+Vocabulary+Service+Release+1.16' target='_blank'>1.16</a></strong> <small>(Feb 5, 2019)</small></li> <ol> <li>Elasticsearch improvements</li> <li>Advanced Filter Improvements</li> <li>Importer Bug Fixes</li> </ol> <li id="1.15"><strong>Release <a href='https://publichealthsurveillance.atlassian.net/wiki/spaces/SVS/pages/473858095/SDP+Vocabulary+Service+Release+1.15' target='_blank'>1.15</a></strong> <small>(Jan 8, 2019)</small></li> <ol> <li>Links in descriptions will open in a new tab</li> <li>Allow duplicate OMB number for more than one survey</li> <li>Improvement of linked content</li> <li>Exact match on dashboard with double quotes</li> <li>Dashboard search optimization and tokenizer changes</li> <li>Epi Info Export improvement</li> </ol> <li id="1.14"><strong>Release <a href='https://publichealthsurveillance.atlassian.net/wiki/spaces/SVS/pages/463994881/SDP+Vocabulary+Service+Release+1.14' target='_blank'>1.14</a></strong> <small>(Dec 04, 2018)</small></li> <ol> <li>Added 'What's New' tab to Help</li> <li>Updated SDP-V import template</li> <li>OMB Approval number and date on show page</li> <li>Metadata Tab importing for Surveys and Sections</li> </ol> <li id="1.13"><strong>Release <a href='https://publichealthsurveillance.atlassian.net/wiki/spaces/SVS/pages/462422017/SDP+Vocabulary+Service+Release+1.13' target='_blank'>1.13</a></strong> <small>(Nov 28, 2018)</small></li> <ol> <li>Tracking associations in the change history tab</li> <li>Rolling out large response set code in demo</li> <li>Single word tags and code system mappings</li> <li>API performance improvements</li> </ol> <li id="1.12"><strong>Release <a href='https://publichealthsurveillance.atlassian.net/wiki/spaces/SVS/pages/407928833/SDP+Vocabulary+Service+Release+1.12' target='_blank'>1.12</a></strong> <small>(Sept 28, 2018)</small></li> <ol> <li>Curating Public Content</li> <li>UI Asynchronous Rework & Optimizations</li> <li>Comprehensive Developer Documentation</li> </ol> <li id="1.11"><strong>Release <a href='https://publichealthsurveillance.atlassian.net/wiki/spaces/SVS/pages/360546430/SDP+Vocabulary+Service+Release+1.11' target='_blank'>1.11</a></strong> <small>(July 25, 2018)</small></li> <ol> <li>Introduction of Content Stage Attributes</li> <li>User Feedback Success Message</li> <li>Addition of Source to the Response Set Details Summary</li> </ol> <li id="1.10"><strong>Release <a href='https://publichealthsurveillance.atlassian.net/wiki/spaces/SVS/pages/349601800/SDP+Vocabulary+Service+Release+1.10' target='_blank'>1.10</a></strong> <small>(June 29, 2018)</small></li> <ol> <li>New Advanced Search filters</li> <li>Introduction of the Ability for an Author to Save Comments on Private Draft</li> <li>FHIR API Update</li> </ol> <li id="1.9"><strong>Release <a href='https://publichealthsurveillance.atlassian.net/wiki/spaces/SVS/pages/281509889/SDP+Vocabulary+Service+Release+1.9' target='_blank'>1.9</a></strong> <small>(May 22, 2018)</small></li> <ol> <li>Curation Wizard Feature</li> <li>"CDC preferred" content attribute</li> <li>Import content that conforms to SDP-V generic spreadsheet</li> </ol> <li id="1.8"><strong>Release <a href='https://publichealthsurveillance.atlassian.net/wiki/spaces/SVS/pages/256507905/SDP+Vocabulary+Service+Release+1.8' target='_blank'>1.8</a></strong> <small>(April 25, 2018)</small></li> <ol> <li>Revision history for private draft content</li> <li>"Delete/Delete All" prompts</li> <li>Group member visibility in the User Interface (UI)</li> </ol> <li id="1.7"><strong>Release <a href='https://publichealthsurveillance.atlassian.net/wiki/spaces/SVS/pages/212893697/SDP+Vocabulary+Service+Release+1.7' target='_blank'>1.7</a></strong> <small>(March 28, 2018)</small></li> <ol> <li>Export SDP-V data</li> <li>Survey creation by importing using Message Mapping Guide (MMG)</li> <li>"Contact Us" link addition</li> </ol> <li id="1.6"><strong>Release <a href='https://publichealthsurveillance.atlassian.net/wiki/spaces/SVS/pages/145883215/SDP+Vocabulary+Service+Release+1.6' target='_blank'>1.6</a></strong> <small>(February 26, 2018)</small></li> <ol> <li>User Interface (UI) updated for nesting sections and questions</li> <li>Generic spreadsheet importer update (i.e. FHIR API, Swagger API, MMG importer)</li> <li>Collaborative authoring group functionality</li> </ol> <li id="1.5"><strong>Release <a href='https://publichealthsurveillance.atlassian.net/wiki/spaces/SVS/pages/120750131/SDP+Vocabulary+Service+Release+1.5' target='_blank'>1.5</a></strong> <small>(January 30, 2018)</small></li> <ol> <li>Improvement to User Interface (UI) for nesting sections and questions</li> <li>FHIR API update</li> <li>User Interface navigation between various responses</li> </ol> <li id="1.4"><strong>Release <a href='https://publichealthsurveillance.atlassian.net/wiki/spaces/SVS/pages/48627713/SDP+Vocabulary+Service+Release+1.4' target='_blank'>1.4</a></strong> <small>(January 4, 2018)</small></li> <ol> <li>Share private draft content per groups</li> <li>User Interface to better display relationships between content</li> <li>SDP-V API update</li> </ol> <li id="1.3"><strong>Release <a href='https://publichealthsurveillance.atlassian.net/wiki/spaces/SVS/pages/60653574/SDP+Vocabulary+Service+Release+1.3' target='_blank'>1.3</a></strong> <small>(Nov 13, 2017)</small></li> <ol> <li>SDP-V form name update</li> <li>Added new advanced search filters</li> <li>Dashboard ranks</li> </ol> <li id="1.2"><strong>Release <a href='https://publichealthsurveillance.atlassian.net/wiki/spaces/SVS/pages/51871750/SDP+Vocabulary+Service+Release+1.2' target='_blank'>1.2</a></strong> <small>(Oct 17, 2017)</small></li> <ol> <li>Tag features</li> <li>"out of date" development</li> <li>Administration role feature</li> </ol> <li id="1.1"><strong>Release <a href='https://publichealthsurveillance.atlassian.net/wiki/spaces/SVS/pages/50036737/SDP+Vocabulary+Service+Release+1.1' target='_blank'>1.1</a></strong> <small>(Oct 10, 2017)</small></li> <ol> <li>See release for more details.</li> </ol> </ul> <br/> <h4 id="userdocupdates"><strong>User Documentation Updates</strong></h4> <ul> <li><strong>May 2019</strong></li> <ul> <li>The <strong>Vocabulary Service User Guide</strong> has been updated with features available through Release 1.15. The user guide is available on the <a href='https://www.cdc.gov/sdp/SDPHowItWorksVocabularyService.html' target='_blank'>Accessing SDP Vocabulary Service</a> webpage.</li> <li><strong>Surveillance Data Platform Vocabulary Service Fact Sheet</strong> has been updated. The fact sheet is available at the bottom of the <a href='https://www.cdc.gov/sdp/SDPVocabularyServiceSharedServices.html' target='_blank'>SDP Vocabulary Service</a> webpage.</li> </ul> <li><strong>August 2018</strong></li> <ul> <li>The <strong>Vocabulary Service User Guide</strong> has been updated with features available through Release 1.8. The user guide is available on the <a href='https://www.cdc.gov/sdp/SDPHowItWorksVocabularyService.html' target='_blank'>Accessing SDP Vocabulary Service</a> webpage.</li> <li><strong>Surveillance Data Platform Vocabulary Service Fact Sheet</strong> has been updated. The fact sheet is available at the bottom of the <a href='https://www.cdc.gov/sdp/SDPVocabularyServiceSharedServices.html' target='_blank'>SDP Vocabulary Service</a> webpage.</li> </ul> <li><strong>June 2018</strong></li> <ul> <li>The <strong>Vocabulary Service Value Diagram</strong> has been updated to reflect recent enhancements to the system. This diagram summarizes the value of the Vocabulary Service by highlighting specific capabilities of the service. The diagram is available on the <a href='https://www.cdc.gov/sdp/SDPVocabularyServiceSharedServices.html' target='_blank'>SDP Vocabulary Service</a> webpage.</li> <li>The <strong>SDP Vocabulary Info Graphic</strong> has been updated to show that Sections can now include either questions or one or more sections (e.g., sub-sections or nested sections). This ability to nest sections was introduced in Release 1.5. The info graphic is available on the <a href='https://www.cdc.gov/sdp/SDPHowItWorksVocabularyService.html' target='_blank'>Accessing SDP Vocabulary Service</a> webpage.</li> </ul> </ul> </div> ); } render() { return ( <div className="container" href="#help"> <div className="row basic-bg"> <div className="col-md-12"> <div className="showpage_header_container no-print"> <ul className="list-inline"> <li className="showpage_button"><span className="fa fa-question-circle fa-2x" aria-hidden="true"></span></li> <li className="showpage_title"><h1>Help</h1></li> </ul> </div> <div className="container col-md-12"> <div className="row"> <div className="col-md-12 nopadding"> <ul className="nav nav-tabs" role="tablist"> <li id="instructions-tab" className={`nav-item ${this.state.selectedTab === 'instructions' && 'active'}`} role="tab" onClick={() => this.selectTab('instructions')} aria-selected={this.state.selectedTab === 'instructions'} aria-controls="instructions"> <a className="nav-link" data-toggle="tab" href="#instructions" role="tab">Instructions</a> </li> <li id="glossary-tab" className="nav-item" role="tab" onClick={() => this.selectTab('glossary')} aria-selected={this.state.selectedTab === 'glossary'} aria-controls="glossary"> <a className="nav-link" data-toggle="tab" href="#glossary" role="tab">Glossary</a> </li> <li id="faq-tab" className="nav-item" role="tab" onClick={() => this.selectTab('faq')} aria-selected={this.state.selectedTab === 'faq'} aria-controls="faq"> <a className="nav-link" data-toggle="tab" href="#faq" role="tab">FAQs</a> </li> <li id="whatsnew-tab" className={`nav-item ${this.state.selectedTab === 'whatsnew' && 'active'}`} role="tab" onClick={() => this.selectTab('whatsnew')} aria-selected={this.state.selectedTab === 'whatsnew'} aria-controls="whatsnew"> <a className="nav-link" data-toggle="tab" href="#whatsnew" role="tab">What&lsquo;s New</a> </li> </ul> <div className="tab-content"> {this.instructionsTab()} <div className="tab-pane" id="faq" role="tabpanel" aria-hidden={this.state.selectedTab !== 'faq'} aria-labelledby="faq-tab"> <h1 id="faqTab">FAQs</h1> <br/> <p>Please visit the FAQ page on the official cdc.gov website: <a href="https://www.cdc.gov/sdp/SDPFAQs.html#tabs-2-2" target="_blank">https://www.cdc.gov/sdp/SDPFAQs.html</a></p> </div> {this.glossaryTab()} {this.whatsnewTab()} </div> </div> </div> </div> </div> </div> </div> ); } } function mapDispatchToProps(dispatch) { return bindActionCreators({setSteps}, dispatch); } Help.propTypes = { setSteps: PropTypes.func, location: PropTypes.object }; export default connect(null, mapDispatchToProps)(Help);
docs/app/Examples/collections/Grid/Variations/GridExampleRelaxedVery.js
aabustamante/Semantic-UI-React
import React from 'react' import { Grid, Image } from 'semantic-ui-react' const GridExampleRelaxedVery = () => ( <Grid relaxed='very' columns={4}> <Grid.Column> <Image src='/assets/images/wireframe/image.png' /> </Grid.Column> <Grid.Column> <Image src='/assets/images/wireframe/image.png' /> </Grid.Column> <Grid.Column> <Image src='/assets/images/wireframe/image.png' /> </Grid.Column> <Grid.Column> <Image src='/assets/images/wireframe/image.png' /> </Grid.Column> </Grid> ) export default GridExampleRelaxedVery
src/chapters/04-porazdelitve-verjetnosti/03-diskretne-porazdelitve/05-hipergeometrijska-porazdelitev/index.js
medja/ovs-prirocnik
import React from 'react'; import { createChapter } from 'components/chapter'; import Equation from 'components/equation'; import Formula from 'components/formula'; import Chart from 'components/chart'; const title = 'Hipergeomterijska porazdelitev'; function Title(props) { return ( <span> { props.title }{' '} <Equation math="H(n, M, N)" /> </span> ); } function Chapter() { const variables = '0 & 1 & 2 & ... & n'; const probabilities = 'f(0) & f(1) & f(2) & ... & f(n)'; const distribution = ` H(n, M, N) \\sim \\left(\\begin{array}{c} ${variables}\\\\ ${probabilities} \\end{array}\\right) `; return ( <div> <p> Hipergeometrijska porazdelitev razporeja glede na število ugodnih izborov. Odvisna je od števila vseh možnih izbir, vseh ugodnih izbir in števila izbir, ki jih naredimo. Primer take porazdelitve je igra z barvastimi kroglicami, kjer izbiramo brez vračanja in nas zanima verjetnost, da smo izbrali določeno število kroglic prave barve. </p> <Formula name="Hipergeomterijska porazdelitev" math={distribution} params={{ 'n': 'Število vseh izbir', 'M': 'Število ugodnih možnosti', 'N': 'Število vseh možnosti' }} /> <p> Pri računanju s hipergeomterijsko porazdelitvijo si lahko pomagamo z naslednjimi formulami: </p> <Formula.Group> <Formula name="Funkcija gostote" math="f(x) = \frac{\binom{M}{x}\binom{N - M}{n - x}}{\binom{N}{n}}" /> <Formula name="Porazdelitvena funkcija" math="F(x) = \frac{\sum_{i=0}^x \binom{M}{i}\binom{N - M}{n - i}}{\binom{N}{n}}" params={{ 'x': 'Število poskusov' }} /> </Formula.Group> <Formula.Group> <Formula name="Matematično upanje" math="E(X) = \frac{nM}{N}" /> <Formula name="Disperzija" math="D(X) = n \frac{M}{N} \frac{(N - M)}{N} \frac{N - n}{N - 1}" params={{ 'X': 'Slučajna spremenljivka' }} /> </Formula.Group> <Chart name="Primer grafa" width="500" height="400" func="Hypergeometric(x, n, M, N)" params={{ n: 4, M: 3, N: 10 }} range={[-1, 4]} discrete /> </div> ); } export default createChapter(title, Chapter, [], { Title });
react-native-demo/SmarterWeather/__tests__/index.android.js
zhangjunhd/react-examples
import 'react-native'; import React from 'react'; import Index from '../index.android.js'; // Note: test renderer must be required after react-native. import renderer from 'react-test-renderer'; it('renders correctly', () => { const tree = renderer.create( <Index /> ); });
test/ButtonInputSpec.js
Firfi/meteor-react-bootstrap
import React from 'react'; import ReactTestUtils from 'react/lib/ReactTestUtils'; import ButtonInput from '../src/ButtonInput'; import {shouldWarn} from './helpers'; describe('ButtonInput', () =>{ it('renders an input button element with type=button', function () { const instance = ReactTestUtils.renderIntoDocument( <ButtonInput value="button" bsStyle="danger" wrapperClassName="test" /> ); const node = React.findDOMNode(ReactTestUtils.findRenderedDOMComponentWithTag(instance, 'input')); assert.equal(node.getAttribute('type'), 'button'); assert.equal(node.getAttribute('class'), 'btn btn-danger'); }); it('supports type=reset and type=submit', function () { let instance = ReactTestUtils.renderIntoDocument( <ButtonInput value="button" type="reset" /> ); let node = React.findDOMNode(ReactTestUtils.findRenderedDOMComponentWithTag(instance, 'input')); assert.equal(node.getAttribute('type'), 'reset'); instance = ReactTestUtils.renderIntoDocument( <ButtonInput value="button" type="submit" /> ); node = React.findDOMNode(ReactTestUtils.findRenderedDOMComponentWithTag(instance, 'input')); assert.equal(node.getAttribute('type'), 'submit'); }); it('throws warning about unsupported type', function () { ReactTestUtils.renderIntoDocument( <ButtonInput value="button" type="password" /> ); shouldWarn('propType: Invalid'); }); it('must not throw warning when bsStyle=danger', function () { ReactTestUtils.renderIntoDocument( <ButtonInput value="button" bsStyle="danger" /> ); console.warn.called.should.be.false; }); it('throws warning about wrong type for bsStyle=error', function () { ReactTestUtils.renderIntoDocument( <ButtonInput value="button" bsStyle="submit" /> ); shouldWarn('propType: Invalid'); }); it('throws a warning if given both children and a value property', function () { const testData = { value: 5, children: 'button' }; const result = ButtonInput.propTypes.value(testData, 'value', 'ButtonInput'); result.should.be.instanceOf(Error); result.message.should.have.string('value and children'); }); it('does not throw an error for strings and numbers', function () { let testData = { children: 'EUREKA' }; let result = ButtonInput.propTypes.children(testData, 'children', 'ButtonInput'); assert.notInstanceOf(result, Error); testData = { value: 4 }; result = ButtonInput.propTypes.value(testData, 'children', 'ButtonInput'); assert.notInstanceOf(result, Error); }); it('does not allow elements for children', function () { ReactTestUtils.renderIntoDocument( <ButtonInput><span>blah</span></ButtonInput> ); shouldWarn('propType: Invalid'); }); });
consoles/my-joy-images/src/mocks/declarative-redux-form.js
yldio/joyent-portal
import React from 'react'; export default ({ children, ...props }) => React.createElement(children, props);
src/Parser/Druid/Restoration/Modules/Features/NaturesEssence.js
hasseboulen/WoWAnalyzer
import React from 'react'; import { formatPercentage } from 'common/format'; import SpellLink from 'common/SpellLink'; import Analyzer from 'Parser/Core/Analyzer'; import Wrapper from 'common/Wrapper'; import SPELLS from 'common/SPELLS'; import Combatants from 'Parser/Core/Modules/Combatants'; const HEAL_WINDOW_MS = 500; const RECOMMENDED_HIT_THRESHOLD = 3; class NaturesEssence extends Analyzer { static dependencies = { combatants: Combatants, }; casts = 0; castsWithTargetsHit = []; // index is number of targets hit, value is number of casts that hit that many targets castHits = 0; totalHits = 0; healTimestamp = undefined; on_initialized() { this.active = this.combatants.selected.traitsBySpellId[SPELLS.NATURES_ESSENCE_TRAIT.id] > 0; } on_byPlayer_heal(event) { if (event.ability.guid !== SPELLS.NATURES_ESSENCE_DRUID.id) { return; } if(!this.healTimestamp || this.healTimestamp + HEAL_WINDOW_MS < this.owner.currentTimestamp) { this._tallyHits(); this.healTimestamp = this.owner.currentTimestamp; } if(event.amount !== 0) { this.castHits += 1; this.totalHits += 1; } } on_byPlayer_cast(event) { if (event.ability.guid === SPELLS.WILD_GROWTH.id) { this.casts += 1; } } on_finished() { this._tallyHits(); } _tallyHits() { if(!this.healTimestamp) { return; } this.castsWithTargetsHit[this.castHits] ? this.castsWithTargetsHit[this.castHits] += 1 : this.castsWithTargetsHit[this.castHits] = 1; this.castHits = 0; this.healTimestamp = undefined; } get averageEffectiveHits() { return (this.totalHits / this.casts) || 0; } get belowRecommendedCasts() { return this.castsWithTargetsHit.reduce((accum, casts, hits) => { return (hits < RECOMMENDED_HIT_THRESHOLD) ? accum + casts : accum; }, 0); } get percentBelowRecommendedCasts() { return (this.belowRecommendedCasts / this.casts) || 0; } get suggestionThresholds() { return { actual: this.percentBelowRecommendedCasts, isGreaterThan: { minor: 0.00, average: 0.15, major: 0.35, }, style: 'percentage', }; } suggestions(when) { when(this.suggestionThresholds) .addSuggestion((suggest, actual, recommended) => { return suggest(<Wrapper>You sometimes cast <SpellLink id={SPELLS.WILD_GROWTH.id} /> on too few targets. <SpellLink id={SPELLS.WILD_GROWTH.id} /> is not mana efficient when hitting few targets, you should only cast it when you can hit at least {RECOMMENDED_HIT_THRESHOLD} wounded targets. Make sure you are not casting on a primary target isolated from the raid. <SpellLink id={SPELLS.WILD_GROWTH.id} /> has a maximum hit radius, the injured raiders could have been out of range. Also, <SpellLink id={SPELLS.WILD_GROWTH.id} /> healing is frontloaded due to <SpellLink id={SPELLS.NATURES_ESSENCE_DRUID.id} />, you should never pre-hot with <SpellLink id={SPELLS.WILD_GROWTH.id} />. </Wrapper>) .icon(SPELLS.NATURES_ESSENCE_DRUID.icon) .actual(`${formatPercentage(this.percentBelowRecommendedCasts, 0)}% casts on fewer than ${RECOMMENDED_HIT_THRESHOLD} targets.`) .recommended(`never casting on fewer than ${RECOMMENDED_HIT_THRESHOLD} is recommended`); }); } } export default NaturesEssence;
js/jqwidgets/demos/react/app/grid/columnshierarchy/app.js
luissancheza/sice
import React from 'react'; import ReactDOM from 'react-dom'; import JqxGrid from '../../../jqwidgets-react/react_jqxgrid.js'; class App extends React.Component { render() { let source = { datatype: 'xml', datafields: [ { name: 'SupplierName', type: 'string' }, { name: 'Quantity', type: 'number' }, { name: 'OrderDate', type: 'date' }, { name: 'OrderAddress', type: 'string' }, { name: 'Freight', type: 'number' }, { name: 'Price', type: 'number' }, { name: 'City', type: 'string' }, { name: 'ProductName', type: 'string' }, { name: 'Address', type: 'string' } ], url: '../sampledata/orderdetailsextended.xml', root: 'DATA', record: 'ROW' }; let dataAdapter = new $.jqx.dataAdapter(source); let columns = [ { text: 'Supplier Name', cellsalign: 'center', align: 'center', datafield: 'SupplierName', width: 110 }, { text: 'Name', columngroup: 'ProductDetails', cellsalign: 'center', align: 'center', datafield: 'ProductName', width: 120 }, { text: 'Quantity', columngroup: 'ProductDetails', datafield: 'Quantity', cellsformat: 'd', cellsalign: 'center', align: 'center', width: 80 }, { text: 'Freight', columngroup: 'OrderDetails', datafield: 'Freight', cellsformat: 'd', cellsalign: 'center', align: 'center', width: 100 }, { text: 'Order Date', columngroup: 'OrderDetails', cellsalign: 'center', align: 'center', cellsformat: 'd', datafield: 'OrderDate', width: 100 }, { text: 'Order Address', columngroup: 'OrderDetails', cellsalign: 'center', align: 'center', datafield: 'OrderAddress', width: 100 }, { text: 'Price', columngroup: 'ProductDetails', datafield: 'Price', cellsformat: 'c2', align: 'center', cellsalign: 'center', width: 70 }, { text: 'Address', columngroup: 'Location', cellsalign: 'center', align: 'center', datafield: 'Address', width: 120 }, { text: 'City', columngroup: 'Location', cellsalign: 'center', align: 'center', datafield: 'City', width: 80 } ]; let columngroups = [ { text: 'Product Details', align: 'center', name: 'ProductDetails' }, { text: 'Order Details', parentgroup: 'ProductDetails', align: 'center', name: 'OrderDetails' }, { text: 'Location', align: 'center', name: 'Location' } ]; return ( <JqxGrid width={850} source={dataAdapter} pageable={true} autorowheight={true} altrows={true} columnsresize={true} columns={columns} columngroups={columngroups} /> ) } } ReactDOM.render(<App />, document.getElementById('app'));
customView/node_modules/babel-plugin-react-transform/test/fixtures/code-ignore/expected.js
TheKingOfNorway/React-Native
import React from 'react'; const First = React.createNotClass({ displayName: 'First' }); class Second extends React.NotComponent {}
src/components/Footer/__tests__/index.js
henriquesosa/intro-ao-electron
jest.unmock('./') import React from 'react' import ReactDOM from 'react-dom' import TestUtils from 'react-addons-test-utils' import Footer from './' describe('Footer Component', () => { it('shows a title', () => { // const Footer = TestUtils.renderIntoDocument( // <Footer /> // ) // const FooterNode = ReactDOM.findDOMNode(Footer) // expect(FooterNode.textContent).equals('Todos') }) })
react/features/settings/components/web/audio/TestButton.js
jitsi/jitsi-meet
// @flow import React from 'react'; type Props = { /** * Click handler for the button. */ onClick: Function, /** * Keypress handler for the button. */ onKeyPress: Function, }; /** * React {@code Component} representing an button used for testing output sound. * * @returns { ReactElement} */ export default function TestButton({ onClick, onKeyPress }: Props) { return ( <div className = 'audio-preview-test-button' onClick = { onClick } onKeyPress = { onKeyPress } role = 'button' tabIndex = { 0 }> Test </div> ); }
actor-apps/app-web/src/app/components/DialogSection.react.js
dut3062796s/actor-platform
import _ from 'lodash'; import React from 'react'; import { PeerTypes } from 'constants/ActorAppConstants'; import PeerUtils from 'utils/PeerUtils'; import MessagesSection from 'components/dialog/MessagesSection.react'; import TypingSection from 'components/dialog/TypingSection.react'; import ComposeSection from 'components/dialog/ComposeSection.react'; import ToolbarSection from 'components/ToolbarSection.react'; import ActivitySection from 'components/ActivitySection.react'; import ConnectionState from 'components/common/ConnectionState.react'; import ActivityStore from 'stores/ActivityStore'; import DialogStore from 'stores/DialogStore'; import MessageStore from 'stores/MessageStore'; import GroupStore from 'stores/GroupStore'; import DialogActionCreators from 'actions/DialogActionCreators'; // On which scrollTop value start loading older messages const LoadMessagesScrollTop = 100; const initialRenderMessagesCount = 20; const renderMessagesStep = 20; let renderMessagesCount = initialRenderMessagesCount; let lastPeer = null; let lastScrolledFromBottom = 0; const getStateFromStores = () => { const messages = MessageStore.getAll(); let messagesToRender; if (messages.length > renderMessagesCount) { messagesToRender = messages.slice(messages.length - renderMessagesCount); } else { messagesToRender = messages; } return { peer: DialogStore.getSelectedDialogPeer(), messages: messages, messagesToRender: messagesToRender }; }; class DialogSection extends React.Component { constructor(props) { super(props); this.state = getStateFromStores(); ActivityStore.addChangeListener(this.fixScrollTimeout.bind(this)); DialogStore.addSelectListener(this.onSelectedDialogChange); MessageStore.addChangeListener(this.onMessagesChange); } componentWillUnmount() { ActivityStore.removeChangeListener(this.fixScrollTimeout.bind(this)); DialogStore.removeSelectListener(this.onSelectedDialogChange); MessageStore.removeChangeListener(this.onMessagesChange); } componentDidMount() { const peer = DialogStore.getSelectedDialogPeer(); if (peer) { DialogActionCreators.onConversationOpen(peer); this.fixScroll(); this.loadMessagesByScroll(); } } componentDidUpdate() { this.fixScroll(); this.loadMessagesByScroll(); } render() { const peer = this.state.peer; let mainContent; if (peer) { let isMember = true, memberArea; if (peer.type === PeerTypes.GROUP) { const group = GroupStore.getGroup(peer.id); isMember = DialogStore.isGroupMember(group); } if (isMember) { memberArea = ( <div> <TypingSection/> <ComposeSection peer={peer}/> </div> ); } else { memberArea = ( <section className="compose compose--disabled row center-xs middle-xs"> <h3>You are not a member</h3> </section> ); } mainContent = ( <section className="dialog" onScroll={this.loadMessagesByScroll}> <ConnectionState/> <div className="messages"> <MessagesSection messages={this.state.messagesToRender} peer={peer} ref="MessagesSection"/> </div> {memberArea} </section> ); } else { mainContent = ( <section className="dialog dialog--empty row center-xs middle-xs"> <ConnectionState/> <h2>Select dialog or start a new one.</h2> </section> ); } return ( <section className="main"> <ToolbarSection/> <div className="flexrow"> {mainContent} <ActivitySection/> </div> </section> ); } fixScrollTimeout = () => { setTimeout(this.fixScroll, 50); }; fixScroll = () => { const node = React.findDOMNode(this.refs.MessagesSection); if (node) { node.scrollTop = node.scrollHeight - lastScrolledFromBottom - node.offsetHeight; } }; onSelectedDialogChange = () => { lastScrolledFromBottom = 0; renderMessagesCount = initialRenderMessagesCount; if (lastPeer != null) { DialogActionCreators.onConversationClosed(lastPeer); } lastPeer = DialogStore.getSelectedDialogPeer(); DialogActionCreators.onConversationOpen(lastPeer); }; onMessagesChange = _.debounce(() => { this.setState(getStateFromStores()); }, 10, {maxWait: 50, leading: true}); loadMessagesByScroll = _.debounce(() => { let node = React.findDOMNode(this.refs.MessagesSection); let scrollTop = node.scrollTop; lastScrolledFromBottom = node.scrollHeight - scrollTop - node.offsetHeight; // was node.scrollHeight - scrollTop if (node.scrollTop < LoadMessagesScrollTop) { DialogActionCreators.onChatEnd(this.state.peer); if (this.state.messages.length > this.state.messagesToRender.length) { renderMessagesCount += renderMessagesStep; if (renderMessagesCount > this.state.messages.length) { renderMessagesCount = this.state.messages.length; } this.setState(getStateFromStores()); } } }, 5, {maxWait: 30}); } export default DialogSection;
demo/__tests__/index.ios.js
nbonamy/react-native-app-components
import 'react-native'; import React from 'react'; import Index from '../index.ios.js'; // Note: test renderer must be required after react-native. import renderer from 'react-test-renderer'; it('renders correctly', () => { const tree = renderer.create( <Index /> ); });
src/index.js
FranciscoHerrera/floggit-whiteboard-client
import React from 'react'; import ReactDOM from 'react-dom'; import { Provider } from 'react-redux'; import store from './reduxStore'; import './common/css/master.css'; import Home from './pages/Home'; ReactDOM.render( <Provider store={store}> <Home /> </Provider>, document.getElementById('root'));
test/components/friendlist.spec.js
TianZhiWang/cmput404-project
/* MIT License Copyright (c) 2017 Conner Dunn, Tian Zhi Wang, Kyle Carlstrom, Xin Yi Wang, Josh Deng Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ import React from 'react'; import { mount, shallow } from 'enzyme'; import { assert } from 'chai'; import { describe, it } from 'mocha'; import FriendList from '../../src/components/FriendList'; describe('<FriendList>', function () { const store={}; const props = { changeFollowStatus: function () {}, users: [] }; it('Should render', () => { const wrapper = shallow(<FriendList {...props}/>); assert.equal(wrapper.find('.friend-page').length, 1); }); });
frontend/src/index.js
generalelectrix/color_organist
import React from 'react'; import ReactDOM from 'react-dom'; import App from './App'; import './index.css'; ReactDOM.render(<App />, document.getElementById('root'));
docs/src/pages/docs/index.js
colindresj/nuclear-js
import React from 'react' import Redirect from '../../layouts/redirect' import { BASE_URL } from '../../globals' export default React.createClass({ render() { return <Redirect to={BASE_URL} /> } })
examples/webpack/src/components/RandomButton.js
sapegin/react-styleguidist
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import sample from 'lodash/sample'; import './RandomButton.css'; /** * Button that changes label on every click. */ export default class RandomButton extends Component { static propTypes = { /** * List of possible labels. */ variants: PropTypes.array.isRequired, }; constructor(props) { super(); this.state = { label: sample(props.variants), }; } handleClick = () => { this.setState({ label: sample(this.props.variants), }); }; render() { return ( <button className="random-button" onClick={this.handleClick}> {this.state.label} </button> ); } }
node_modules/react-bootstrap/es/Pagination.js
darklilium/Factigis_2
import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties'; import _extends from 'babel-runtime/helpers/extends'; import _classCallCheck from 'babel-runtime/helpers/classCallCheck'; import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn'; import _inherits from 'babel-runtime/helpers/inherits'; import classNames from 'classnames'; import React from 'react'; import elementType from 'react-prop-types/lib/elementType'; import PaginationButton from './PaginationButton'; import { bsClass, getClassSet, splitBsProps } from './utils/bootstrapUtils'; var propTypes = { activePage: React.PropTypes.number, items: React.PropTypes.number, maxButtons: React.PropTypes.number, /** * When `true`, will display the first and the last button page */ boundaryLinks: React.PropTypes.bool, /** * When `true`, will display the default node value ('&hellip;'). * Otherwise, will display provided node (when specified). */ ellipsis: React.PropTypes.oneOfType([React.PropTypes.bool, React.PropTypes.node]), /** * When `true`, will display the default node value ('&laquo;'). * Otherwise, will display provided node (when specified). */ first: React.PropTypes.oneOfType([React.PropTypes.bool, React.PropTypes.node]), /** * When `true`, will display the default node value ('&raquo;'). * Otherwise, will display provided node (when specified). */ last: React.PropTypes.oneOfType([React.PropTypes.bool, React.PropTypes.node]), /** * When `true`, will display the default node value ('&lsaquo;'). * Otherwise, will display provided node (when specified). */ prev: React.PropTypes.oneOfType([React.PropTypes.bool, React.PropTypes.node]), /** * When `true`, will display the default node value ('&rsaquo;'). * Otherwise, will display provided node (when specified). */ next: React.PropTypes.oneOfType([React.PropTypes.bool, React.PropTypes.node]), onSelect: React.PropTypes.func, /** * You can use a custom element for the buttons */ buttonComponentClass: elementType }; var defaultProps = { activePage: 1, items: 1, maxButtons: 0, first: false, last: false, prev: false, next: false, ellipsis: true, boundaryLinks: false }; var Pagination = function (_React$Component) { _inherits(Pagination, _React$Component); function Pagination() { _classCallCheck(this, Pagination); return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); } Pagination.prototype.renderPageButtons = function renderPageButtons(activePage, items, maxButtons, boundaryLinks, ellipsis, buttonProps) { var pageButtons = []; var startPage = void 0; var endPage = void 0; var hasHiddenPagesAfter = void 0; if (maxButtons) { var hiddenPagesBefore = activePage - parseInt(maxButtons / 2, 10); startPage = Math.max(hiddenPagesBefore, 1); hasHiddenPagesAfter = items >= startPage + maxButtons; if (!hasHiddenPagesAfter) { endPage = items; startPage = items - maxButtons + 1; if (startPage < 1) { startPage = 1; } } else { endPage = startPage + maxButtons - 1; } } else { startPage = 1; endPage = items; } for (var pagenumber = startPage; pagenumber <= endPage; pagenumber++) { pageButtons.push(React.createElement( PaginationButton, _extends({}, buttonProps, { key: pagenumber, eventKey: pagenumber, active: pagenumber === activePage }), pagenumber )); } if (boundaryLinks && ellipsis && startPage !== 1) { pageButtons.unshift(React.createElement( PaginationButton, { key: 'ellipsisFirst', disabled: true, componentClass: buttonProps.componentClass }, React.createElement( 'span', { 'aria-label': 'More' }, ellipsis === true ? '\u2026' : ellipsis ) )); pageButtons.unshift(React.createElement( PaginationButton, _extends({}, buttonProps, { key: 1, eventKey: 1, active: false }), '1' )); } if (maxButtons && hasHiddenPagesAfter && ellipsis) { pageButtons.push(React.createElement( PaginationButton, { key: 'ellipsis', disabled: true, componentClass: buttonProps.componentClass }, React.createElement( 'span', { 'aria-label': 'More' }, ellipsis === true ? '\u2026' : ellipsis ) )); if (boundaryLinks && endPage !== items) { pageButtons.push(React.createElement( PaginationButton, _extends({}, buttonProps, { key: items, eventKey: items, active: false }), items )); } } return pageButtons; }; Pagination.prototype.render = function render() { var _props = this.props, activePage = _props.activePage, items = _props.items, maxButtons = _props.maxButtons, boundaryLinks = _props.boundaryLinks, ellipsis = _props.ellipsis, first = _props.first, last = _props.last, prev = _props.prev, next = _props.next, onSelect = _props.onSelect, buttonComponentClass = _props.buttonComponentClass, className = _props.className, props = _objectWithoutProperties(_props, ['activePage', 'items', 'maxButtons', 'boundaryLinks', 'ellipsis', 'first', 'last', 'prev', 'next', 'onSelect', 'buttonComponentClass', 'className']); var _splitBsProps = splitBsProps(props), bsProps = _splitBsProps[0], elementProps = _splitBsProps[1]; var classes = getClassSet(bsProps); var buttonProps = { onSelect: onSelect, componentClass: buttonComponentClass }; return React.createElement( 'ul', _extends({}, elementProps, { className: classNames(className, classes) }), first && React.createElement( PaginationButton, _extends({}, buttonProps, { eventKey: 1, disabled: activePage === 1 }), React.createElement( 'span', { 'aria-label': 'First' }, first === true ? '\xAB' : first ) ), prev && React.createElement( PaginationButton, _extends({}, buttonProps, { eventKey: activePage - 1, disabled: activePage === 1 }), React.createElement( 'span', { 'aria-label': 'Previous' }, prev === true ? '\u2039' : prev ) ), this.renderPageButtons(activePage, items, maxButtons, boundaryLinks, ellipsis, buttonProps), next && React.createElement( PaginationButton, _extends({}, buttonProps, { eventKey: activePage + 1, disabled: activePage >= items }), React.createElement( 'span', { 'aria-label': 'Next' }, next === true ? '\u203A' : next ) ), last && React.createElement( PaginationButton, _extends({}, buttonProps, { eventKey: items, disabled: activePage >= items }), React.createElement( 'span', { 'aria-label': 'Last' }, last === true ? '\xBB' : last ) ) ); }; return Pagination; }(React.Component); Pagination.propTypes = propTypes; Pagination.defaultProps = defaultProps; export default bsClass('pagination', Pagination);
examples/src/app.js
katienreed/react-select
/* eslint react/prop-types: 0 */ import React from 'react'; import Select from 'react-select'; import CustomRenderField from './components/CustomRenderField'; import MultiSelectField from './components/MultiSelectField'; import RemoteSelectField from './components/RemoteSelectField'; import SelectedValuesField from './components/SelectedValuesField'; import StatesField from './components/StatesField'; import UsersField from './components/UsersField'; import ValuesAsNumbersField from './components/ValuesAsNumbersField'; import DisabledUpsellOptions from './components/DisabledUpsellOptions'; var FLAVOURS = [ { label: 'Chocolate', value: 'chocolate' }, { label: 'Vanilla', value: 'vanilla' }, { label: 'Strawberry', value: 'strawberry' }, { label: 'Cookies and Cream', value: 'cookiescream' }, { label: 'Peppermint', value: 'peppermint' } ]; var FLAVOURS_WITH_DISABLED_OPTION = FLAVOURS.slice(0); FLAVOURS_WITH_DISABLED_OPTION.unshift({ label: 'Caramel (You don\'t like it, apparently)', value: 'caramel', disabled: true }); function logChange() { console.log.apply(console, [].concat(['Select value changed:'], Array.prototype.slice.apply(arguments))); } React.render( <div> <StatesField label="States" searchable /> <UsersField label="Users (custom options/value)" hint="This example uses Gravatar to render user's image besides the value and the options" /> <ValuesAsNumbersField label="Values as numbers" /> <MultiSelectField label="Multiselect"/> <SelectedValuesField label="Clickable labels (labels as links)" options={FLAVOURS} hint="Open the console to see click behaviour (data/event)" /> <SelectedValuesField label="Disabled option" options={FLAVOURS_WITH_DISABLED_OPTION} hint="You savage! Caramel is the best..." /> <DisabledUpsellOptions label="Disable option with an upsell link"/> <SelectedValuesField label="Option Creation (tags mode)" options={FLAVOURS} allowCreate hint="Enter a value that's not in the list, then hit enter" /> <CustomRenderField label="Custom render options/values" /> <CustomRenderField label="Custom render options/values (multi)" multi delimiter="," /> <RemoteSelectField label="Remote Options" hint='Type anything in the remote example to asynchronously load options. Valid alternative results are "A", "AA", and "AB"' /> </div>, document.getElementById('example') );
src/routes/Home/components/HomeView.js
amaurisquezada/battleship
import React from 'react' export const HomeView = () => ( <div> <h4>Welcome!</h4> </div> ) export default HomeView
src/layouts/CoreLayout/CoreLayout.js
aurel-tackoen/spencer.io
import React from 'react' import Header from '../../components/Header' import classes from './CoreLayout.scss' import '../../styles/core.scss' export const CoreLayout = ({ children }) => ( <div className='container text-center'> <Header /> <div className={classes.mainContainer}> {children} </div> </div> ) CoreLayout.propTypes = { children: React.PropTypes.element.isRequired } export default CoreLayout
src/components/Box/BoxHeader.js
wundery/wundery-ui-react
import React from 'react'; import classnames from 'classnames'; function BoxHeader({ noPadding, compact, children, center }) { const className = classnames('ui-box-header', { 'ui-box-header-no-padding': noPadding, 'ui-box-header-compact': compact, 'ui-box-header-center': center, }); return ( <div className={className}> {children} </div> ); } BoxHeader.propTypes = { children: React.PropTypes.node, // Specifies whether padding should be removed noPadding: React.PropTypes.bool, compact: React.PropTypes.bool, center: React.PropTypes.bool, }; export default BoxHeader;
src/svg-icons/editor/border-outer.js
manchesergit/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let EditorBorderOuter = (props) => ( <SvgIcon {...props}> <path d="M13 7h-2v2h2V7zm0 4h-2v2h2v-2zm4 0h-2v2h2v-2zM3 3v18h18V3H3zm16 16H5V5h14v14zm-6-4h-2v2h2v-2zm-4-4H7v2h2v-2z"/> </SvgIcon> ); EditorBorderOuter = pure(EditorBorderOuter); EditorBorderOuter.displayName = 'EditorBorderOuter'; EditorBorderOuter.muiName = 'SvgIcon'; export default EditorBorderOuter;
popup/src/scripts/components/search/PeopleSearchList.js
CaliAlec/ChromeIGStory
import React, { Component } from 'react'; import {connect} from 'react-redux'; import Tooltip from '@material-ui/core/Tooltip'; import List from '@material-ui/core/List'; import ListItem from '@material-ui/core/ListItem'; import ListItemText from '@material-ui/core/ListItemText'; import ListItemAvatar from '@material-ui/core/ListItemAvatar'; import Avatar from '@material-ui/core/Avatar'; import IconButton from '@material-ui/core/IconButton'; import DownloadIcon from '@material-ui/icons/GetApp'; import CircularProgress from '@material-ui/core/CircularProgress'; import InstagramApi from '../../../../../utils/InstagramApi'; import {fetchStory} from '../../../../../utils/Utils'; import {setCurrentStoryObject} from '../../utils/PopupUtils'; import AnalyticsUtil from '../../../../../utils/AnalyticsUtil'; class PeopleSearchList extends Component { constructor(props){ super(props); this.state = { selectedIndex: -1, downloadingIndex: -1, isDownloadingStory: false } } handleRequestChange (event, index) { var selectedResult = this.props.results[index]; selectedResult.id = selectedResult.pk; fetchStory(selectedResult, false, (story) => { setCurrentStoryObject('USER_STORY', story); }); this.setState({ selectedIndex: index, }); AnalyticsUtil.track("Search List Item Clicked", { type: "user", result: { id: selectedResult.pk, username: selectedResult.username } }); } getMenuItem(index) { return ( <Tooltip title="Download" > <IconButton onClick={() => { if(!this.state.isDownloadingStory) { var selectedResult = this.props.results[index]; selectedResult.id = selectedResult.pk; this.setState({ isDownloadingStory: true, downloadingIndex: index }); fetchStory(selectedResult, true, (story) => { this.setState({isDownloadingStory: false}); if(!story) { // show 'No Story Available' Snackbar message setCurrentStoryObject(null, null); } }); } }}> {(this.state.isDownloadingStory && this.state.downloadingIndex === index) ? <CircularProgress size={24}/> : <DownloadIcon />} </IconButton> </Tooltip> ); } render() { const peopleSearchListData = this.props.results.map((user, key) => { return ( <ListItem key={key} button selected={this.state.selectedIndex === key} onClick={event => this.handleRequestChange(event, key)} > <ListItemAvatar> <Avatar src={user.profile_pic_url} /> </ListItemAvatar> <ListItemText primary={user.username} secondary={user.full_name} /> {this.getMenuItem(key)} </ListItem> ) }); return ( <List onChange={this.handleRequestChange.bind(this)}> {peopleSearchListData} </List> ) } } export default PeopleSearchList;
app/components/ListItem/index.js
iFatansyReact/react-boilerplate-imagine
import React from 'react'; import Item from './Item'; import Wrapper from './Wrapper'; function ListItem(props) { return ( <Wrapper> <Item> {props.item} </Item> </Wrapper> ); } ListItem.propTypes = { item: React.PropTypes.any, }; export default ListItem;
votrfront/js/MojePredmetyPage.js
fmfi-svt/votr
import React from 'react'; import { ZapisnyListSelector } from './ZapisnyListSelector'; import { CacheRequester, Loading } from './ajax'; import { coursesStats, renderCredits, renderWeightedStudyAverage } from './coursesStats'; import { classForSemester, humanizeTerminHodnotenia, humanizeTypVyucby, plural } from './humanizeAISData'; import { PageLayout, PageTitle } from './layout'; import { Link, queryConsumer } from './router'; import { sortAs, SortableTable } from './sorting'; export var MojePredmetyColumns = [ { label: "Semester", shortLabel: <abbr title="Semester">Sem.</abbr>, prop: "semester", preferDesc: true }, { label: "Názov predmetu", prop: "nazov", cell: (hodnotenie, query) => ( <Link href={{ ...query, modal: "detailPredmetu", modalPredmetKey: hodnotenie.predmet_key, modalAkademickyRok: hodnotenie.akademicky_rok }} > {hodnotenie.nazov} </Link> ), expansionMark: true }, { label: "Skratka predmetu", prop: "skratka", hiddenClass: ["hidden-xs", "hidden-sm"] }, { label: "Kredit", prop: "kredit", process: sortAs.number }, { label: "Typ výučby", prop: "typ_vyucby", cell: (hodnotenie, query) => humanizeTypVyucby(hodnotenie.typ_vyucby), hiddenClass: ["hidden-xs"] }, { label: "Hodnotenie", prop: "hodn_znamka", cell: hodnotenie => `${hodnotenie.hodn_znamka ? hodnotenie.hodn_znamka : ""}${ hodnotenie.hodn_znamka ? " - " : ""}${ hodnotenie.hodn_znamka_popis}` }, { label: "Dátum hodnotenia", prop: "hodn_datum", process: sortAs.date, hiddenClass: ["hidden-xs", "hidden-sm"] }, { label: "Termín hodnotenia", prop: "hodn_termin", cell: hodnotenie => humanizeTerminHodnotenia(hodnotenie.hodn_termin), hiddenClass: ["hidden-xs", "hidden-sm"] } ]; MojePredmetyColumns.defaultOrder = 'd0a1'; export function MojePredmetyPageContent() { return queryConsumer(query => { var cache = new CacheRequester(); var {zapisnyListKey} = query; var [hodnotenia, message] = cache.get('get_hodnotenia', zapisnyListKey) || []; if (!hodnotenia) { return <Loading requests={cache.missing} />; } var stats = coursesStats(hodnotenia); var footer = fullTable => ( <tr> <td className={fullTable ? "" : "hidden-xs hidden-sm"} /> <td colSpan="2"> Celkom {stats.spolu.count}{" "} {plural(stats.spolu.count, "predmet", "predmety", "predmetov")} {" ("} {stats.zima.count} v zime, {stats.leto.count} v lete) </td> <td>{renderCredits(stats.spolu)} ({renderCredits(stats.zima)}&nbsp;+&nbsp;{renderCredits(stats.leto)})</td> <td className={fullTable ? "" : "hidden-xs"} /> <td>{renderWeightedStudyAverage(hodnotenia)}</td> <td className={fullTable ? "" : "hidden-xs hidden-sm"} /> <td className={fullTable ? "" : "hidden-xs hidden-sm"} /> </tr> ); return <SortableTable items={hodnotenia} columns={MojePredmetyColumns} queryKey="predmetySort" expandedContentOffset={1} message={message} footer={footer} rowClassName={hodnotenie => classForSemester(hodnotenie.semester)} />; }); } export function MojePredmetyPage() { return ( <PageLayout> <ZapisnyListSelector> <div className="header"> <PageTitle>Moje predmety</PageTitle> </div> <MojePredmetyPageContent /> </ZapisnyListSelector> </PageLayout> ); }
src/svg-icons/device/battery-50.js
mit-cml/iot-website-source
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let DeviceBattery50 = (props) => ( <SvgIcon {...props}> <path fillOpacity=".3" d="M17 5.33C17 4.6 16.4 4 15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33V13h10V5.33z"/><path d="M7 13v7.67C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V13H7z"/> </SvgIcon> ); DeviceBattery50 = pure(DeviceBattery50); DeviceBattery50.displayName = 'DeviceBattery50'; DeviceBattery50.muiName = 'SvgIcon'; export default DeviceBattery50;
app/App.js
luketlancaster/github-notetaker
import React from 'react'; import Router from 'react-router'; import routes from './config/routes'; Router.run(routes, (Root, state) => { React.render(<Root {...state}/>, document.getElementById('app')) })
examples/forms-material-ui/src/components/forms-create-overlay/Hook.js
lore/lore-forms
import React from 'react'; import createReactClass from 'create-react-class'; import moment from 'moment'; export default createReactClass({ displayName: 'Hook', render: function() { return lore.forms.tweet.create({ blueprint: 'overlay' }); } });
src/js/routes.js
VitorHP/TI3
import React from 'react'; import { IndexRoute, Route } from 'react-router'; import LobbyContainer from './containers/lobby_container'; import TableContainer from './containers/table_container'; import AppContainer from './containers/app_container'; import MainMenu from './components/main_menu'; import RacesScreenContainer from './containers/races_screen_container'; export default ( <Route path="/" component={AppContainer}> <IndexRoute component={MainMenu}/> <Route path="races" component={RacesScreenContainer}/> <Route path="table" component={TableContainer}/> </Route> )
src/components/Footer/Footer.js
dorono/resistance-calendar-frontend
import React from 'react'; import { Link } from 'react-router-dom'; import { Copyright } from '../'; import styles from './Footer.sass'; function footerLinks() { /* eslint-disable jsx-a11y/href-no-hash */ return ( <div className={styles.linksWrapper}> <Link to="/">Home</Link> <a href="https://www.facebook.com/resistancecalendar" target="_blank" rel="noopener noreferrer" > Facebook </a> <a href="https://twitter.com/ResistCalendar" target="_blank" rel="noopener noreferrer" > Twitter </a> <Link to="/privacy-policy">Privacy Policy</Link> </div> ); /* eslint-enable jsx-a11y/href-no-hash */ } const Footer = () => { const year = (new Date()).getFullYear(); return ( <footer className={styles.footer}> {footerLinks()} <Copyright year={year} /> </footer> ); }; Footer.propTypes = {}; export default Footer;
www/imports/component/TextareaClean.js
terraswat/hexagram
// TextAreaClean.js // A textarea to contain text that contains only printable characters. import React, { Component } from 'react'; import PropTypes from 'prop-types'; import utils from '/imports/common/utils.js'; export default class TextareaClean extends Component { constructor (props) { super(props); this.state = { value: this.props.value }; // Save our selves. this.componentDidMount = this.componentDidMount.bind(this); this.handleKeyPress = this.handleKeyPress.bind(this); this.handleChange = this.handleChange.bind(this); } componentDidMount () { // Set focus on this textarea if the parent did not override. if (!this.props.noFocus) { $(this.textarea).focus(); } } handleChange (event) { // This handles updates to the textarea directly by the user, // including cutting and pasting, and a user keypress. var val = event.target.value; // Skip this if we already validated with the key press. if (this.alreadyValidated) { this.alreadyValidated = false; } else { // Drop unprintables from the updated text. we need to look at the // entire text because we don't know what changed. utils.dropUnprintables(val); } // Let the parent know. this.props.onChange(val); } handleKeyPress (event) { // Don't allow unprintables here except newLine. // This does not capture cutting or pasting in the textarea. // If this is an unprintable character... if (utils.unprintableAsciiCode(event.which, true)) { // Prevent the display from being updated with the bad value. event.preventDefault(); } else { // Mark this character as validated. this.alreadyValidated = true; } } render () { return ( <textarea onKeyPress = {this.handleKeyPress} onChange = {this.handleChange} value = {this.props.value} className = {this.props.className} placeholder = {this.props.placeholder} rows = {this.props.rows} cols = {this.props.cols} ref={(textarea) => { this.textarea = textarea; }} /> ); } } TextareaClean.propTypes = { // Function to call when the textarea changes. onChange: PropTypes.func.isRequired, // Value of the textarea that the parent owns. value: PropTypes.string.isRequired, // An application-unique class to add to the textarea. className: PropTypes.string, // Text to display when the textarea is empty. placeholder: PropTypes.string, // Number of rows and columns. rows: PropTypes.string, cols: PropTypes.string, // True means to not set focus to this element. noFocus: PropTypes.bool, }; TextareaClean.defaultProps = { rows: '10', cols: '20', noFocus: false, };
src/components/LaborRightsSingle/Body.js
goodjoblife/GoodJobShare
import React from 'react'; import PropTypes from 'prop-types'; import { StickyContainer, Sticky } from 'react-sticky'; import cn from 'classnames'; import { Section, Wrapper, Heading } from 'common/base'; import GradientMask from 'common/GradientMask'; import MarkdownParser from './MarkdownParser'; import styles from './Body.module.css'; import LeftBanner from '../ExperienceSearch/Banners/Banner1'; const Body = ({ title, seoText, description, content, permissionBlock }) => ( <Section Tag="main" pageTop> <Wrapper size="m"> <Heading size="l" bold marginBottom> {title} </Heading> <div className={cn('subheadingM', styles.description)}>{description}</div> </Wrapper> <Wrapper size="l"> <div className={styles.contentWrapper}> <StickyContainer className={cn(styles.leftBanner)}> <Sticky disableCompensation> {({ style }) => ( <div style={style}> <LeftBanner /> </div> )} </Sticky> </StickyContainer> <div className={styles.content}> <GradientMask show={permissionBlock !== null}> <MarkdownParser content={content} /> </GradientMask> {permissionBlock} </div> </div> {seoText && <div className={styles.seoText}>{seoText}</div>} </Wrapper> </Section> ); Body.propTypes = { title: PropTypes.string, seoText: PropTypes.string, description: PropTypes.string.isRequired, content: PropTypes.string.isRequired, permissionBlock: PropTypes.element, }; Body.defaultProps = { title: '', description: '', content: '', permissionBlock: null, }; export default Body;
src/components/LaborRightsSingle/index.js
chejen/GoodJobShare
import React from 'react'; import Helmet from 'react-helmet'; import ImmutablePropTypes from 'react-immutable-proptypes'; import Loader from 'common/Loader'; import { formatTitle, formatCanonicalPath, formatUrl, } from 'utils/helmetHelper'; import NotFound from 'common/NotFound'; import CallToAction from 'common/CallToAction'; import Body from './Body'; import Footer from './Footer'; import { fetchMetaListIfNeeded, fetchDataIfNeeded, } from '../../actions/laborRightsSingle'; import status from '../../constants/status'; import { SITE_NAME } from '../../constants/helmetData'; class LaborRightsSingle extends React.Component { static fetchData({ store: { dispatch }, params: { id } }) { return dispatch(fetchMetaListIfNeeded()).then(() => dispatch(fetchDataIfNeeded(id)) ); } componentDidMount() { this.props.fetchMetaListIfNeeded().then(() => { this.props.fetchDataIfNeeded(this.props.params.id); }); } componentDidUpdate() { this.props.fetchMetaListIfNeeded().then(() => { this.props.fetchDataIfNeeded(this.props.params.id); }); } render() { const { id, title, description, content, coverUrl, } = this.props.data ? this.props.data.toJS() : {}; const { seoTitle = title || '', seoDescription, seoText, } = this.props.data ? this.props.data.toJS() : {}; return ( <main> <Helmet title={seoTitle} meta={[ { name: 'description', content: seoDescription }, { property: 'og:url', content: formatCanonicalPath(`/labor-rights/${id}`) }, { property: 'og:title', content: formatTitle(seoTitle, SITE_NAME) }, { property: 'og:description', content: seoDescription }, { property: 'og:image', content: formatUrl(coverUrl) }, ]} link={[ { rel: 'canonical', href: formatCanonicalPath(`/labor-rights/${id}`) }, ]} /> {this.props.status === status.FETCHING && <Loader />} { this.props.status === status.ERROR && this.props.error.get('message') === 'Not found' && <NotFound /> } { this.props.status === status.FETCHED && <div> <Body title={title} seoText={seoText} description={description} content={content} /> <Footer id={id} prev={this.props.prev} next={this.props.next} /> <CallToAction imgSrc="https://image.goodjob.life/cta-01.png" marginTop /> </div> } </main> ); } } LaborRightsSingle.propTypes = { params: React.PropTypes.object.isRequired, data: ImmutablePropTypes.map, prev: ImmutablePropTypes.map, next: ImmutablePropTypes.map, fetchMetaListIfNeeded: React.PropTypes.func.isRequired, fetchDataIfNeeded: React.PropTypes.func.isRequired, status: React.PropTypes.string.isRequired, error: ImmutablePropTypes.map, }; export default LaborRightsSingle;
client/components/common/FormRenderWrappers.js
zhakkarn/Mail-for-Good
/* eslint-disable */ import React from 'react'; import { Combobox, DropdownList } from 'react-widgets'; import { Field } from 'redux-form'; import TextEditor from '../../containers/common/TextEditor'; // Ref redux-form http://redux-form.com/6.0.5/docs/GettingStarted.md/ // Ref react-widgets https://jquense.github.io/react-widgets/ (for examples see https://github.com/erikras/redux-form/blob/master/examples/react-widgets/src/ReactWidgetsForm.js) // Ref react-rte https://github.com/sstur/react-rte /* Helper wrapper functions for react-widgets from the redux-form examples page. const renderSelectList = ({ input, ...rest }) => <SelectList {...input} onBlur={() => input.onBlur()} {...rest}/>; const renderDropdownList = ({ input, ...rest }) => <DropdownList {...input} {...rest}/>; const renderMultiselect = ({ input, ...rest }) => <Multiselect {...input} onBlur={() => input.onBlur()} value={input.value || []} // requires value to be an array {...rest}/>; */ const savedLabel = <div className="label label-success">Saved</div>; const notSavedLabel = <div className="label label-danger">Not saved</div>; export const renderSettingsDropdownList = ({ input, label, type, meta: { touched, error, warning }, exists, helpText, ...data }) => ( <div style={{ marginBottom: "1em" }}> <label>{label} - { exists ? savedLabel : notSavedLabel }</label> <p className="form-text text-muted">{helpText}</p> <div> <DropdownList {...input} {...data} /> {touched && ((error && <span className="text-red"><i className="fa fa-exclamation" /> {error}</span>) || (warning && <span>{warning}</span>))} </div> </div> ); export const renderDropdownList = ({ input, label, type, meta: { touched, error, warning }, ...data }) => ( <div> <label>{label}</label> <div> <DropdownList {...input} {...data} /> {touched && ((error && <span className="text-red"><i className="fa fa-exclamation" /> {error}</span>) || (warning && <span>{warning}</span>))} </div> </div> ); export const renderCombobox = ({ input, label, type, meta: { touched, error, warning }, ...data }) => ( <div> <label>{label}</label> <div> <Combobox {...input} {...data} suggest={true} filter="contains" /> {touched && ((error && <span className="text-red"><i className="fa fa-exclamation" /> {error}</span>) || (warning && <span>{warning}</span>))} </div> </div> ); export const renderSettingsField = ({ input, label, type, meta: { touched, error, warning }, exists, helpText, placeholder }) => { return ( <div style={{ marginBottom: "1em" }}> <label>{label} - { exists ? savedLabel : notSavedLabel }</label> <p className="form-text text-muted">{helpText}</p> <div> <input className="form-control" {...input} placeholder={placeholder} type={type}/> {touched && ((error && <span className="text-red"><i className="fa fa-exclamation" /> {error}</span>) || (warning && <span>{warning}</span>))} </div> </div> )}; export const renderField = ({ input, label, type, meta: { touched, error, warning } }) => { return ( <div> <label>{label}</label> <div> <input className={getInputClassFromType(type)} {...input} placeholder={label} type={type}/> {touched && ((error && <span className="text-red"><i className="fa fa-exclamation" /> {error}</span>) || (warning && <span>{warning}</span>))} </div> </div> )}; export const renderEditorTypeRadio = ({ input, label, type, meta: { touched, error, warning } }) => ( <div> <label>{label}</label> <div className="form-group"> <label><Field component="input" type="radio" name={input.name} value="Plaintext" /> Plaintext</label> <br /> <label><Field component="input" type="radio" name={input.name} value="HTML" /> HTML</label> <br /> {touched && ((error && <span className="text-red"><i className="fa fa-exclamation" /> {error}</span>) || (warning && <span>{warning}</span>))} </div> </div> ); export const renderTextEditor = ({ input, label, type, meta: { touched, error, warning }, textEditorValue, textEditorType, emailBody }) => ( <div> <label>{label}</label> <div> <Field name={emailBody ? emailBody : 'emailBody'} value={() => input.value} onChange={() => input.onChange} component={TextEditor} textEditorValue={textEditorValue} textEditorType={textEditorType} /> {touched && ((error && <span className="text-red"><i className="fa fa-exclamation" /> {error}</span>) || (warning && <span>{warning}</span>))} </div> </div> ); function getInputClassFromType(type) { let properClass = '' switch (type) { case "datetime-local": case "email": case "password": case "search": case "tel": case "text": case "url": properClass="form-control"; break; case "checkbox": case "radio": properClass="form-check-input"; break; } return properClass; }
test/BadgeSpec.js
tonylinyy/react-bootstrap
import React from 'react'; import ReactTestUtils from 'react/lib/ReactTestUtils'; import Badge from '../src/Badge'; describe('Badge', function () { it('Should output a badge with content', function () { let instance = ReactTestUtils.renderIntoDocument( <Badge> <strong>Content</strong> </Badge> ); assert.ok(ReactTestUtils.findRenderedDOMComponentWithTag(instance, 'strong')); }); it('Should have a badge class', function () { let instance = ReactTestUtils.renderIntoDocument( <Badge> Content </Badge> ); assert.ok(React.findDOMNode(instance).className.match(/\bbadge\b/)); }); it('Should have a badge using a number', function () { let count = 42; let instance = ReactTestUtils.renderIntoDocument( <Badge> {count} </Badge> ); assert.ok(React.findDOMNode(instance).className.match(/\bbadge\b/)); }); it('Should have a badge using a a mix of content', function () { let count = 42; let instance = ReactTestUtils.renderIntoDocument( <Badge> £{count} </Badge> ); assert.ok(React.findDOMNode(instance).className.match(/\bbadge\b/)); }); it('Should have a badge class pulled right', function () { let instance = ReactTestUtils.renderIntoDocument( <Badge pullRight> Content </Badge> ); assert.ok(React.findDOMNode(instance).className.match(/\bpull-right\b/)); }); it('Should not have a badge class when empty', function () { let instance = ReactTestUtils.renderIntoDocument( <Badge /> ); assert.notOk(React.findDOMNode(instance).className.match(/\bbadge\b/)); }); });
src/Notification.js
rolandsusans/react-bootstrap-table
import React, { Component } from 'react'; import { ToastContainer, ToastMessage } from '@allenfang/react-toastr'; const ToastrMessageFactory = React.createFactory(ToastMessage.animation); class Notification extends Component { // allow type is success,info,warning,error notice(type, msg, title) { this.refs.toastr[type]( msg, title, { mode: 'single', timeOut: 5000, extendedTimeOut: 1000, showAnimation: 'animated bounceIn', hideAnimation: 'animated bounceOut' }); } render() { return ( <ToastContainer ref='toastr' toastMessageFactory={ ToastrMessageFactory } id='toast-container' className='toast-top-right'/> ); } } export default Notification;
test/OverlayTriggerSpec.js
zanjs/react-bootstrap
import React from 'react'; import ReactTestUtils from 'react/lib/ReactTestUtils'; import OverlayTrigger from '../src/OverlayTrigger'; import Popover from '../src/Popover'; import Tooltip from '../src/Tooltip'; import { render } from './helpers'; describe('OverlayTrigger', function() { it('Should create OverlayTrigger element', function() { const instance = ReactTestUtils.renderIntoDocument( <OverlayTrigger overlay={<div>test</div>}> <button>button</button> </OverlayTrigger> ); const overlayTrigger = React.findDOMNode(instance); assert.equal(overlayTrigger.nodeName, 'BUTTON'); }); it('Should pass OverlayTrigger onClick prop to child', function() { const callback = sinon.spy(); const instance = ReactTestUtils.renderIntoDocument( <OverlayTrigger overlay={<div>test</div>} onClick={callback}> <button>button</button> </OverlayTrigger> ); const overlayTrigger = React.findDOMNode(instance); ReactTestUtils.Simulate.click(overlayTrigger); callback.called.should.be.true; }); it('Should show after click trigger', function() { const instance = ReactTestUtils.renderIntoDocument( <OverlayTrigger trigger='click' overlay={<div>test</div>}> <button>button</button> </OverlayTrigger> ); const overlayTrigger = React.findDOMNode(instance); ReactTestUtils.Simulate.click(overlayTrigger); instance.state.isOverlayShown.should.be.true; }); it('Should keep trigger handlers', function(done) { const instance = render( <div> <OverlayTrigger trigger='focus' overlay={<div>test</div>}> <button onBlur={()=> done()}>button</button> </OverlayTrigger> <input id='target'/> </div> , document.body); const overlayTrigger = React.findDOMNode(instance).firstChild; ReactTestUtils.Simulate.blur(overlayTrigger); }); it('Should maintain overlay classname', function() { const instance = ReactTestUtils.renderIntoDocument( <OverlayTrigger trigger='click' overlay={<div className='test-overlay'>test</div>}> <button>button</button> </OverlayTrigger> ); const overlayTrigger = React.findDOMNode(instance); ReactTestUtils.Simulate.click(overlayTrigger); expect(document.getElementsByClassName('test-overlay').length).to.equal(1); }); it('Should pass transition callbacks to Transition', function (done) { let count = 0; let increment = ()=> count++; let overlayTrigger; let instance = ReactTestUtils.renderIntoDocument( <OverlayTrigger trigger='click' overlay={<div>test</div>} onHide={() => {}} onExit={increment} onExiting={increment} onExited={()=> { increment(); expect(count).to.equal(6); done(); }} onEnter={increment} onEntering={increment} onEntered={()=> { increment(); ReactTestUtils.Simulate.click(overlayTrigger); }} > <button>button</button> </OverlayTrigger> ); overlayTrigger = React.findDOMNode(instance); ReactTestUtils.Simulate.click(overlayTrigger); }); it('Should forward requested context', function() { const contextTypes = { key: React.PropTypes.string }; const contextSpy = sinon.spy(); class ContextReader extends React.Component { render() { contextSpy(this.context.key); return <div />; } } ContextReader.contextTypes = contextTypes; const TriggerWithContext = OverlayTrigger.withContext(contextTypes); class ContextHolder extends React.Component { getChildContext() { return {key: 'value'}; } render() { return ( <TriggerWithContext trigger="click" overlay={<ContextReader />} > <button>button</button> </TriggerWithContext> ); } } ContextHolder.childContextTypes = contextTypes; const instance = ReactTestUtils.renderIntoDocument(<ContextHolder />); const overlayTrigger = React.findDOMNode(instance); ReactTestUtils.Simulate.click(overlayTrigger); contextSpy.calledWith('value').should.be.true; }); describe('overlay types', function() { [ { name: 'Popover', overlay: (<Popover>test</Popover>) }, { name: 'Tooltip', overlay: (<Tooltip>test</Tooltip>) } ].forEach(function(testCase) { describe(testCase.name, function() { let instance, overlayTrigger; beforeEach(function() { instance = ReactTestUtils.renderIntoDocument( <OverlayTrigger trigger="click" overlay={testCase.overlay}> <button>button</button> </OverlayTrigger> ); overlayTrigger = React.findDOMNode(instance); }); it('Should handle trigger without warnings', function() { ReactTestUtils.Simulate.click(overlayTrigger); }); }); }); }); describe('rootClose', function() { [ { label: 'true', rootClose: true, shownAfterClick: false }, { label: 'default (false)', rootClose: null, shownAfterClick: true } ].forEach(function(testCase) { describe(testCase.label, function() { let instance; beforeEach(function () { instance = ReactTestUtils.renderIntoDocument( <OverlayTrigger overlay={<div>test</div>} trigger='click' rootClose={testCase.rootClose} > <button>button</button> </OverlayTrigger> ); const overlayTrigger = React.findDOMNode(instance); ReactTestUtils.Simulate.click(overlayTrigger); }); it('Should have correct isOverlayShown state', function () { document.documentElement.click(); // Need to click this way for it to propagate to document element. instance.state.isOverlayShown.should.equal(testCase.shownAfterClick); }); }); }); describe('replaced overlay', function () { let instance; beforeEach(function () { class ReplacedOverlay extends React.Component { constructor(props) { super(props); this.handleClick = this.handleClick.bind(this); this.state = {replaced: false}; } handleClick() { this.setState({replaced: true}); } render() { if (this.state.replaced) { return ( <div>replaced</div> ); } else { return ( <div> <a id="replace-overlay" onClick={this.handleClick}> original </a> </div> ); } } } instance = ReactTestUtils.renderIntoDocument( <OverlayTrigger overlay={<ReplacedOverlay />} trigger='click' rootClose={true} > <button>button</button> </OverlayTrigger> ); const overlayTrigger = React.findDOMNode(instance); ReactTestUtils.Simulate.click(overlayTrigger); }); it('Should still be shown', function () { // Need to click this way for it to propagate to document element. const replaceOverlay = document.getElementById('replace-overlay'); replaceOverlay.click(); instance.state.isOverlayShown.should.be.true; }); }); }); });
mm-react/src/components/docs/Ckeditor.js
Ameobea/tickgrinder
//! Creates a ckeditor instance. Contains options for taking callbacks involved with saving changes. /* global CKEDITOR */ import React from 'react'; import { connect } from 'dva'; /** * After the CKEditor plugin has loaded, initialize the editor */ function awaitCk(rand) { setTimeout(() => { let ckeditorLoaded = true; try{ CKEDITOR; } catch(e) { if(e.name == 'ReferenceError') { ckeditorLoaded = false; } } if(ckeditorLoaded) { CKEDITOR.replace( `ckeditor-${rand}` ); } else { awaitCk(rand); } }, 50); } class CKEditor extends React.Component { componentDidMount() { // add a script tag onto the document that loads the CKEditor script let ckeditor_src = document.createElement('script'); ckeditor_src.type = 'text/javascript'; ckeditor_src.async = true; ckeditor_src.src='/ckeditor/ckeditor.js'; document.getElementById('ckeditor-' + this.props.rand).appendChild(ckeditor_src); // wait for the CKEditor script to load and then initialize the editor awaitCk(this.props.rand); // register our id as the active editor instance this.props.dispatch({type: 'documents/setEditorId', id: this.props.rand}); } shouldComponentUpdate(...args) { return false; } render() { return ( <textarea id={'ckeditor-' + this.props.rand} /> ); } } CKEditor.propTypes = { rand: React.PropTypes.number.isRequired, }; export default connect()(CKEditor);
docs/app/Examples/views/Comment/Variations/CommentExampleMinimal.js
clemensw/stardust
import React from 'react' import { Button, Comment, Form, Header } from 'semantic-ui-react' const CommentExampleMinimal = () => ( <Comment.Group minimal> <Header as='h3' dividing>Comments</Header> <Comment> <Comment.Avatar as='a' src='http://semantic-ui.com/images/avatar/small/matt.jpg' /> <Comment.Content> <Comment.Author as='a'>Matt</Comment.Author> <Comment.Metadata> <span>Today at 5:42PM</span> </Comment.Metadata> <Comment.Text>How artistic!</Comment.Text> <Comment.Actions> <a>Reply</a> </Comment.Actions> </Comment.Content> </Comment> <Comment> <Comment.Avatar as='a' src='http://semantic-ui.com/images/avatar/small/elliot.jpg' /> <Comment.Content> <Comment.Author as='a'>Elliot Fu</Comment.Author> <Comment.Metadata> <span>Yesterday at 12:30AM</span> </Comment.Metadata> <Comment.Text> <p>This has been very useful for my research. Thanks as well!</p> </Comment.Text> <Comment.Actions> <a>Reply</a> </Comment.Actions> </Comment.Content> <Comment.Group> <Comment> <Comment.Avatar as='a' src='http://semantic-ui.com/images/avatar/small/jenny.jpg' /> <Comment.Content> <Comment.Author as='a'>Jenny Hess</Comment.Author> <Comment.Metadata> <span>Just now</span> </Comment.Metadata> <Comment.Text>Elliot you are always so right :)</Comment.Text> <Comment.Actions> <a>Reply</a> </Comment.Actions> </Comment.Content> </Comment> </Comment.Group> </Comment> <Comment> <Comment.Avatar as='a' src='http://semantic-ui.com/images/avatar/small/joe.jpg' /> <Comment.Content> <Comment.Author as='a'>Joe Henderson</Comment.Author> <Comment.Metadata> <span>5 days ago</span> </Comment.Metadata> <Comment.Text>Dude, this is awesome. Thanks so much</Comment.Text> <Comment.Actions> <a>Reply</a> </Comment.Actions> </Comment.Content> </Comment> <Form reply onSubmit={e => e.preventDefault()}> <Form.TextArea /> <Button content='Add Reply' labelPosition='left' icon='edit' primary /> </Form> </Comment.Group> ) export default CommentExampleMinimal
app/javascript/mastodon/features/compose/components/search.js
summoners-riftodon/mastodon
import React from 'react'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import Overlay from 'react-overlays/lib/Overlay'; import Motion from '../../ui/util/optional_motion'; import spring from 'react-motion/lib/spring'; import { searchEnabled } from '../../../initial_state'; const messages = defineMessages({ placeholder: { id: 'search.placeholder', defaultMessage: 'Search' }, }); class SearchPopout extends React.PureComponent { static propTypes = { style: PropTypes.object, }; render () { const { style } = this.props; const extraInformation = searchEnabled ? <FormattedMessage id='search_popout.tips.full_text' defaultMessage='Simple text returns statuses you have written, favourited, boosted, or have been mentioned in, as well as matching usernames, display names, and hashtags.' /> : <FormattedMessage id='search_popout.tips.text' defaultMessage='Simple text returns matching display names, usernames and hashtags' />; return ( <div style={{ ...style, position: 'absolute', width: 285 }}> <Motion defaultStyle={{ opacity: 0, scaleX: 0.85, scaleY: 0.75 }} style={{ opacity: spring(1, { damping: 35, stiffness: 400 }), scaleX: spring(1, { damping: 35, stiffness: 400 }), scaleY: spring(1, { damping: 35, stiffness: 400 }) }}> {({ opacity, scaleX, scaleY }) => ( <div className='search-popout' style={{ opacity: opacity, transform: `scale(${scaleX}, ${scaleY})` }}> <h4><FormattedMessage id='search_popout.search_format' defaultMessage='Advanced search format' /></h4> <ul> <li><em>#example</em> <FormattedMessage id='search_popout.tips.hashtag' defaultMessage='hashtag' /></li> <li><em>@username@domain</em> <FormattedMessage id='search_popout.tips.user' defaultMessage='user' /></li> <li><em>URL</em> <FormattedMessage id='search_popout.tips.user' defaultMessage='user' /></li> <li><em>URL</em> <FormattedMessage id='search_popout.tips.status' defaultMessage='status' /></li> </ul> {extraInformation} </div> )} </Motion> </div> ); } } @injectIntl export default class Search extends React.PureComponent { static propTypes = { value: PropTypes.string.isRequired, submitted: PropTypes.bool, onChange: PropTypes.func.isRequired, onSubmit: PropTypes.func.isRequired, onClear: PropTypes.func.isRequired, onShow: PropTypes.func.isRequired, intl: PropTypes.object.isRequired, }; state = { expanded: false, }; handleChange = (e) => { this.props.onChange(e.target.value); } handleClear = (e) => { e.preventDefault(); if (this.props.value.length > 0 || this.props.submitted) { this.props.onClear(); } } handleKeyDown = (e) => { if (e.key === 'Enter') { e.preventDefault(); this.props.onSubmit(); } else if (e.key === 'Escape') { document.querySelector('.ui').parentElement.focus(); } } noop () { } handleFocus = () => { this.setState({ expanded: true }); this.props.onShow(); } handleBlur = () => { this.setState({ expanded: false }); } render () { const { intl, value, submitted } = this.props; const { expanded } = this.state; const hasValue = value.length > 0 || submitted; return ( <div className='search'> <label> <span style={{ display: 'none' }}>{intl.formatMessage(messages.placeholder)}</span> <input className='search__input' type='text' placeholder={intl.formatMessage(messages.placeholder)} value={value} onChange={this.handleChange} onKeyUp={this.handleKeyDown} onFocus={this.handleFocus} onBlur={this.handleBlur} /> </label> <div role='button' tabIndex='0' className='search__icon' onClick={this.handleClear}> <i className={`fa fa-search ${hasValue ? '' : 'active'}`} /> <i aria-label={intl.formatMessage(messages.placeholder)} className={`fa fa-times-circle ${hasValue ? 'active' : ''}`} /> </div> <Overlay show={expanded && !hasValue} placement='bottom' target={this}> <SearchPopout /> </Overlay> </div> ); } }
src/chat/ui/NavBackAbs.js
elarasu/roverz-chat
import React from 'react'; import { TouchableOpacity, StyleSheet, } from 'react-native'; import { Icon } from 'react-native-elements'; import { Actions } from 'react-native-router-flux'; import PropTypes from 'prop-types'; import { isIphoneX } from 'react-native-iphone-x-helper'; import { AppColors } from '../../theme/'; const styles = StyleSheet.create({ container: { position: 'absolute', top: 20, left: 20, padding: 5, backgroundColor: AppColors.brand().nA_style, borderRadius: 40, }, }); const icon = AppColors.brand().nA_Icon; export default class NavBackAbs extends React.Component { constructor(props) { super(props); this.state = { title: this.props.title, }; } componentWillMount() { /* this.setState({ title: Application.base.instance, }); */ } componentDidMount() { } render() { return ( <TouchableOpacity style={[styles.container, { top: isIphoneX() ? 40 : 20 }]} onPress={Actions.pop} > <Icon name="arrow-back" size={30} color={icon} width={30} /> </TouchableOpacity> ); } } NavBackAbs.defaultProps = { title: '', }; NavBackAbs.propTypes = { title: PropTypes.string, };
admin/client/components/FooterBar.js
mikaoelitiana/keystone
import React from 'react'; import blacklist from 'blacklist'; var FooterBar = React.createClass({ propTypes: { style: React.PropTypes.object }, getDefaultProps () { return { style: {} }; }, getInitialState () { return { position: 'relative', width: 'auto', height: 'auto', top: 0 }; }, componentDidMount () { // Bail in IE8 because React doesn't support the onScroll event in that browser // Conveniently (!) IE8 doesn't have window.getComputedStyle which we also use here if (!window.getComputedStyle) return; var footer = this.refs.footer; this.windowSize = this.getWindowSize(); var footerStyle = window.getComputedStyle(footer); this.footerSize = { x: footer.offsetWidth, y: footer.offsetHeight + parseInt(footerStyle.marginTop || '0') }; window.addEventListener('scroll', this.recalcPosition, false); window.addEventListener('resize', this.recalcPosition, false); this.recalcPosition(); }, getWindowSize () { return { x: window.innerWidth, y: window.innerHeight }; }, recalcPosition () { var wrapper = this.refs.wrapper; this.footerSize.x = wrapper.offsetWidth; var offsetTop = 0; var offsetEl = wrapper; while (offsetEl) { offsetTop += offsetEl.offsetTop; offsetEl = offsetEl.offsetParent; } var maxY = offsetTop + this.footerSize.y; var viewY = window.scrollY + window.innerHeight; var newSize = this.getWindowSize(); var sizeChanged = (newSize.x !== this.windowSize.x || newSize.y !== this.windowSize.y); this.windowSize = newSize; var newState = { width: this.footerSize.x, height: this.footerSize.y }; if (viewY > maxY && (sizeChanged || this.mode !== 'inline')) { this.mode = 'inline'; newState.top = 0; newState.position = 'absolute'; this.setState(newState); } else if (viewY <= maxY && (sizeChanged || this.mode !== 'fixed')) { this.mode = 'fixed'; newState.top = window.innerHeight - this.footerSize.y; newState.position = 'fixed'; this.setState(newState); } }, render () { var wrapperStyle = { height: this.state.height, marginTop: 60, position: 'relative' }; var footerProps = blacklist(this.props, 'children', 'style'); var footerStyle = Object.assign({}, this.props.style, { position: this.state.position, top: this.state.top, width: this.state.width, height: this.state.height }); return ( <div ref="wrapper" style={wrapperStyle}> <div ref="footer" style={footerStyle} {...footerProps}>{this.props.children}</div> </div> ); } }); module.exports = FooterBar;
packages/web/examples/NumberBox/src/index.js
appbaseio/reactivesearch
import React from 'react'; import ReactDOM from 'react-dom'; import { ReactiveBase, NumberBox, ResultList, ReactiveList } from '@appbaseio/reactivesearch'; import './index.css'; const Main = () => ( <ReactiveBase app="good-books-ds" url="https://a03a1cb71321:75b6603d-9456-4a5a-af6b-a487b309eb61@appbase-demo-ansible-abxiydt-arc.searchbase.io" enableAppbase > <div className="row reverse-labels"> <div className="col"> <NumberBox componentId="BookSensor" dataField="average_rating_rounded" data={{ label: 'Book Rating', start: 2, end: 5, }} labelPosition="left" /> </div> <div className="col" style={{ backgroundColor: '#fafafa' }}> <ReactiveList componentId="SearchResult" dataField="original_title" from={0} size={3} className="result-list-container" pagination react={{ and: 'BookSensor', }} render={({ data }) => ( <ReactiveList.ResultListWrapper> {data.map(item => ( <ResultList key={item._id}> <ResultList.Image src={item.image} /> <ResultList.Content> <ResultList.Title> <div className="book-title" dangerouslySetInnerHTML={{ __html: item.original_title, }} /> </ResultList.Title> <ResultList.Description> <div className="flex column justify-space-between"> <div> <div> by{' '} <span className="authors-list"> {item.authors} </span> </div> <div className="ratings-list flex align-center"> <span className="stars"> {Array(item.average_rating_rounded) .fill('x') .map((i, index) => ( <i className="fas fa-star" key={index} /> )) // eslint-disable-line } </span> <span className="avg-rating"> ({item.average_rating} avg) </span> </div> </div> <span className="pub-year"> Pub {item.original_publication_year} </span> </div> </ResultList.Description> </ResultList.Content> </ResultList> ))} </ReactiveList.ResultListWrapper> )} /> </div> </div> </ReactiveBase> ); ReactDOM.render(<Main />, document.getElementById('root'));
src/components/common/NavBarCancel.js
jinqiupeter/mtsr
import React from 'react'; import {StyleSheet, Platform, View, Text} from 'react-native'; import {Actions} from 'react-native-router-flux'; import dismissKeyboard from 'dismissKeyboard'; import * as components from '../'; export default () => { return <components.NavBarLeftButton text='取消' onPress={() => { dismissKeyboard(); Actions.pop(); }} textStyle={styles.text} />; } const styles = StyleSheet.create({ text: { fontSize: 14, } });
web/app/data/load.js
bitemyapp/serials
// @flow import {map, flatten} from 'lodash' import {Promise} from 'es6-promise' import React from 'react' type Route = { handler: { load:Function; } } export function loadAll(routes:Array<Route>, params:Object, query:Object, onData:(data:any)=>void) { var data = {loaded: false}; routes .filter(route => route.handler.load) .forEach(function(route) { // ok, they're allowed to do more than one, right? var promises = route.handler.load(params, query) return map(promises, function(promise, name) { if (!promise.then) { // it isn't a promise, it's a value // resolve it promise = Promise.resolve(promise) } return promise.then(function(d) { data[name] = d data.loaded = true onData(data) }, throwError) }) }) } function throwError(err) { throw err } // store the last one :) var lastHandler:any var lastState:any var lastData:any var innerRender:any function nothing() {} export function run(ren:Function, onUrlChange:Function = nothing):Function { innerRender = ren return function(Handler, state) { lastHandler = Handler lastState = state lastData = {loaded: false} onUrlChange(Handler, state) // render once without any data render() // render again every time any of the promises resolve loadAll(state.routes, state.params, state.query, render) } } export function render(data:any = lastData) { lastData = data var Handler = lastHandler var state = lastState innerRender(Handler, state, data) } // global reload export function reloadHandler() { loadAll(lastState.routes, lastState.params, lastState.query, render) }
src/js/components/icons/base/PlatformPiedPiper.js
odedre/grommet-final
/** * @description PlatformPiedPiper SVG Icon. * @property {string} a11yTitle - Accessibility Title. If not set uses the default title of the status icon. * @property {string} colorIndex - The color identifier to use for the stroke color. * If not specified, this component will default to muiTheme.palette.textColor. * @property {xsmall|small|medium|large|xlarge|huge} size - The icon size. Defaults to small. * @property {boolean} responsive - Allows you to redefine what the coordinates. * @example * <svg width="24" height="24" ><path d="M0,19.4210526 C2.2736843,19.4210526 4.04210525,18.6631579 4.04210525,18.6631579 C4.04210525,18.6631579 7.0736842,11.0842105 11.368421,11.0842105 C14.6526316,11.0842105 15.1578947,13.6105264 15.1578947,13.6105264 C15.1578947,13.6105264 19.9578947,4.26315788 24,3 C20.2105263,6.03157895 20.7157895,9.31578948 18.9473684,10.831579 C17.1789474,12.3473684 17.1789477,10.8381579 15.1578951,14.375 C10.6105267,14.8802632 9.125,16.3894739 6.06315789,18.1578947 C11.3684206,15.6315794 12.3789474,15.3789474 17.1789474,15.631579 C17.6828892,15.6581022 17.9368421,15.8842105 17.6842105,16.3894737 C16.951256,17.8553827 16.4037001,20.0617486 15.4105263,19.9263158 C9.85263157,19.1684211 6.56842104,20.431579 3.78947367,20.431579 C1.0105263,20.431579 0,19.9263158 0,19.4210526 Z"/></svg> */ // (C) Copyright 2014-2015 Hewlett Packard Enterprise Development LP import React, { Component } from 'react'; import PropTypes from 'prop-types'; import classnames from 'classnames'; import CSSClassnames from '../../../utils/CSSClassnames'; import Intl from '../../../utils/Intl'; import Props from '../../../utils/Props'; const CLASS_ROOT = CSSClassnames.CONTROL_ICON; const COLOR_INDEX = CSSClassnames.COLOR_INDEX; export default class Icon extends Component { render () { const { className, colorIndex } = this.props; let { a11yTitle, size, responsive } = this.props; let { intl } = this.context; const classes = classnames( CLASS_ROOT, `${CLASS_ROOT}-platform-pied-piper`, className, { [`${CLASS_ROOT}--${size}`]: size, [`${CLASS_ROOT}--responsive`]: responsive, [`${COLOR_INDEX}-${colorIndex}`]: colorIndex } ); a11yTitle = a11yTitle || Intl.getMessage(intl, 'platform-pied-piper'); const restProps = Props.omit(this.props, Object.keys(Icon.propTypes)); return <svg {...restProps} version="1.1" viewBox="0 0 24 24" width="24px" height="24px" role="img" className={classes} aria-label={a11yTitle}><path fillRule="evenodd" d="M0,19.4210526 C2.2736843,19.4210526 4.04210525,18.6631579 4.04210525,18.6631579 C4.04210525,18.6631579 7.0736842,11.0842105 11.368421,11.0842105 C14.6526316,11.0842105 15.1578947,13.6105264 15.1578947,13.6105264 C15.1578947,13.6105264 19.9578947,4.26315788 24,3 C20.2105263,6.03157895 20.7157895,9.31578948 18.9473684,10.831579 C17.1789474,12.3473684 17.1789477,10.8381579 15.1578951,14.375 C10.6105267,14.8802632 9.125,16.3894739 6.06315789,18.1578947 C11.3684206,15.6315794 12.3789474,15.3789474 17.1789474,15.631579 C17.6828892,15.6581022 17.9368421,15.8842105 17.6842105,16.3894737 C16.951256,17.8553827 16.4037001,20.0617486 15.4105263,19.9263158 C9.85263157,19.1684211 6.56842104,20.431579 3.78947367,20.431579 C1.0105263,20.431579 0,19.9263158 0,19.4210526 Z"/></svg>; } }; Icon.contextTypes = { intl: PropTypes.object }; Icon.defaultProps = { responsive: true }; Icon.displayName = 'PlatformPiedPiper'; Icon.icon = true; Icon.propTypes = { a11yTitle: PropTypes.string, colorIndex: PropTypes.string, size: PropTypes.oneOf(['xsmall', 'small', 'medium', 'large', 'xlarge', 'huge']), responsive: PropTypes.bool };
src/parser/priest/shadow/modules/spells/VampiricTouch.js
FaideWW/WoWAnalyzer
import React from 'react'; import Analyzer from 'parser/core/Analyzer'; import Enemies from 'parser/shared/modules/Enemies'; import SPELLS from 'common/SPELLS'; import SpellLink from 'common/SpellLink'; import SpellIcon from 'common/SpellIcon'; import { formatPercentage } from 'common/format'; import SmallStatisticBox, { STATISTIC_ORDER } from 'interface/others/SmallStatisticBox'; class VampiricTouch extends Analyzer { static dependencies = { enemies: Enemies, }; get uptime() { return this.enemies.getBuffUptime(SPELLS.VAMPIRIC_TOUCH.id) / this.owner.fightDuration; } get suggestionThresholds() { return { actual: this.uptime, isLessThan: { minor: 0.95, average: 0.90, major: 0.8, }, style: 'percentage', }; } suggestions(when) { const { isLessThan: { minor, average, major, }, } = this.suggestionThresholds; when(this.uptime).isLessThan(minor) .addSuggestion((suggest, actual, recommended) => { return suggest(<span>Your <SpellLink id={SPELLS.VAMPIRIC_TOUCH.id} /> uptime can be improved. Try to pay more attention to your <SpellLink id={SPELLS.VAMPIRIC_TOUCH.id} /> on the boss.</span>) .icon(SPELLS.VAMPIRIC_TOUCH.icon) .actual(`${formatPercentage(actual)}% Vampiric Touch uptime`) .recommended(`>${formatPercentage(recommended)}% is recommended`) .regular(average).major(major); }); } statistic() { return ( <SmallStatisticBox position={STATISTIC_ORDER.CORE(3)} icon={<SpellIcon id={SPELLS.VAMPIRIC_TOUCH.id} />} value={`${formatPercentage(this.uptime)} %`} label="Vampiric Touch uptime" /> ); } } export default VampiricTouch;
apps/mk-app-versions/action.js
ziaochina/mk-demo
import React from 'react' import { action as MetaAction, AppLoader } from 'mk-meta-engine' import config from './config' class action { constructor(option) { this.metaAction = option.metaAction this.config = config.current this.webapi = this.config.webapi } onInit = ({ component, injections }) => { this.component = component this.injections = injections injections.reduce('init') this.load() } load = async () => { const response = await this.webapi.version.query() this.injections.reduce('load', response) } } export default function creator(option) { const metaAction = new MetaAction(option), o = new action({ ...option, metaAction }), ret = { ...metaAction, ...o } metaAction.config({ metaHandlers: ret }) return ret }
src/applications/static-pages/health-care-manage-benefits/refill-track-prescriptions-page/components/AuthContent/index.js
department-of-veterans-affairs/vets-website
// Node modules. import React from 'react'; import PropTypes from 'prop-types'; import Telephone, { CONTACTS, } from '@department-of-veterans-affairs/component-library/Telephone'; // Relative imports. import CernerCallToAction from '../../../components/CernerCallToAction'; import { getCernerURL } from 'platform/utilities/cerner'; import { mhvUrl } from 'platform/site-wide/mhv/utilities'; import ServiceProvidersList from 'platform/user/authentication/components/ServiceProvidersList'; export const AuthContent = ({ authenticatedWithSSOe, cernerFacilities, otherFacilities, }) => ( <> <CernerCallToAction cernerFacilities={cernerFacilities} otherFacilities={otherFacilities} linksHeaderText="Refill prescriptions from:" myHealtheVetLink={mhvUrl( authenticatedWithSSOe, 'web/myhealthevet/refill-prescriptions', )} myVAHealthLink={getCernerURL('/pages/medications/current')} /> <div> <div itemScope itemType="http://schema.org/Question"> <h2 itemProp="name" id="how-can-the-va-prescription-re"> How can VA’s prescription tools help me manage my health care? </h2> <div itemProp="acceptedAnswer" itemScope itemType="http://schema.org/Answer" > <div itemProp="text"> <div className="processed-content"> <p> These web- and mobile-based services help you manage your VA prescriptions online. </p> <p> <strong>With these tools, you can:</strong> </p> <ul> <li>Refill your VA prescriptions online</li> <li>View your past and current VA prescriptions</li> <li> Track the delivery of each prescription mailed within the past 30 days </li> <li> Get email notifications to let you know when to expect your prescriptions </li> <li> Create lists to keep track of all your medicines (including prescriptions, over-the-counter medicines, herbal remedies, and supplements) </li> </ul> </div> </div> </div> </div> <div itemScope itemType="http://schema.org/Question"> <h2 itemProp="name" id="am-i-eligible-to-use-this-tool"> Am I eligible to use this tool? </h2> <div itemProp="acceptedAnswer" itemScope itemType="http://schema.org/Answer" > <div itemProp="text"> <div className="processed-content"> <p> You can use these tools if you meet all of the requirements listed below. </p> <p> <strong>All of these must be true. You:</strong> </p> <ul> <li> Are enrolled in VA health care, <strong>and</strong> </li> <li> Are registered as a patient in a VA health facility,{' '} <strong>and</strong> </li> <li> Have a refillable prescription from a VA doctor that you’ve filled at a VA pharmacy and that’s being handled by the VA Mail Order Pharmacy </li> </ul> <p> <a href="/health-care/how-to-apply/"> Find out how to apply for VA health care </a> </p> <p> <strong>And you must have one of these free accounts:</strong> </p> <ServiceProvidersList /> </div> </div> </div> </div> <div itemScope itemType="http://schema.org/Question"> <h2 itemProp="name" id="once-im-signed-in-how-do-i-get"> Once I&apos;m signed in, how do I get started? </h2> <div itemProp="acceptedAnswer" itemScope itemType="http://schema.org/Answer" > <div itemProp="text"> <div className="processed-content"> <h3> If you’re refilling and tracking prescriptions on My HealtheVet </h3> <p> On your Welcome page, you’ll find a module for{' '} <strong>Pharmacy</strong>. Within that module, you’ll find these 3 options: </p> <ul> <li> <strong>Refill VA Prescriptions</strong> </li> <li> <strong>Track Delivery</strong> </li> <li> <strong>Medications List</strong> </li> </ul> <p> Click on the link you want. You’ll get instructions on the next page to get started. </p> <h3> If you’re refilling and tracking prescriptions on My VA Health </h3> <p> In the navigation menu, you’ll find a section titled{' '} <strong>Pharmacy</strong>. Within that section, you’ll find these 2 options: </p> <ul> <li> <strong>View current medications</strong>, and </li> <li> <strong>View comprehensive medications</strong> </li> </ul> <p> Choose the medication list you want. For each medication, you’ll then find options to refill and renew. </p> </div> </div> </div> </div> <div itemScope itemType="http://schema.org/Question"> <h2 itemProp="name" id="can-i-use-this-tool-to-refill-"> Can I use these tools to refill and track all my VA prescriptions? </h2> <div itemProp="acceptedAnswer" itemScope itemType="http://schema.org/Answer" > <div itemProp="text"> <div className="processed-content"> <p> <strong> You can refill and track most of your VA prescriptions, including: </strong> </p> <ul> <li>VA medicines that you’ve refilled or renewed</li> <li>Wound care supplies</li> <li>Diabetic supplies</li> <li> Other products and supplies sent through the VA Mail Order Pharmacy </li> </ul> <p> Your VA health care team may decide not to ship medicines that you don’t need right away, medicines that aren’t commonly prescribed, or those that require you to be closely monitored. In these cases, you’ll need to pick up your prescription from the VA health facility where you get care. </p> <p> You can’t refill some medicines, like certain pain medications and narcotics. You’ll need to get a new prescription from your VA provider each time you need more of these medicines. </p> <p> <strong>Note: </strong> If you receive care at both Mann-Grandstaff VA medical center and another VA facility, you may need to use both web portals to refill and track VA prescriptions. </p> </div> </div> </div> </div> <div itemScope itemType="http://schema.org/Question"> <h2 itemProp="name" id="where-will-va-send-my-prescrip"> Where will VA send my prescriptions? </h2> <div itemProp="acceptedAnswer" itemScope itemType="http://schema.org/Answer" > <div itemProp="text"> <div className="processed-content"> <p> Our mail order pharmacy will send your prescriptions to the address we have on file for you. We ship to all addresses in the United States and its territories. We don’t ship prescriptions to foreign countries. </p> <p> <strong>Important note:</strong> Changing your address within My HealtheVet or My VA Health doesn’t change your address for prescription shipments. </p> <p> <strong> To change your address on file with VA for prescription shipments: </strong> </p> <ul> <li> Go to your <a href="/profile/">VA.gov profile</a>.<br /> Click <strong>Edit</strong> next to each address you’d like to change, including your mailing and home address. Or if you haven’t yet added an address, click on the link to add your address. Then fill out the form and click{' '} <strong>Update</strong> to save your changes. You can also add or edit other contact, personal, and military service information. </li> <li> Or contact the VA health facility where you get care to have them update your address on file. <br /> <a href="/find-locations/">Find your VA health facility</a> </li> </ul> </div> </div> </div> </div> <div itemScope itemType="http://schema.org/Question"> <h2 itemProp="name" id="how-long-will-my-prescriptions"> When will I get my prescriptions, and when should I reorder? </h2> <div itemProp="acceptedAnswer" itemScope itemType="http://schema.org/Answer" > <div itemProp="text"> <div className="processed-content"> <p> Prescriptions usually arrive within 3 to 5 days. You can find specific information about your order on the website of the delivery service shown in My HealtheVet or My VA Health. </p> <p> To make sure you have your medicine in time, please request your refill at least 10 days before you need more medicine. </p> </div> </div> </div> </div> <div itemScope itemType="http://schema.org/Question"> <h2 itemProp="name" id="will-my-personal-health-inform"> Will my personal health information be protected? </h2> <div itemProp="acceptedAnswer" itemScope itemType="http://schema.org/Answer" > <div itemProp="text"> <div className="processed-content"> <p> Yes. Our health management portals are secure websites. We follow strict security policies and practices to protect your personal health information. </p> <p> If you print or download anything from the website (like prescription details), you’ll need to take responsibility for protecting that information. <br /> <a href="https://www.myhealth.va.gov/mhv-portal-web/web/myhealthevet/protecting-your-personal-health-information" target="_blank" rel="noopener noreferrer" > Get tips for protecting your personal health information </a> </p> </div> </div> </div> </div> <div itemScope itemType="http://schema.org/Question"> <h2 itemProp="name" id="what-if-i-have-more-questions"> What if I have more questions? </h2> <div itemProp="acceptedAnswer" itemScope itemType="http://schema.org/Answer" > <div itemProp="text"> <div className="processed-content"> <h3>For My HealtheVet questions</h3> <p>You can:</p> <ul> <li> Read the{' '} <a rel="noreferrer noopener" href="https://www.myhealth.va.gov/mhv-portal-web/web/myhealthevet/faqs#PrescriptionRefill" > prescription refill FAQs </a>{' '} on the My HealtheVet web portal </li> <li> Call the My HealtheVet help desk at{' '} <a href="tel:18773270022" aria-label="8 7 7. 3 2 7. 0 0 2 2."> 877-327-0022 </a>{' '} (TTY: <Telephone contact={CONTACTS.HELP_TTY} /> ). We’re here Monday through Friday, 8:00 a.m. to 8:00 p.m. ET. </li> <li> Or{' '} <a rel="noreferrer noopener" href="https://www.myhealth.va.gov/mhv-portal-web/web/myhealthevet/contact-mhv" > contact us online </a> </li> </ul> <h3>For My VA Health questions</h3> <p> Call My VA Health support anytime at{' '} <a href="tel:18009621024" aria-label="8 0 0. 9 6 2. 1 0 2 4."> {' '} 800-962-1024 </a> . </p> </div> </div> </div> </div> </div> </> ); AuthContent.propTypes = { authenticatedWithSSOe: PropTypes.bool.isRequired, cernerfacilities: PropTypes.arrayOf( PropTypes.shape({ facilityId: PropTypes.string.isRequired, isCerner: PropTypes.bool.isRequired, usesCernerAppointments: PropTypes.string, usesCernerMedicalRecords: PropTypes.string, usesCernerMessaging: PropTypes.string, usesCernerRx: PropTypes.string, usesCernerTestResults: PropTypes.string, }).isRequired, ), otherfacilities: PropTypes.arrayOf( PropTypes.shape({ facilityId: PropTypes.string.isRequired, isCerner: PropTypes.bool.isRequired, usesCernerAppointments: PropTypes.string, usesCernerMedicalRecords: PropTypes.string, usesCernerMessaging: PropTypes.string, usesCernerRx: PropTypes.string, usesCernerTestResults: PropTypes.string, }).isRequired, ), }; export default AuthContent;
app/containers/NotFoundPage/index.js
nikb747/threejs-react-proto
/** * NotFoundPage * * This is the page we show when the user visits a url that doesn't have a route * * NOTE: while this component should technically be a stateless functional * component (SFC), hot reloading does not currently support SFCs. If hot * reloading is not a necessity for you then you can refactor it and remove * the linting exception. */ import React from 'react'; import { FormattedMessage } from 'react-intl'; import messages from './messages'; export default class NotFound extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function render() { return ( <h1> <FormattedMessage {...messages.header} /> </h1> ); } }
spec/javascripts/jsx/files/components/FilePreviewSpec.js
djbender/canvas-lms
/* * Copyright (C) 2016 - present Instructure, Inc. * * This file is part of Canvas. * * Canvas is free software: you can redistribute it and/or modify it under * the terms of the GNU Affero General Public License as published by the Free * Software Foundation, version 3 of the License. * * Canvas is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU Affero General Public License for more * details. * * You should have received a copy of the GNU Affero General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. */ import React from 'react' import ReactDOM from 'react-dom' import {mount} from 'enzyme' import FilePreview from 'jsx/files/FilePreview' import Folder from 'compiled/models/Folder' import File from 'compiled/models/File' import FilesCollection from 'compiled/collections/FilesCollection' let filesCollection = {} const folderCollection = {} let file1 = {} let file2 = {} let file3 = {} let currentFolder = {} QUnit.module('File Preview Rendering', { setup() { // Initialize a few things to view in the preview. filesCollection = new FilesCollection() file1 = new File( { id: '1', cid: 'c1', name: 'Test File.file1', 'content-type': 'unknown/unknown', size: 1000000, created_at: new Date().toISOString(), updated_at: new Date().toISOString() }, {preflightUrl: ''} ) file2 = new File( { id: '2', cid: 'c2', name: 'Test File.file2', 'content-type': 'unknown/unknown', size: 1000000, created_at: new Date().toISOString(), updated_at: new Date().toISOString() }, {preflightUrl: ''} ) file3 = new File( { id: '3', cid: 'c3', name: 'Test File.file3', 'content-type': 'unknown/unknown', size: 1000000, created_at: new Date().toISOString(), updated_at: new Date().toISOString(), url: 'test/test/test.png' }, {preflightUrl: ''} ) filesCollection.add(file1) filesCollection.add(file2) filesCollection.add(file3) currentFolder = new Folder() currentFolder.files = filesCollection }, teardown() { const filesCollection = {} const folderCollection = {} const file1 = {} const file2 = {} const file3 = {} const currentFolder = {} } }) test('clicking the info button should render out the info panel', () => { const component = mount( <FilePreview isOpen query={{ preview: '1' }} currentFolder={currentFolder} /> ) $('.ef-file-preview-header-info').click() equal( $('tr:contains("Name")') .find('td') .text(), 'Test File.file1' ) // click it again to hide it $('.ef-file-preview-header-info').click() equal($('tr:contains("Name")').length, 0) component.unmount() }) test('opening the preview for one file should show navigation buttons for the previous and next files in the current folder', () => { const component = mount( <FilePreview isOpen query={{ preview: '2' }} currentFolder={currentFolder} /> ) const arrows = $('.ef-file-preview-container-arrow-link') equal(arrows.length, 2, 'there are two arrows shown') ok( arrows[0].href.match('preview=1'), 'The left arrow link has an incorrect href (`preview` query string does not exist or points to the wrong id)' ) ok( arrows[1].href.match('preview=3'), 'The right arrow link has an incorrect href (`preview` query string does not exist or points to the wrong id)' ) component.unmount() }) test('download button should be rendered on the file preview', () => { const component = mount( <FilePreview isOpen query={{ preview: '3' }} currentFolder={currentFolder} /> ) const downloadBtn = $('.ef-file-preview-header-download')[0] ok(downloadBtn, 'download button renders') ok(downloadBtn.href.includes(file3.get('url')), 'the download button url is correct') component.unmount() }) test('clicking the close button calls closePreview with the correct url', () => { let closePreviewCalled = false const component = mount( <FilePreview isOpen query={{ preview: '3', search_term: 'web', sort: 'size', order: 'desc' }} collection={filesCollection} closePreview={url => { closePreviewCalled = true ok(url.includes('sort=size')) ok(url.includes('order=desc')) ok(url.includes('search_term=web')) }} /> ) const closeButton = $('.ef-file-preview-header-close')[0] ok(closeButton) closeButton.click() ok(closePreviewCalled) component.unmount() })
DemoApp/lib/profile-header/index.js
andyfen/react-native-UIKit
import React from 'react'; import { StyleSheet, Image, View, Dimensions, } from 'react-native'; const { width } = Dimensions.get('window'); const styles = StyleSheet.create({ container: { paddingBottom: 30, }, backgroundImg: { resizeMode: 'cover', height: 150, }, profileImg: { borderWidth: 2, borderColor: '#fff', borderRadius: 4, width: 100, height: 100, position: 'absolute', alignSelf: 'center', top: 75, left: (width / 2) - 50, }, shadow: { position: 'absolute', alignSelf: 'center', top: 75, left: (width / 2) - 50, borderRadius: 4, width: 100, height: 100, shadowColor: '#D8D8D8', shadowRadius: 2, shadowOffset: { width: 0, height: 1, }, shadowOpacity: 0.8, }, title: { flex: 1, textAlign: 'center', fontSize: 30, marginTop: 35, marginBottom: 10, fontWeight: '300', }, summary: { paddingHorizontal: 10, }, }); const ProfileHeader = ({ profileImg, backgroundImg, circle, blurRadius }) => ( <View style={styles.container}> <Image blurRadius={blurRadius} source={{ uri: backgroundImg }} style={styles.backgroundImg} /> <View style={[styles.shadow, { borderRadius: circle ? 50 : 0 }]} /> <Image source={{ uri: profileImg }} style={[styles.profileImg, { borderRadius: circle ? 50 : 0 }]} /> </View> ); ProfileHeader.defaultProps = { circle: false, blurRadius: 0, }; ProfileHeader.propTypes = { title: React.PropTypes.string, summary: React.PropTypes.string, profileImg: React.PropTypes.string, backgroundImg: React.PropTypes.string, circle: React.PropTypes.bool, blurRadius: React.PropTypes.number, }; export default ProfileHeader;
lib/views/LayoutSectionView.js
tuomashatakka/reduced-dark-ui
'use babel' import React from 'react' import Field from '../components/layout/Field' const LayoutSection = (props) => { return ( <section className='section'> <Field scope='layout.uiScale' style='primary' /> <Field scope='layout.spacing' style='primary' /> <Field scope='layout.fixedTabBar' style='minor' /> <Field scope='layout.fixedProjectRoot' style='minor' /> <Field scope='layout.collapsing' style='major' /> <Field scope='layout.tabPosition' style='minor' /> <Field scope='layout.tabClosePosition' style='minor' /> <Field scope='layout.SILLYMODE' style='minor' /> <Field scope='decor.animations.duration' style='minor' /> </section> ) } export default LayoutSection
src/Root.js
streamr-app/streamr-web
import React from 'react' import { Provider } from 'react-redux' import configureStore from './configureStore' import { ConnectedRouter } from 'react-router-redux' import { Route } from 'react-router-dom' import Application, { history } from './components/Application' const store = configureStore(history) ;(function () { const { change } = require('redux-form') window.changeForm = (...args) => store.dispatch(change(...args)) })() export default () => ( <Provider store={store}> <ConnectedRouter history={history}> <Route path='/' component={Application} /> </ConnectedRouter> </Provider> )
conference-management-system-front-end/src/components/paperManage.js
Kokosowys/conference-management-system
import React from 'react'; class PaperManage extends React.Component { render() { //var item = this.props.item; return ( <div className="userDiv"> <div> <p>this is your paper</p> </div> <br/><br/> </div> ) } }; export default PaperManage;
blueprints/dumb/files/__root__/components/__name__/__name__.js
blinkmobile/things-mgr
import React from 'react' type Props = { }; export class <%= pascalEntityName %> extends React.Component { props: Props; render () { return ( <div></div> ) } } export default <%= pascalEntityName %>
examples/reactstrap/programmatic-submission.js
mkatanski/strap-forms
import React from 'react' import { Label } from 'reactstrap' import Form from './components/Form' import Input from './components/Input' import Group from './components/Group' class MyForm extends React.Component { handleSubmit = () => { // eslint-disable-next-line console.log('Programmatic submission') } render() { return ( <div> <p>Form to submit</p> <Form onSubmit={this.handleSubmit} ref={(ref) => { this.form = ref }}> <Group> <Label htmlFor="name"> Your name <sup>&lowast;</sup> </Label> <Input name="name" required /> </Group> </Form> <div> <p>External button</p> <button onClick={() => this.form.submit()}>Programmatic submission</button> </div> </div> ) } } export default MyForm
blueocean-material-icons/src/js/components/svg-icons/action/speaker-notes.js
kzantow/blueocean-plugin
import React from 'react'; import SvgIcon from '../../SvgIcon'; const ActionSpeakerNotes = (props) => ( <SvgIcon {...props}> <path d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM8 14H6v-2h2v2zm0-3H6V9h2v2zm0-3H6V6h2v2zm7 6h-5v-2h5v2zm3-3h-8V9h8v2zm0-3h-8V6h8v2z"/> </SvgIcon> ); ActionSpeakerNotes.displayName = 'ActionSpeakerNotes'; ActionSpeakerNotes.muiName = 'SvgIcon'; export default ActionSpeakerNotes;
examples/basic-jsx/src/index.js
4Catalyzer/found
import Link from 'found/Link'; import Redirect from 'found/Redirect'; import Route from 'found/Route'; import createBrowserRouter from 'found/createBrowserRouter'; import makeRouteConfig from 'found/makeRouteConfig'; import PropTypes from 'prop-types'; import React from 'react'; import ReactDOM from 'react-dom'; function LinkItem(props) { return ( <li> <Link {...props} activeStyle={{ fontWeight: 'bold' }} /> </li> ); } const propTypes = { children: PropTypes.node, }; function App({ children }) { return ( <div> <ul> <LinkItem to="/">Main</LinkItem> <ul> <LinkItem to="/foo">Foo</LinkItem> <LinkItem to="/bar">Bar (async)</LinkItem> <LinkItem to="/baz">Baz (redirects to Foo)</LinkItem> <LinkItem to="/qux">Qux (missing)</LinkItem> </ul> </ul> {children} </div> ); } App.propTypes = propTypes; const BrowserRouter = createBrowserRouter({ routeConfig: makeRouteConfig( <Route path="/" Component={App}> <Route Component={() => <div>Main</div>} /> <Route path="foo" Component={() => <div>Foo</div>} /> <Route path="bar" getComponent={() => import('./Bar').then((m) => m.default)} getData={() => new Promise((resolve) => { setTimeout(resolve, 1000, 'Bar'); }) } render={({ Component, props }) => Component && props ? ( <Component {...props} /> ) : ( <div> <small>Loading&hellip;</small> </div> ) } /> <Redirect from="baz" to="/foo" /> </Route>, ), /* eslint-disable react/prop-types */ renderError: ({ error }) => ( <div>{error.status === 404 ? 'Not found' : 'Error'}</div> ), /* eslint-enable react/prop-types */ }); ReactDOM.render(<BrowserRouter />, document.getElementById('root'));
client/extensions/woocommerce/woocommerce-services/views/live-rates-carriers-list/carriers-list.js
Automattic/woocommerce-services
/** * External dependencies */ import React from 'react' import { localize } from 'i18n-calypso' import { Tooltip } from '@wordpress/components' /** * Internal dependencies */ import Card from 'components/card' import CarrierIcon from '../../components/carrier-icon' import Gridicon from 'gridicons' const Actions = localize( ( { translate } ) => { return ( <> { /* eslint-disable-next-line wpcalypso/jsx-classname-namespace */} <a className="button is-compact" href="admin.php?page=wc-settings&tab=shipping&section">{ translate( 'Add to shipping zones' ) }</a> <Tooltip position="top left" text={ translate( 'To be displayed at checkout, this carrier must be added as a shipping method to selected shipping zones' ) } > <div> <Gridicon icon="help-outline" size={ 18 }/> </div> </Tooltip> </> ) }) const CarrierDiscount = localize( ( { translate, name, } ) => translate( 'Discounted %(carrierName)s shipping labels', { args: { carrierName: name, }, })) const carrierItemMap = { 'wc_services_usps': ( { translate } ) => ( <div className="live-rates-carriers-list__element element-usps"> <div className="live-rates-carriers-list__icon"> <CarrierIcon carrier="usps" size={ 18 } /> </div> <div className="live-rates-carriers-list__carrier">{ translate( 'USPS' ) }</div> <div className="live-rates-carriers-list__features"> <ul> <li>{ translate( 'Ship with the largest delivery network in the United States' ) }</li> <li> <CarrierDiscount name={ translate( 'USPS' ) } /> </li> <li> { translate( 'Live rates for %(carrierName)s at checkout', { args: { carrierName: translate( 'USPS' ), }, })} </li> </ul> </div> <div className="live-rates-carriers-list__actions"><Actions /></div> </div> ), 'wc_services_dhlexpress': ({ translate }) => ( <div className="live-rates-carriers-list__element element-dhlexpress"> <div className="live-rates-carriers-list__icon"> <CarrierIcon carrier="dhlexpress" size={ 18 } /> </div> <div className="live-rates-carriers-list__carrier">{ translate( 'DHL Express' ) }</div> <div className="live-rates-carriers-list__features"> <ul> <li>{ translate( 'Express delivery from the experts in international shipping' ) }</li> <li><CarrierDiscount name={ translate( 'DHL Express' ) } /></li> <li> { translate( 'Live rates for %(carrierName)s at checkout', { args: { carrierName: translate( 'DHL Express' ), }, })} </li> </ul> </div> <div className="live-rates-carriers-list__actions"><Actions /></div> </div> ), } const CarriersList = ({ translate, carrierIds }) => { return ( <Card className="live-rates-carriers-list__wrapper"> <div className="live-rates-carriers-list__heading"> <div className="live-rates-carriers-list__icon"/> <div className="live-rates-carriers-list__carrier">{ translate( 'Carrier' ) }</div> <div className="live-rates-carriers-list__features">{ translate( 'Features' ) }</div> <div className="live-rates-carriers-list__actions"/> </div> {carrierIds.map( ( carrierId ) => { const CarrierView = carrierItemMap[ carrierId ] if ( ! CarrierView ) { return null } return ( <CarrierView key={ carrierId } translate={ translate } /> ) })} </Card> ) } export default localize( CarriersList )
src/app/components/pages/BlankPage.js
ucokfm/admin-lte-react
import React from 'react'; import PageWrapper from '../../../lib/page/PageWrapper'; import PageHeader from '../../../lib/page/PageHeader'; import Breadcrumb from '../../../lib/page/Breadcrumb'; import PageContent from '../../../lib/page/PageContent'; export default function BlankPage() { return ( <PageWrapper> <PageHeader title="Blank page" description="it all starts here" > <Breadcrumb items={[ { key: 1, icon: 'fa fa-dashboard', title: 'Home', url: '/' }, { key: 2, title: 'Examples' }, { key: 3, title: 'Blank page' }, ]} /> </PageHeader> <PageContent> <div className="box"> <div className="box-header with-border"> <h3 className="box-title">Title</h3> <div className="box-tools pull-right"> <button type="button" className="btn btn-box-tool"> <i className="fa fa-minus"></i> </button> <button type="button" className="btn btn-box-tool"> <i className="fa fa-times"></i> </button> </div> </div> <div className="box-body"> Start creating your amazing application! </div> <div className="box-footer"> Footer </div> </div> </PageContent> </PageWrapper> ); }
src/components/video_detail.js
polettoweb/ReactReduxStarter
import React from 'react'; const VideoDetail = ({video}) => { if (!video) { return <div>Loading...</div>; } const videoId = video.id.videoId; const url = `https://www.youtube.com/embed/${videoId}`; return ( <div className="video-detail col-md-8"> <div className="embed-responsive embed-responsive-16by9"> <iframe className="embed-responsive-item" src={url}></iframe> </div> <div className="details"> <div>{video.snippet.title}</div> <div>{video.snippet.description}</div> </div> </div> ); }; export default VideoDetail;
src/index.js
zestxjest/learn-redux-async-action
import 'babel-polyfill'; import React from 'react'; import {render} from 'react-dom'; import Root from './containers/Root' render( <Root />, document.getElementById('root') )
actor-apps/app-web/src/app/components/sidebar/ContactsSection.react.js
damoguyan8844/actor-platform
import _ from 'lodash'; import React from 'react'; import { Styles, RaisedButton } from 'material-ui'; import ActorTheme from 'constants/ActorTheme'; import ContactStore from 'stores/ContactStore'; import ContactActionCreators from 'actions/ContactActionCreators'; import AddContactStore from 'stores/AddContactStore'; import AddContactActionCreators from 'actions/AddContactActionCreators'; import ContactsSectionItem from './ContactsSectionItem.react'; import AddContactModal from 'components/modals/AddContact.react.js'; const ThemeManager = new Styles.ThemeManager(); const getStateFromStores = () => { return { isAddContactModalOpen: AddContactStore.isModalOpen(), contacts: ContactStore.getContacts() }; }; class ContactsSection extends React.Component { static childContextTypes = { muiTheme: React.PropTypes.object }; getChildContext() { return { muiTheme: ThemeManager.getCurrentTheme() }; } componentWillUnmount() { ContactActionCreators.hideContactList(); ContactStore.removeChangeListener(this.onChange); AddContactStore.removeChangeListener(this.onChange); } constructor(props) { super(props); this.state = getStateFromStores(); ContactActionCreators.showContactList(); ContactStore.addChangeListener(this.onChange); AddContactStore.addChangeListener(this.onChange); ThemeManager.setTheme(ActorTheme); } onChange = () => { this.setState(getStateFromStores()); }; openAddContactModal = () => { AddContactActionCreators.openModal(); }; render() { let contacts = this.state.contacts; let contactList = _.map(contacts, (contact, i) => { return ( <ContactsSectionItem contact={contact} key={i}/> ); }); let addContactModal; if (this.state.isAddContactModalOpen) { addContactModal = <AddContactModal/>; } return ( <section className="sidebar__contacts"> <ul className="sidebar__list sidebar__list--contacts"> {contactList} </ul> <footer> <RaisedButton label="Add contact" onClick={this.openAddContactModal} style={{width: '100%'}}/> {addContactModal} </footer> </section> ); } } export default ContactsSection;
node_modules/react-bootstrap/es/MediaListItem.js
lucketta/got-quote-generator
import _extends from 'babel-runtime/helpers/extends'; import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties'; import _classCallCheck from 'babel-runtime/helpers/classCallCheck'; import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn'; import _inherits from 'babel-runtime/helpers/inherits'; import classNames from 'classnames'; import React from 'react'; import { bsClass, getClassSet, splitBsProps } from './utils/bootstrapUtils'; var MediaListItem = function (_React$Component) { _inherits(MediaListItem, _React$Component); function MediaListItem() { _classCallCheck(this, MediaListItem); return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); } MediaListItem.prototype.render = function render() { var _props = this.props, className = _props.className, props = _objectWithoutProperties(_props, ['className']); var _splitBsProps = splitBsProps(props), bsProps = _splitBsProps[0], elementProps = _splitBsProps[1]; var classes = getClassSet(bsProps); return React.createElement('li', _extends({}, elementProps, { className: classNames(className, classes) })); }; return MediaListItem; }(React.Component); export default bsClass('media', MediaListItem);
docs/app/Examples/modules/Progress/Variations/index.js
Rohanhacker/Semantic-UI-React
import React from 'react' import ComponentExample from 'docs/app/Components/ComponentDoc/ComponentExample' import ExampleSection from 'docs/app/Components/ComponentDoc/ExampleSection' const ProgressVariationsExamples = () => ( <ExampleSection title='Variations'> <ComponentExample title='Inverted' description='A progress bar can have its colors inverted.' examplePath='modules/Progress/Variations/ProgressExampleInverted' /> <ComponentExample title='Attached' description='A progress bar can show progress of an element.' examplePath='modules/Progress/Variations/ProgressExampleAttached' /> <ComponentExample title='Size' description='A progress bar can vary in size.' examplePath='modules/Progress/Variations/ProgressExampleSize' /> <ComponentExample title='Color' description='A progress bar can have different colors.' examplePath='modules/Progress/Variations/ProgressExampleColor' /> <ComponentExample title='Inverted Color' description='These colors can also be inverted for improved contrast on dark backgrounds.' examplePath='modules/Progress/Variations/ProgressExampleInvertedColor' /> </ExampleSection> ) export default ProgressVariationsExamples
app/javascript/mastodon/components/column_back_button.js
mecab/mastodon
import React from 'react'; import { FormattedMessage } from 'react-intl'; import PropTypes from 'prop-types'; class ColumnBackButton extends React.PureComponent { static contextTypes = { router: PropTypes.object, }; handleClick = () => { if (window.history && window.history.length === 1) this.context.router.push("/"); else this.context.router.goBack(); } render () { return ( <div role='button' tabIndex='0' onClick={this.handleClick} className='column-back-button'> <i className='fa fa-fw fa-chevron-left column-back-button__icon'/> <FormattedMessage id='column_back_button.label' defaultMessage='Back' /> </div> ); } } export default ColumnBackButton;
src/app/components/media/OcrButton.js
meedan/check-web
import React from 'react'; import PropTypes from 'prop-types'; import Relay from 'react-relay/classic'; import { graphql, commitMutation } from 'react-relay/compat'; import { FormattedMessage } from 'react-intl'; import MenuItem from '@material-ui/core/MenuItem'; import ListItemIcon from '@material-ui/core/ListItemIcon'; import DescriptionOutlinedIcon from '@material-ui/icons/DescriptionOutlined'; import { withSetFlashMessage } from '../FlashMessage'; const OcrButton = ({ projectMediaId, projectMediaType, hasExtractedText, setFlashMessage, onClick, }) => { const [pending, setPending] = React.useState(false); const handleError = () => { setPending(false); setFlashMessage(( <FormattedMessage id="ocrButton.defaultErrorMessage" defaultMessage="Could not extract text from image" description="Warning displayed if an error occurred when extracting text from image" /> ), 'error'); }; const handleSuccess = () => { setPending(false); setFlashMessage(( <FormattedMessage id="ocrButton.textExtractedSuccessfully" defaultMessage="Text extraction completed" description="Banner displayed when text extraction operation for an image is done" /> ), 'success'); }; const handleClick = () => { setPending(true); commitMutation(Relay.Store, { mutation: graphql` mutation OcrButtonExtractTextMutation($input: ExtractTextInput!) { extractText(input: $input) { project_media { id extracted_text: annotation(annotation_type: "extracted_text") { data } } } } `, variables: { input: { id: projectMediaId, }, }, onCompleted: (response, error) => { if (error) { handleError(); } else { handleSuccess(); } }, onError: () => { handleError(); }, }); onClick(); }; if (projectMediaType !== 'UploadedImage' || hasExtractedText) { return null; } return ( <MenuItem id="ocr-button__extract-text" onClick={handleClick} disabled={pending} > <ListItemIcon> <DescriptionOutlinedIcon /> </ListItemIcon> { pending ? <FormattedMessage id="ocrButton.inProgress" defaultMessage="Text extraction in progress…" description="Message displayed while text is being extracted from an image" /> : <FormattedMessage id="ocrButton.label" defaultMessage="Image text extraction" description="Button label - when this button is clicked, text is extracted from image" /> } </MenuItem> ); }; OcrButton.defaultProps = { hasExtractedText: false, }; OcrButton.propTypes = { projectMediaId: PropTypes.string.isRequired, projectMediaType: PropTypes.string.isRequired, hasExtractedText: PropTypes.bool, onClick: PropTypes.func.isRequired, setFlashMessage: PropTypes.func.isRequired, }; export default withSetFlashMessage(OcrButton);