Skip to content
Open
14 changes: 14 additions & 0 deletions src/components/ajaxloader/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
**/

import React from 'react';
import PropTypes from 'prop-types';

const AjaxLoader = ({
show,
Expand Down Expand Up @@ -75,4 +76,17 @@ const AjaxLoader = ({
);
};

AjaxLoader.propTypes = {
/** Toggles display; the overlay stays mounted either way. */
show: PropTypes.bool,
/** Positions absolute inside the nearest positioned ancestor instead of fixed to the viewport. */
relative: PropTypes.bool,
/** Background colour of the dimming layer behind the spinner. */
color: PropTypes.string,
/** Spinner font-size in px. */
size: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
/** Optional caption rendered under the spinner. */
children: PropTypes.node
};

export default AjaxLoader;
15 changes: 15 additions & 0 deletions src/components/bulk-actions-selector/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
**/

import React from 'react';
import PropTypes from 'prop-types';
import T from "i18n-react/dist/i18n-react";
import './styles.less';
class ScheduleAdminsBulkActionsSelector extends React.Component {
Expand Down Expand Up @@ -51,4 +52,18 @@ class ScheduleAdminsBulkActionsSelector extends React.Component {
}
}

ScheduleAdminsBulkActionsSelector.propTypes = {
/** Renders nothing when false; the container element is always present. */
show: PropTypes.bool,
/** Actions offered alongside the built-in default option. */
bulkOptions: PropTypes.arrayOf(PropTypes.shape({
value: PropTypes.string.isRequired,
label: PropTypes.string.isRequired
})).isRequired,
/** Click handler for the select-all checkbox; the component tracks no selection itself. */
onSelectAll: PropTypes.func,
/** Receives the chosen action value on Go. Not called while the default option is selected. */
onSelectedBulkAction: PropTypes.func.isRequired
};

export default ScheduleAdminsBulkActionsSelector;
11 changes: 11 additions & 0 deletions src/components/clock.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* limitations under the License.
**/
import React from 'react';
import PropTypes from 'prop-types';
import moment from "moment-timezone";
import FragmentParser from "./fragment-parser";
import {getTimeServiceUrl} from '../utils/methods';
Expand Down Expand Up @@ -155,4 +156,14 @@ class Clock extends React.Component {

}

Clock.propTypes = {
/** Renders nothing until true and a timestamp has been resolved. */
display: PropTypes.bool,
/** IANA zone used to format the clock. */
timezone: PropTypes.string,
/** Called on each tick with the current epoch seconds. */
onTick: PropTypes.func,
/** Overrides the resolved time; otherwise the summit time service is queried. */
now: PropTypes.number
};
Comment thread
caseylocker marked this conversation as resolved.
export default Clock;
7 changes: 7 additions & 0 deletions src/components/exclusive-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
**/

import React from 'react'
import PropTypes from 'prop-types'


export default class Exclusive extends React.Component {
Expand Down Expand Up @@ -40,3 +41,9 @@ export default class Exclusive extends React.Component {

}
}

Exclusive.propTypes = {
/** Children render only if window.EXCLUSIVE_SECTIONS includes this name. */
name: PropTypes.string.isRequired,
children: PropTypes.node
};
27 changes: 27 additions & 0 deletions src/components/forms/rsvp-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
**/

import React from 'react'
import PropTypes from 'prop-types';
import 'awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css'
import Input from '../inputs/text-input'
import Dropdown from '../inputs/dropdown'
Expand Down Expand Up @@ -164,4 +165,30 @@ class RsvpForm extends React.Component {
}
}

RsvpForm.propTypes = {
/** Rendered by class_name, e.g. RSVPTextBoxQuestionTemplate or RSVPCheckBoxListQuestionTemplate. */
questions: PropTypes.arrayOf(PropTypes.shape({
/** Must be a number: handleChange compares answer.question_id to parseInt(id) with strict equality, which never matches a string id. */
id: PropTypes.number.isRequired,
/** Selects the widget; unknown values render nothing. */
class_name: PropTypes.string.isRequired,
name: PropTypes.string,
/** Injected as raw HTML. */
label: PropTypes.string,
is_mandatory: PropTypes.bool,
values: PropTypes.array,
Comment thread
coderabbitai[bot] marked this conversation as resolved.
/** RSVPLiteralContentQuestionTemplate: raw HTML content rendered via RawHTML. */
value: PropTypes.string,
/** RSVPDropDownQuestionTemplate: when true, values are remapped to {value: id, label: value}. */
is_country_selector: PropTypes.bool,
/** RSVPDropDownQuestionTemplate: passed through to the Dropdown as isMulti. */
is_multiselect: PropTypes.bool,
/** RSVPDropDownQuestionTemplate: used as the Dropdown's placeholder. */
empty_string: PropTypes.string
})).isRequired,
/** Receives the collected answers array on submit. Omit to render a display-only form with no submit button. */
onSubmit: PropTypes.func,
/** Keyed by question id. Read into state at mount with no fallback; hasErrors() throws if omitted. Effectively required. */
errors: PropTypes.object
};
export default RsvpForm;
17 changes: 17 additions & 0 deletions src/components/forms/simple-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
**/

import React from 'react'
import PropTypes from 'prop-types';
import T from 'i18n-react/dist/i18n-react'
import 'awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css'
import Input from '../inputs/text-input'
Expand Down Expand Up @@ -147,4 +148,20 @@ class SimpleForm extends React.Component {
}
}

