UNPKG

solrkit

Version:

![Build Status](https://travis-ci.org/garysieling/solrkit.svg?branch=master) ![Dependencies](https://david-dm.org/garysieling/solrkit/status.svg) UI Components for Solr, using TypeScript + React

52 lines 2.41 kB
var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); import * as React from 'react'; import * as _ from 'lodash'; import { Popup } from 'semantic-ui-react'; import { defaultRenderer } from './FacetTypes'; var RadioFacet = (function (_super) { __extends(RadioFacet, _super); function RadioFacet() { return _super !== null && _super.apply(this, arguments) || this; } RadioFacet.prototype.onClick = function (value) { var _this = this; return function () { var selections = [value[0]]; var thisFacet = {}; thisFacet[_this.props.facet] = selections; _this.context.transition({ start: 0, facets: thisFacet }); }; }; RadioFacet.prototype.render = function () { var _this = this; var title = this.props.title; var help = this.props.help; var render = this.props.render || defaultRenderer; return (React.createElement("div", { className: "ui", style: { marginBottom: '1em' } }, title ? (help ? (React.createElement(Popup, { trigger: React.createElement("h4", null, title), content: help })) : React.createElement("h4", null, title)) : null, _.sortBy(this.props.values, function (v) { return v[0]; }).map(function (value, i) { return (React.createElement("div", { style: { display: 'block' }, className: "ui radio checkbox" }, React.createElement("input", { onClick: _this.onClick(value), checked: value[2], type: "radio", name: "frequency" }), React.createElement("label", null, render(value[0], value[1])))); }))); }; RadioFacet.contextTypes = { searchState: React.PropTypes.object, transition: React.PropTypes.func }; return RadioFacet; }(React.Component)); export { RadioFacet }; //# sourceMappingURL=RadioFacet.js.map