ValidComponentChildren.map(children, function (child) { switch (child.props.bsRole) { case TOGGLE_ROLE: return _this4.renderToggle(child, { id: id, disabled: disabled, open: open, role: role, bsClass: bsClass }); case MENU_ROLE: return _this4.renderMenu(child, { id: id, open: open, pullRight: pullRight, bsClass: bsClass, onSelect: onSelect, rootCloseEvent: rootCloseEvent }); default: return child; } }) ); }; return Dropdown; }(React.Component); Dropdown.propTypes = propTypes; Dropdown.defaultProps = defaultProps; setBsClass('dropdown', Dropdown); var UncontrolledDropdown = uncontrollable(Dropdown, { open: 'onToggle' }); UncontrolledDropdown.Toggle = DropdownToggle; UncontrolledDropdown.Menu = DropdownMenu; export default UncontrolledDropdown;
}); })} </div> {controls && this.renderControls({ wrap, children, activeIndex, prevIcon, prevLabel, nextIcon, nextLabel, })} </div> ); } } Carousel.defaultProps = defaultProps; Carousel.propTypes = propTypes; const DecoratedCarousel = createBootstrapComponent( uncontrollable(Carousel, { activeIndex: 'onSelect' }), 'carousel', ); DecoratedCarousel.Caption = CarouselCaption; DecoratedCarousel.Item = CarouselItem; export default DecoratedCarousel;
{ fluid: fluid }, children ) ); }; return Navbar; }(React.Component); Navbar.propTypes = propTypes; Navbar.defaultProps = defaultProps; Navbar.childContextTypes = childContextTypes; setBsClass('navbar', Navbar); var UncontrollableNavbar = uncontrollable(Navbar, { expanded: 'onToggle' }); function createSimpleWrapper(tag, suffix, displayName) { var Wrapper = function Wrapper(_ref, _ref2) { var _ref2$$bs_navbar = _ref2.$bs_navbar, navbarProps = _ref2$$bs_navbar === undefined ? { bsClass: 'navbar' } : _ref2$$bs_navbar; var Component = _ref.componentClass, className = _ref.className, pullRight = _ref.pullRight, pullLeft = _ref.pullLeft, props = _objectWithoutProperties(_ref, ['componentClass', 'className', 'pullRight', 'pullLeft']); return React.createElement(Component, _extends({}, props, { className: classNames(className, prefix(navbarProps, suffix), pullRight && prefix(navbarProps, 'right'), pullLeft && prefix(navbarProps, 'left')) }));
open: function open(view) { if (this.props.open !== view && this.props[view] === true) this.notify('onToggle', view); }, close: function close() { if (this.props.open) this.notify('onToggle', false); }, inRangeValue: function inRangeValue(value) { if (value == null) return value; return dates.max(dates.min(value, this.props.max), this.props.min); } }); module.exports = createUncontrolledWidget(DateTimePicker, { open: 'onToggle', value: 'onChange' }); module.exports.BaseDateTimePicker = DateTimePicker; function getFormat(props) { var cal = props[popups.CALENDAR] != null ? props.calendar : true, time = props[popups.TIME] != null ? props.time : true; return props.format ? props.format : cal && time || !cal && !time ? localizers.date.formats['default'] : localizers.date.formats[cal ? 'date' : 'time']; } function formatDate(date, format, culture) { var val = ''; if (date instanceof Date && !isNaN(date.getTime())) val = localizers.date.format(date, format, culture);
onSelect: PropTypes.func, getId: PropTypes.func }) }, getDefaultProps() { return { componentClass: 'div' }; }, getChildContext() { return { $bs_tabcontainer: { activeKey: this.props.activeKey, onSelect: this.props.onSelect, getId: this.props.generateChildId || ((key, type) => this.props.id ? `${this.props.id}-${type}-${key}` : null) }, }; }, render() { let { children, ...props } = this.props; return React.cloneElement(React.Children.only(children), props); } }); export default uncontrollable(TabContainer, { activeKey: 'onSelect' });
var _splitBsPropsAndOmit = splitBsPropsAndOmit(props, ['onSelect', 'activeKey']), bsProps = _splitBsPropsAndOmit[0], elementProps = _splitBsPropsAndOmit[1]; if (accordion) { elementProps.role = elementProps.role || 'tablist'; } var classes = getClassSet(bsProps); return React.createElement( 'div', _extends({}, elementProps, { className: classNames(className, classes) }), ValidComponentChildren.map(children, function (child) { return cloneElement(child, { bsStyle: child.props.bsStyle || bsProps.bsStyle }); }) ); }; return PanelGroup; }(React.Component); PanelGroup.propTypes = propTypes; PanelGroup.defaultProps = defaultProps; PanelGroup.childContextTypes = childContextTypes; export default uncontrollable(bsClass('panel-group', PanelGroup), { activeKey: 'onSelect' });
_this5._searchTerm = ''; if (item) cb(item); }, this.props.delay); }, open: function open() { this.notify('onToggle', true); }, close: function close() { this.notify('onToggle', false); }, toggle: function toggle() { this.props.open ? this.close() : this.open(); } }); function msgs(msgs) { return babelHelpers._extends({ open: 'open dropdown', filterPlaceholder: '', emptyList: 'There are no items in this list', emptyFilter: 'The filter returned no results' }, msgs); } module.exports = createUncontrolledWidget(DropdownList, { open: 'onToggle', value: 'onChange', searchTerm: 'onSearch' }); module.exports.BaseDropdownList = DropdownList;
_onOwnerChange (event) { this.props.onOwnerChange(event.target.value); } _onRepositoryChange (event) { this.props.onRepositoryChange(event.target.value); } _onAccessTokenChange (event) { this.props.onAccessTokenChange(event.target.value); } } RepositoryForm.propTypes = propTypes; RepositoryForm.defaultProps = defaultProps; const UncontrollableRepositoryForm = uncontrollable(RepositoryForm, { owner: 'onOwnerChange', repository: 'onRepositoryChange', accessToken: 'onAccessTokenChange', }); UncontrollableRepositoryForm.defaultProps = { defaultOwner: '', defaultRepository: '', defaultAccessToken: '', }; export default UncontrollableRepositoryForm;
var _this$props = this.props, children = _this$props.children, props = _objectWithoutPropertiesLoose(_this$props, ["children"]); delete props.onToggle; if (this.menu && this.state.lastShow && !this.props.show) { this._focusInDropdown = this.menu.contains(document.activeElement); } return React.createElement(DropdownContext.Provider, { value: this.state.context }, React.createElement(Popper.Manager, null, children({ props: { onKeyDown: this.handleKeyDown } }))); }; return Dropdown; }(React.Component); Dropdown.displayName = 'ReactOverlaysDropdown'; Dropdown.propTypes = propTypes; Dropdown.defaultProps = defaultProps; var UncontrolledDropdown = uncontrollable(Dropdown, { show: 'onToggle' }); UncontrolledDropdown.Menu = DropdownMenu; UncontrolledDropdown.Toggle = DropdownToggle; export default UncontrolledDropdown;
var word = ((this._searchTerm || "") + character).toLowerCase(); this._searchTerm = word; this.setTimeout("search", function () { var list = _this.refs.list, key = _this.props.open ? "focusedItem" : "selectedItem", item = list.next(_this.state[key], word); _this._searchTerm = ""; if (item) cb(item); }, this.props.delay); }, open: function () { this.notify("onToggle", true); }, close: function () { this.notify("onToggle", false); }, toggle: function () { this.props.open ? this.close() : this.open(); } }); module.exports = createUncontrolledWidget(DropdownList, { open: "onToggle", value: "onChange", searchTerm: "onSearch" }); module.exports.BaseDropdownList = DropdownList;
import KenburnsEditorRaw from "./KenburnsEditor"; import KenburnsViewer from "./KenburnsViewer"; import uncontrollable from "uncontrollable"; const KenburnsEditor = uncontrollable(KenburnsEditorRaw, { value: "onChange" }); export {KenburnsEditor, KenburnsViewer};
open: function (view) { if (this.props.open !== view && this.props[view] === true) this.notify("onToggle", view); }, close: function () { if (this.props.open) this.notify("onToggle", false); }, inRangeValue: function (value) { if (value == null) return value; return dates.max(dates.min(value, this.props.max), this.props.min); } }); module.exports = createUncontrolledWidget(DateTimePicker, { open: "onToggle", value: "onChange" }); module.exports.BaseDateTimePicker = DateTimePicker; function getFormat(props) { var cal = props[popups.CALENDAR] != null ? props.calendar : true, time = props[popups.TIME] != null ? props.time : true; return props.format ? props.format : cal && time || !cal && !time ? "f" : cal ? "d" : "t"; } function formatDate(date, format, culture) { var val = ""; if (date instanceof Date && !isNaN(date.getTime())) val = dates.format(date, format, culture);
} }), increment: function increment() { this.change(this.constrainValue((this.props.value || 0) + this.props.step)); }, decrement: function decrement() { this.change(this.constrainValue((this.props.value || 0) - this.props.step)); }, change: function change(val) { val = this.constrainValue(val); if (this.props.value !== val) this.notify('onChange', val); }, constrainValue: function constrainValue(value) { var max = this.props.max == null ? Infinity : this.props.max, min = this.props.min == null ? -Infinity : this.props.min; if (value == null || value === '') return null; return Math.max(Math.min(value, max), min); } }); module.exports = createUncontrolledWidget(NumberPicker, { value: 'onChange' }); module.exports.BaseNumberPicker = NumberPicker;
name = parent.props.name || parent._id("_name"); return React.createElement( "label", { className: cx({ "rw-state-disabled": disabled, "rw-state-readonly": readonly }) }, React.createElement("input", babelHelpers._extends({}, this.props, { tabIndex: "-1", name: name, type: parent.props.multiple ? "checkbox" : "radio", onChange: onChange, checked: checked, disabled: disabled || readonly, "aria-disabled": disabled || readonly })), Component ? React.createElement(Component, { item: item }) : parent._dataText(item) ); function onChange(e) { if (!disabled && !readonly) change(e.target.checked); } } }); } module.exports = createUncontrolledWidget(SelectList, { value: "onChange" }); module.exports.BaseSelectList = SelectList;
_shouldShowCreate: function () { var _this = this; var text = this.props.searchTerm; //console.log('should ', this.props.onCreate) if (!this.props.onCreate || !text) return false; // if there is an exact match on textFields: "john" => { name: "john" }, don't show return !this._data().some(function (v) { return _this._dataText(v) === text; }) && !this.state.dataItems.some(function (v) { return _this._dataText(v) === text; }); }, _placeholder: function () { return (this.props.value || []).length ? "" : this.props.placeholder || ""; } }); module.exports = createUncontrolledWidget(Multiselect, { open: "onToggle", value: "onChange", searchTerm: "onSearch" }); // function defaultChange(){ // if ( this.props.searchTerm === undefined ) // this.setState({ searchTerm: '' }) // } module.exports.BaseMultiselect = Multiselect;
// the data attribute is required b/c twbs css uses it in the selector return ( <ButtonGroup {...props} data-toggle="buttons"> {ValidChildren.map(children, (child) => { const { value, onChange } = child.props; const handler = () => this.handleToggle(value); return React.cloneElement(child, { type, name: child.name || name, checked: values.indexOf(value) !== -1, onChange: chainFunction(onChange, handler), }); })} </ButtonGroup> ); } } ToggleButtonGroup.propTypes = propTypes; ToggleButtonGroup.defaultProps = defaultProps; const UncontrolledToggleButtonGroup = uncontrollable(ToggleButtonGroup, { value: 'onChange', }); UncontrolledToggleButtonGroup.Button = ToggleButton; export default UncontrolledToggleButtonGroup;
if (props.role === undefined && Component !== 'nav') { props.role = 'navigation'; } var expandClass = bsPrefix + "-expand"; if (typeof expand === 'string') expandClass = expandClass + "-" + expand; return React.createElement(NavbarContext.Provider, { value: this.state.navbarContext }, React.createElement(SelectableContext.Provider, { value: this.handleCollapse }, React.createElement(Component, _extends({}, props, { className: classNames(className, bsPrefix, expand && expandClass, variant && bsPrefix + "-" + variant, bg && "bg-" + bg, sticky && "sticky-" + sticky, fixed && "fixed-" + fixed) }), children))); }; return Navbar; }(React.Component); Navbar.defaultProps = defaultProps; var DecoratedNavbar = createBootstrapComponent(uncontrollable(Navbar, { expanded: 'onToggle' }), 'navbar'); DecoratedNavbar.Brand = NavbarBrand; DecoratedNavbar.Toggle = NavbarToggle; DecoratedNavbar.Collapse = NavbarCollapse; DecoratedNavbar.Text = createWithBsPrefix('navbar-text', { Component: 'span' }); export default DecoratedNavbar;
function dateOrNull(dt) { if (dt && !isNaN(dt.getTime())) return dt; return null; } function msgs(msgs) { return babelHelpers._extends({ moveBack: "navigate back", moveForward: "navigate forward" }, msgs); } function formats(obj) { return babelHelpers._extends({ headerFormat: dates.formats.MONTH_YEAR, dateFormat: dates.formats.DAY_OF_MONTH, monthFormat: dates.formats.MONTH_NAME_ABRV, yearFormat: dates.formats.YEAR, decadeFormat: function (dt, culture) { return "" + dates.format(dt, dates.formats.YEAR, culture) + " - " + dates.format(dates.endOf(dt, "decade"), dates.formats.YEAR, culture); }, centuryFormat: function (dt, culture) { return "" + dates.format(dt, dates.formats.YEAR, culture) + " - " + dates.format(dates.endOf(dt, "century"), dates.formats.YEAR, culture); } }, obj); } module.exports = createUncontrolledWidget(Calendar, { value: "onChange" }); module.exports.BaseCalendar = Calendar;