SimpleForm.propTypes = {
/** Field descriptors rendered in order. */
fields: PropTypes.arrayOf(PropTypes.shape({
/** Matches a key on entity. */
name: PropTypes.string.isRequired,
/** Anything else renders nothing. */
type: PropTypes.oneOf(['text', 'textarea', 'checkbox']).isRequired,
label: PropTypes.node
})).isRequired,
/** Seeds the form. Copied into local state and re-synced when it changes. */
entity: PropTypes.object.isRequired,
/** Keyed by field name. */
errors: PropTypes.object,
/** Receives the edited entity. */
onSubmit: PropTypes.func.isRequired
};
export default SimpleForm;
21 changes: 21 additions & 0 deletions src/components/inputs/access-levels-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
**/

import React from 'react';
import PropTypes from 'prop-types';
import AsyncSelect from 'react-select/lib/Async';
import {queryAccessLevels} from '../../utils/query-actions';

Expand Down Expand Up @@ -92,3 +93,23 @@ export default class AccessLevelsInput extends React.Component {
}
}

AccessLevelsInput.propTypes = {
/** Selected access level(s). */
value: PropTypes.oneOfType([PropTypes.object, PropTypes.array, PropTypes.string, PropTypes.number]),
/** Echoed back as ev.target.id on the synthetic change event. */
id: PropTypes.string.isRequired,
/** Receives a synthetic { target: { id, value, type } }. */
onChange: PropTypes.func.isRequired,
/** Gated on the prop being present, so multi={false} still enables multi-select. */
multi: PropTypes.bool,
/** Non-empty renders an .error-label. */
error: PropTypes.string,
/** Scopes the lookup. Required for results to return. */
summitId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
/** Shown before the user types. */
defaultOptions: PropTypes.oneOfType([PropTypes.bool, PropTypes.array]),
/** (item) => value. Defaults to item.id. */
getOptionValue: PropTypes.func,
/** (item) => label. */
getOptionLabel: PropTypes.func
};
17 changes: 17 additions & 0 deletions src/components/inputs/action-dropdown/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
**/

import React from 'react';
import PropTypes from 'prop-types';
import './action-dropdown.less';
import Select from 'react-select';

Expand Down Expand Up @@ -66,3 +67,19 @@ export default class ActionDropdown extends React.Component {

}
}

ActionDropdown.propTypes = {
options: PropTypes.arrayOf(PropTypes.shape({
value: PropTypes.any.isRequired,
label: PropTypes.string.isRequired
})).isRequired,
/** Label on the trigger button next to the select. */
actionLabel: PropTypes.node,
placeholder: PropTypes.string,
/** Fires only on button click, with the selected option's value. Throws if nothing is selected. */
onClick: PropTypes.func.isRequired,
/** Seeds the initial selection only; later changes are held in local state. */
value: PropTypes.any,
/** Gated on the prop being present, so small={false} still applies the small styling. */
small: PropTypes.bool
};
21 changes: 21 additions & 0 deletions src/components/inputs/attendee-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
**/

import React, {useState} from 'react';
import PropTypes from 'prop-types';
import AsyncSelect from 'react-select/lib/Async';
import {queryAttendees} from '../../utils/query-actions';

Expand Down Expand Up @@ -71,5 +72,25 @@ const AttendeeInput = ({id, value, summitId, error, multi, onChange, getOptionVa
);
}

AttendeeInput.propTypes = {
/** Selected attendee(s). */
value: PropTypes.oneOfType([PropTypes.object, PropTypes.array, PropTypes.string, PropTypes.number]),
/** Echoed back as ev.target.id on the synthetic change event. */
id: PropTypes.string.isRequired,
/** Receives a synthetic { target: { id, value, type } }. */
onChange: PropTypes.func.isRequired,
/** No effect on this component: it is destructured out of props so it never reaches ...rest, and isMulti is never computed or passed to AsyncSelect. Consumers still pass it; it does nothing here. */
multi: PropTypes.bool,
/** Non-empty renders an .error-label. */
error: PropTypes.string,
/** Scopes the lookup. Required for results to return. */
summitId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
/** Overrides the default queryAttendees lookup. */
queryFunction: PropTypes.func,
/** (attendee) => value. Defaults to attendee.id. */
getOptionValue: PropTypes.func,
/** (attendee) => label. */
getOptionLabel: PropTypes.func
};
export default AttendeeInput;

35 changes: 35 additions & 0 deletions src/components/inputs/company-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
**/

