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 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-auto-scroll-time-select

v3.0.4

Published

[![total](https://img.shields.io/npm/dt/react-auto-scroll-time-select.svg)](https://www.npmjs.com/package/react-auto-scroll-time-select) [![npm](https://img.shields.io/npm/v/react-auto-scroll-time-select.svg)](https://www.npmjs.com/package/react-auto-scro

Downloads

16

Readme

react-auto-scroll-time-select

total npm

A select box that supports typescript. You can select options that are separated by time. Automatically scrolls to choices that match the entered value.

Demo Site

Installation

$ yarn add react-auto-scroll-time-select @emotion/css

Usage

import Select, { OptionType } from "react-auto-scroll-time-select";

<Select onChange={setOption} value={option} />;

Export Types

| Name | Type | | :-------------- | :---------------------------------- | | OptionType | { label: string; value: string; } | | InputValueType | string | null | undefined | | StyleConfigType | { [key: string]: any } |

Props

| Prop | Default | Type | Detail | | :----------------------- | :----------- | :--------------------------------------------------- | :---------------------------------------------------------- | | span | 30 (minutes) | number | Choice time interval | | hourLimit | 24 (hours) | number | Limit time | | value | | OptionType | null | The time you have selected | | onChange | | (option: OptionType | null) => void; | Select change event | | findOption | | (option: OptionType, input: InputValueType) => void; | An event that finds options to scroll from input characters | | isClearable | true | boolean | If true, display the button to clear | | styles | | { select, control, ... } | See Custom Style | | menuPortalTarget | | | Element to add selection menu | | defaultScrollOptionValue | | string | Default display value | | hideOptions | [] | string[] | Specify options to hide | | disabledOptions | [] | string[] | Specify options to disabled | | startTime | 00:00 | string | Specify the start time |

Custom Styles

Examples

<Select
  styles={{
    select: (config: StyleConfigType) => ({
      ...config,
      width: 200,
    }),
    control: () => ({}),
  }}
/>

Styles Props

| props | Detail | | :------------------- | :--------------------- | | select | Select box outline | | control | Select box inner frame | | inputForm | input field | | clearValue | Clear button | | dropDownArrowWrapper | Dropdown outline | | dropDownArrowItem | Dropdown items | | selectOptions | Selection menu outline | | optionMenu | Selection menu items |

Full Custom Example

import React, { useState, useEffect } from "react";
import Select, {
  OptionType,
  InputValueType,
  StyleConfigType,
} from "react-auto-scroll-time-select";

const App = () => {
  const [option, setOption] = useState<OptionType | null>();

  useEffect(() => {
    console.log(option);
  }, [option]);

  return (
    <Select
      onChange={setOption}
      value={option}
      span={15}
      hourLimit={33}
      findOption={(option: OptionType, inputValue: InputValueType) =>
        option.value === inputValue
      }
      isClearable={false}
      styles={{
        select: (config: StyleConfigType) => ({
          ...config,
          width: 500,
        }),
        control: (config: StyleConfigType) => ({
          ...config,
          width: 500,
        }),
        inputForm: (config: StyleConfigType) => ({
          ...config,
          width: "100%",
          backgroundColor: "#d69a9a",
        }),
        clearValue: (config: StyleConfigType) => ({
          ...config,
          width: 30,
          backgroundColor: "#000000",
          color: "white",
        }),
        dropDownArrowWrapper: (config: StyleConfigType) => ({
          ...config,
          width: 50,
          backgroundColor: "#a1a8b7",
          "&:hover > div": {
            borderColor: "rgba(255, 0, 0, 0.5) transparent transparent",
          },
        }),
        dropDownArrowItem: (config: StyleConfigType) => ({
          ...config,
          borderColor: "#a73c3c transparent transparent",
        }),
        selectOptions: (config: StyleConfigType) => ({
          ...config,
          width: 600,
          backgroundColor: "#000000",
        }),
        optionMenu: (config: StyleConfigType) => ({
          ...config,
          color: "green",
        }),
      }}
      menuPortalTarget={document.body}
      defaultScrollOptionValue="09:00"
      hideOptions={["01:30"]}
      disabledOptions={["02:00"]}
      startTime={"01:00"}
    />
  );
};

export default App;

License

MIT