How to use @blueprintjs/select - 10 common examples

To help you get started, we’ve selected a few @blueprintjs/select examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pymedphys / pymedphys / app / src / components / select-script.tsx View on Github external
*
 *     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.
 */


// Select options code copied and modified from:
// https://github.com/palantir/blueprint/blob/06a186c90758bbdca604ed6d7bf639c3d05b1fa0/packages/docs-app/src/examples/select-examples/films.tsx


const UserScriptSelect = Select.ofType();

const filterScripts: ItemPredicate = (query, script, _index, exactMatch) => {
  const normalisedName = script.name.toLowerCase();
  const normalisedQuery = query.toLowerCase();

  if (exactMatch) {
    return normalisedName === normalisedQuery;
  } else {
    return `${script.name}. ${normalisedName} ${script.description}`.indexOf(normalisedQuery) >= 0;
  }
};


export const renderScripts: ItemRenderer = (script, { handleClick, modifiers, query }) => {
  if (!modifiers.matchesPredicate) {
    return null;
github palantir / blueprint / packages / docs-theme / src / components / navigator.tsx View on Github external
itemExclude?: (node: IPageNode | IHeadingNode) => boolean;

    /**
     * Callback invoked when the navigator is closed. Navigation is performed by
     * updating browser `location` directly.
     */
    onClose: () => void;
}

export interface INavigationSection {
    path: string[];
    route: string;
    title: string;
}

const NavOmnibar = Omnibar.ofType();
const INPUT_PROPS: IInputGroupProps = { placeholder: "Fuzzy search headings..." };

export class Navigator extends React.PureComponent {
    private sections: INavigationSection[];

    public componentDidMount() {
        this.sections = [];
        eachLayoutNode(this.props.items, (node, parents) => {
            if (Utils.safeInvoke(this.props.itemExclude, node) === true) {
                // ignore excluded item
                return;
            }
            const { route, title } = node;
            const path = parents.map(p => p.title).reverse();
            this.sections.push({ path, route, title });
        });
github nowyasimi / no8am / no8am / static / js / search / SearchBoxWithPopover.tsx View on Github external
interface ISearchBoxWithPopoverDispatchProps {
    onLoadMetadata: () => void;
    onSearchItem: (item: IMetadata) => void;
}

interface IMetadataByType {
    [x: string]: SearchBoxWithPopoverItem[];
}

interface ISearchHeader {
    text: string;
}

type SearchBoxWithPopoverItem = ISearchHeader | IMetadata;

const SuggestWrapper = Suggest.ofType();

@HotkeysTarget
class SearchBoxWithPopover
    extends React.Component {

    private noResults = (
        // TODO
        // } else if (this.props.searchHistory.length > 0) {
        //     return ([{text: "Recent Searches (No results)"}] as SearchBoxWithPopoverItem[])
        //         .concat(this.props.searchHistory);
        <menuitem for="" disabled="{true}">
    );
</menuitem>
github spotify / proto-registry / src / components / TypeSearch.tsx View on Github external
/* tslint:disable */
// Sadly this library is not ES6 module compatible
const Fuse = require('fuse.js')

/* tslint:enable */

interface IProps {
  // The nodes to search
  nodes: ReflectionObject[]
  // Recently searched/selected nodes, to be shown as suggestions before the user starts searching
  recent: ReadonlyArray
  // Called when the user requests a type to be selected
  onSelected: (fullName: string) =&gt; void
}

const NodeSuggest = Suggest.ofType()

// A component that provides a search field for types.
class TypeSearch extends React.PureComponent {
  public render () {
    return (
      
    )
  }
github RoboPhred / oni-duplicity / src / pages / SaveEditor / pages / Duplicants / pages / Jobs / pages / Roles / component.tsx View on Github external
import * as React from "react";
import { action } from "mobx";
import { observer } from "mobx-react";
import { autobind } from "core-decorators";

import { NumericInput, Button, MenuItem } from "@blueprintjs/core";
import { Select, IItemRendererProps } from "@blueprintjs/select";
const StringSelect = Select.ofType();

import { GameObjectModel } from "@/services/save-editor";
import { MinionResumeBehavior } from "oni-save-parser";

import "./style.scss";

export interface DuplicantJobsPageProps {
  duplicant: GameObjectModel;
}

type Props = DuplicantJobsPageProps;
@observer
class DuplicantRolesPage extends React.Component {
  render() {
    const { duplicant } = this.props;
github dagster-io / dagster / js_modules / dagit / src / PipelineJumpComponents.tsx View on Github external
: selectedPipelineName
                ? selectedPipelineName
                : "Select a pipeline..."
            }
            disabled={!selectedPipeline &amp;&amp; !!selectedPipelineName}
            rightIcon="double-caret-vertical"
          /&gt;
        
      
    );
  }
}

const PipelineSelect = Select.ofType();

const SolidSelect = Select.ofType();

const BasicNamePredicate = (text: string, items: any) =&gt;
  items
    .filter((i: any) =&gt; i.name.toLowerCase().includes(text.toLowerCase()))
    .slice(0, 20);

const BasicNameRenderer = (
  item: { name: string },
  options: { handleClick: any; modifiers: any }
) =&gt; (
  <menuitem></menuitem>
github RoboPhred / oni-duplicity / src / pages / SaveEditor / pages / Geysers / components / GeyserEditor / component.tsx View on Github external
import * as React from "react";
import { action } from "mobx";
import { observer } from "mobx-react";
import { GeyserBehavior, GEYSER_TYPE_NAMES, getGeyserTypeName, getGeyserTypeHash } from "oni-save-parser";
import { Button, MenuItem, NumericInput, Slider } from "@blueprintjs/core";
import { Select, IItemRendererProps } from "@blueprintjs/select";
const StringSelect = Select.ofType();

import { GameObjectModel } from "@/services/save-editor";
import { typedKeys } from "@/utils";

import "./style.scss";

export interface GeyserEditorProps {
    className?: string;
    gameObject: GameObjectModel;
}
@observer
export default class GeyserEditor extends React.Component {
    render() {
        const {
            className,
            gameObject
github palantir / blueprint / packages / timezone / src / components / timezone-picker / timezonePicker.tsx View on Github external
* Props to spread to the filter `InputGroup`.
     * All props are supported except `ref` (use `inputRef` instead).
     * If you want to control the filter input, you can pass `value` and `onChange` here
     * to override `Select`'s own behavior.
     */
    inputProps?: IInputGroupProps &amp; HTMLInputProps;

    /** Props to spread to `Popover`. Note that `content` cannot be changed. */
    popoverProps?: Partial;
}

export interface ITimezonePickerState {
    query: string;
}

const TypedSelect = Select.ofType();

@polyfill
export class TimezonePicker extends AbstractPureComponent2 {
    public static displayName = `${DISPLAYNAME_PREFIX}.TimezonePicker`;

    public static defaultProps: Partial = {
        date: new Date(),
        disabled: false,
        inputProps: {},
        placeholder: "Select timezone...",
        popoverProps: {},
        showLocalTimezone: true,
        valueDisplayFormat: TimezoneDisplayFormat.OFFSET,
    };

    private timezoneItems: ITimezoneItem[];
github electron / fiddle / src / renderer / components / commands-version-chooser.tsx View on Github external
import { Button, ButtonGroup, MenuItem } from '@blueprintjs/core';
import { ItemPredicate, ItemRenderer, Select } from '@blueprintjs/select';
import { observer } from 'mobx-react';
import * as React from 'react';

import { ElectronVersion, ElectronVersionSource, ElectronVersionState } from '../../interfaces';
import { highlightText } from '../../utils/highlight-text';
import { sortedElectronMap } from '../../utils/sorted-electron-map';
import { AppState } from '../state';
import { getReleaseChannel } from '../versions';

const ElectronVersionSelect = Select.ofType();

/**
 * Helper method: Returns the <select> label for an Electron
 * version.
 *
 * @param {ElectronVersion} { source, state }
 * @returns {string}
 */
export function getItemLabel({ source, state, name }: ElectronVersion): string {
  let label = '';

  if (source === ElectronVersionSource.local) {
    label = name || 'Local';
  } else {
    if (state === ElectronVersionState.unknown) {
      label = `Not downloaded`;</select>
github source-academy / cadet-frontend / src / components / missionControl / editingWorkspaceSideContent / DeploymentTab.tsx View on Github external
<button>
  
);

const ChapterSelectComponent = Select.ofType();

const chapterRenderer: ItemRenderer = (chap, { handleClick, modifiers, query }) =&gt; (
  <menuitem>
);

const iExternals = Array.from(externalLibraries.entries()).map((entry, index) =&gt; ({
  name: entry[0] as ExternalLibraryName,
  key: index,
  symbols: entry[1]
}));

const externalSelect = (
  currentExternal: string,
  handleSelect: (i: IExternal, e: React.ChangeEvent) =&gt; void
) =&gt; (
  </menuitem></button>