import React from 'react';
import PropTypes from 'prop-types';
import AsyncSelect from 'react-select/lib/Async';
import {queryCompanies} from '../../utils/query-actions';
import AsyncCreatableSelect from "react-select/lib/AsyncCreatable";
Expand Down Expand Up @@ -115,3 +116,37 @@ export default class CompanyInput extends React.Component {

}
}

CompanyInput.propTypes = {
/** Selected company or companies, read as value.id / value.name (or value.map(...) in multi mode). */
value: PropTypes.oneOfType([
PropTypes.shape({
/** Dereferenced as id.toString() with no guard; effectively required whenever value is present. */
id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
name: PropTypes.string
}),
PropTypes.arrayOf(PropTypes.shape({
/** Dereferenced as id.toString() with no guard; effectively required whenever value is present. */
id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
name: PropTypes.string
}))
]),
/** Echoed back as ev.target.id on the synthetic change event. */
id: PropTypes.string.isRequired,
/** Receives a synthetic { target: { id, value, type } }. */
onChange: PropTypes.func.isRequired,
/** Gated on the prop being present, so multi={false} still enables multi-select. */
multi: PropTypes.bool,
/** Non-empty renders an .error-label. */
error: PropTypes.string,
/** Alias for multi; either being present enables multi-select. */
isMulti: PropTypes.bool,
/** Presence turns this into a creatable select. */
allowCreate: PropTypes.bool,
/** Called with the typed text when a new company is created. Required whenever allowCreate is present: AsyncCreatableSelect's create action calls it unconditionally. */
onCreate: PropTypes.func,
Comment thread
caseylocker marked this conversation as resolved.
/** Overrides the default queryCompanies lookup. */
queryFunction: PropTypes.func,
/** Appended to the fetched option list. */
extraOptions: PropTypes.array
};
16 changes: 16 additions & 0 deletions src/components/inputs/country-dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
**/

import React from 'react';
import PropTypes from 'prop-types';
import Dropdown from './dropdown';
import {getCountryList} from '../../utils/query-actions';

Expand Down Expand Up @@ -67,3 +68,18 @@ export default class CountryDropdown extends React.Component {

}
}

CountryDropdown.propTypes = {
/** Selected ISO country code. */
value: PropTypes.oneOfType([PropTypes.object, PropTypes.array, PropTypes.string, PropTypes.number]),
/** Echoed back as ev.target.id on the synthetic change event. */
id: PropTypes.string.isRequired,
/** Receives a synthetic { target: { id, value, type } }. */
onChange: PropTypes.func.isRequired,
/** No effect: forwarded via {...this.props} to Dropdown, which reads isMulti, not multi. */
multi: PropTypes.bool,
/** Non-empty renders an .error-label. */
error: PropTypes.string,
/** Forwarded via {...this.props} to Dropdown, then to react-select's Select as its placeholder text. */
placeholder: PropTypes.string
Comment thread
caseylocker marked this conversation as resolved.
};
14 changes: 14 additions & 0 deletions src/components/inputs/country-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
**/

import React from 'react';
import PropTypes from 'prop-types';
import Select from 'react-select';
import {getCountryList} from '../../utils/query-actions';

Expand Down Expand Up @@ -90,3 +91,16 @@ export default class CountryInput extends React.Component {
);
}
}

CountryInput.propTypes = {
/** Selected ISO country code(s). */
value: PropTypes.oneOfType([PropTypes.object, PropTypes.array, PropTypes.string, PropTypes.number]),
/** Echoed back as ev.target.id on the synthetic change event. */
id: PropTypes.string.isRequired,
/** Receives a synthetic { target: { id, value, type } }. */
onChange: PropTypes.func.isRequired,
/** Gated on the prop being present, so multi={false} still enables multi-select. */
multi: PropTypes.bool,
/** Non-empty renders an .error-label. */
error: PropTypes.string,
};
23 changes: 23 additions & 0 deletions src/components/inputs/datetimepicker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
**/

import React from 'react';
import PropTypes from 'prop-types';
import './datetimepicker.less';
import Datetime from 'react-datetime';
import moment from 'moment-timezone';
Expand Down Expand Up @@ -113,3 +114,25 @@ export default class DateTimePicker extends React.Component {
);
}
}

DateTimePicker.propTypes = {
id: PropTypes.string.isRequired,
/** A moment instance in the given timezone. */
value: PropTypes.object,
/** Receives a synthetic { target: { id, value, type } } carrying a moment. */
onChange: PropTypes.func.isRequired,
/** IANA zone; the displayed value is converted into it. */
timezone: PropTypes.string,
/** { date, time } moment format strings. Pass time: false for a date-only picker. Dereferenced as format.date/format.time with no default; effectively required. */
format: PropTypes.shape({
date: PropTypes.string,
time: PropTypes.oneOfType([PropTypes.string, PropTypes.bool])
}),
/** Constrains selectable dates, e.g. { after, before }. */
validation: PropTypes.object,
/** Forwarded to the underlying input. */
inputProps: PropTypes.object,
disabled: PropTypes.bool,
/** Non-empty renders an .error-label. */
error: PropTypes.string
};
Loading
Loading