npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

flight-search-widget-materialui

v1.1.16

Published

[npm-badge]: https://img.shields.io/npm/v/react-media.svg?style=flat-square [npm]: https://www.npmjs.com/package/flight-search-widget-materialui

Readme

FLIGHT-SEARCH-WIDGET-MATERIALUI

flight-search-widget-materialui is component for React to search flights for travel applications.

Installation

Using npm:

$ npm install --save flight-search-widget-materialui

Then, use as you would anything else:

Screen shot

picture

Import

// using ES modules
import FlightWidget from 'flight-search-widget-materialui/core';

Basic usage

Render a <FlightWidget> component with defined props.

import React from 'react';
import axios  from 'axios';
import moment from "moment";
import FlightWidget from 'flight-search-widget-materialui/core';

function App() {
  const config = {
    passengersLimit: 12,
    primaryColor: "primary",
    secondaryColor:  "secondary",
    defaultColor: "default",
    dispSwap: true,
  }

  const buttonLabels = {
    fromText: "From: ",
    toText: "To: ",
    depDateText: "Departure date: ",
    retDateText: "Return date: ",
    PassengersText: "Passengers: ",
    cabinClassText: "Cabin class: ",
  }

  const initialStates = {
    tripLocationsInitials: {
      departure: {
        cityName: 'Choose departure',
        cityCode: ''
      },
      arrival: {
        cityName: 'Choose arrival',
        cityCode: ''
      }
    },
    tripDatesInitials: {
      departureDate: moment(),
      returnDate: moment().add(1, 'days')
    },
    tripPassengersInitials: {
      adult: 1,
      child: 0,
      infants: 0
    }
  }

  const handleSearchValue = (fn, value)  =>  {

    const obj = {
      method:'get',
      headers:{
        "x-rapidapi-host": "cometari-airportsfinder-v1.p.rapidapi.com",
        "x-rapidapi-key": "xxx",
      },
      url: "https://cometari-airportsfinder-v1.p.rapidapi.com/api/airports/by-text",
      params: {
        text: value
      }
    }
    
    axios(obj)
    .then((res) => {
      // fn to display data on search location.
      // "country_name" and "name" are the param to display country name and city name.
      // Modify array here if needed.
      fn(res.data); 
    })
    .catch((err) => {
      console.log(err)
    })
    
  }

  const handleSelectedCity = (fn, info) =>  {
    // info will return you the list of cities fetched from api. You can modify code and name here. 
    fn(info.code, info.name);
  }

  const handleSubmit = (notValid, isReturnTrip, tripLocations, tripDates, tripClass, tripPassengers) => {

    // Format results here
    const location = `${tripLocations.departure.cityCode}-${tripLocations.arrival.cityCode}/`;
    const tripDate = `${tripDates.departureDate.format('YYYY-MM-DD')}${isReturnTrip ? `/${tripDates.returnDate.format('YYYY-MM-DD')}` : ''}`;
    const finalPassenger = `${tripPassengers.adult}Adult${tripPassengers.child ? `/${tripPassengers.child}Child` : ''}${tripPassengers.infants ? `/${tripPassengers.infants}Infant` : ''}`;

    if (!tripLocations.departure.cityCode || !tripLocations.arrival.cityCode) {
      notValid() // validation for arrival and departure cities
      return;
    }
    // Perform flight search api here or redirect to particular flight search API.
  }

  return (
    <FlightWidget 
      configuration={config}
      initials={initialStates}
      buttonLabels={buttonLabels}
      handleSearchValue={handleSearchValue}
      handleSelectedCity={handleSelectedCity}
      handleSubmit={handleSubmit}
    />
  );
}

export default App;

props

|prop|description|type| |---|---|---| |configuration|app configuraion|object| |initials|Add initial states of the app|object| |buttonLabels|change label text display on fields|object| |handleSearchValue|function to handle the onchange value of search city|function| |handleSelectedCity| function to handle city code and city name you can modify both|function| |handleSubmit|function to handle your all selected state and perform further tasks on those states|function|