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

spinner-wheel-selector

v0.1.1

Published

Spinner Wheel Selector Readme

Downloads

9

Readme

spinner-wheel-selector

Spinner Wheel Selector Readme

This component was created with the purpose of providing a solution to the lack of standalone spinner selector akin to the ones found in iOS operating system. This component was made for Angular and should not be used with any other framework.

Table of Contents

Install

This component requires node, npm, and angular.

You can install it by running:

npm install spinner-wheel-selector

Usage

After installing, simply import 'SpinnerWheelSelectorModule' from 'spinner-wheel-selector' and add it to the imports array of the module where you want to use it.

import { SpinnerWheelSelectorModule } from 'spinner-wheel-selector';
.
.
.
imports: [
    SpinnerWheelSelectorModule
  ],

If the import worked sucessfully, you should be able to use the component directly into your HTML using

<lib-spinner-wheel-selector></lib-spinner-wheel-selector>

Required Inputs

lib-spinner-wheel-selector will require a few input parameters by default. These are:

  • height: string The desired height of the component, given in px, em, vw or %;
  • centerFontSize: string The desired font size of the text, given in px, em, vw or %;
  • items: string[] The the list of strings that should be displyed;

Optional Inputs

In addition, lib-spinner-wheel-selector allows for aditional input parameters that result in different condfiguration and stylistic appearances.

  • displayedItemsNumber: number - default value = 5 The number of lines displayed. Must be one of the following {3, 5, 7};
  • width: string - default value = 'fit-content' The desired width of the component;
  • textColor: string - default value = 'black' The color of the text;
  • background: string - default value = 'none' The background of the component;
  • circularList: boolean - default value = false If set to true, the spinner will act as a circular list;
  • displayArrow: boolean - default value = false If set to true, the spinner will display an arrow besides the center element;
  • centerIndicator: string - default value = '➤' The extended ASCII symbol used as an indicator for the center of the spinner;

Besides these, lib-spinner-wheel-selector provides two more input values, which allow for the additon and use of custom CSS proprieties. Both of them require a JSONObject that describes the desired CSS:

  • customElementCss: JSONObject - default value = {} Special CSS class used spinner text elements;
  • customComponentCss: JSONObject - default value = {} Special CSS class used overarching component; Example of use:
    [customComponentCss]="{'border-radius': '50px', 'border': '2px solid gray'}"
    [customElementCss]="{'font-family': 'serif', 'text-transform': 'uppercase'}"

Outputs and Public Methods

The lib-spinner-wheel-selector component also provides an output parameter and a few public methods:

  • selectionChange : new EventEmitter() - returns { value: string, index: number } The selectionChange events triggers when the center of the spinner has been change and emits an object of the form <{ value: string, index: number }>, where value is the selected string and index is the index of the element in the given array; Public Methods:
  • getSelectedElement(): string Return the value of the center element;
  • getSelectedIndex(): number Return the index of the center element in the given array;
  • onUp(steps: number = 1): number Goes up a number of given steps and returns the index of the center element;
  • onDown(steps: number = 1): number Goes down a number of given steps and returns the index of the center element;

Exemple of use:

<lib-spinner-wheel-selector [displayedItemsNumber]="9" [items]="array" [height]="'300px'"[centerFontSize]="'2em'" [textColor] ="'blue'" [background]="'lightblue'" [displayArrow]="true" [centerIndicator]="'o'" [circularList]="true" [customComponentCss]="{'border-radius': '50px', 'border': '2px solid gray'}" [customElementCss]="{'font-family': 'serif', 'text-transform': 'uppercase'}" (selectionChange)="onSelectionChanged($event)"></lib-spinner-wheel-selector>

Maintainer

@Dussky44 -aka- Rares Coanta

License

The lib-spinner-wheel-selector is open source and falls under that fair use license, granting permision of usage to anyone who my desire it.