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

@vonage/vc-keypad

v1.0.1

Published

vc-keypad Web Component to be used with the Vonage Client JS SDK following open-wc recommendations

Downloads

39

Readme

<vc-keypad>

This Web Component follows the open-wc recommendation and created to interact with the Vonage Client SDK.

For more information about the keypad component, please see the following blog post:

Installation

npm i @vonage/vc-keypad

Usage

<script type="module">
  import '@vonage/vc-keypad/vc-keypad.js';
</script>

<vc-keypad></vc-keypad>

// with some attributes added
<vc-keypad no-display keys='["","▲","","◀","","▶","","▼","","","",""]' actionText="💥 Pew"></vc-keypad>

Attributes that can be used (optional):

  • no-asterisk : hide the * button
  • no-hash : hide the # button
  • no-display : hide the input display
  • actionText="custom text" : customize the text on the start action button
  • cancelText="custom text" : customize the text on the cancel action button
  • keys='["1","2"..."#"]' : customize the text that shows on the keypad buttons
  • placeholder="custom text" : customize the input display's placeholder text

Events to listen for

  • digit-added : fired when a digit is added, payload contains the digit and it's position
  • digits-sent : fired when digit(s) are submitted, payload contains the digit(s)
  • action-ended : fired when an action is cancelled / ended

Methods that can be called

  • createAction() : let the component know the action has started, will show the cancel button and hide the action button
  • cancelAction() : let the component know the action has be cancelled, will clear the input display and show the action button and hide the cancel button

Styling

The vc-keypad component uses CSS part to apply custom styles.

Here are two diagram that labels the parts of the component as well as the default style:

Diagram labeling the parts of the component

To style the input display, the part is "input".

Each row is labeled as "row". To style a specific row, the parts are labeled as "position1 position2 ... position5", i.e. "row position4".

Diagram labeling the parts of the component

To apply a style to all buttons, target the part "button". Each button can be styled individually by adding its part "position1 position2 ... action cancel", i.e. "button position11".

Example:

vc-keypad::part(row position4) {
  color: red;
  border: 2px green solid;
  font-size: 30px;
  display: none;
}

vc-keypad::part(button) {
  border-radius: 100%;
  width: 60px;
  height: 60px;
  background-color: black;
}

vc-keypad::part(button action) {
  border-radius: 6px;
  width: 100%;
  background-color: red;
}

vc-keypad::part(button position1) {
  display: none;
}

vc-keypad::part(button position3) {
  display: none;
}

vc-keypad::part(button position5) {
  display: none;
}

vc-keypad::part(button position7) {
  display: none;
}

vc-keypad::part(button position9) {
  display: none;
}

Linting with ESLint, Prettier, and Types

To scan the project for linting errors, run

npm run lint

You can lint with ESLint and Prettier individually as well

npm run lint:eslint
npm run lint:prettier

To automatically fix many linting errors, run

npm run format

You can format using ESLint and Prettier individually as well

npm run format:eslint
npm run format:prettier

Testing with Web Test Runner

To run the suite of Web Test Runner tests, run

npm run test

To run the tests in watch mode (for <abbr title="test driven development">TDD</abbr>, for example), run

npm run test:watch

Demoing with Storybook

To run a local instance of Storybook for your component, run

npm run storybook

To build a production version of Storybook, run

npm run storybook:build

Tooling configs

For most of the tools, the configuration is in the package.json to reduce the amount of files in your project.

If you customize the configuration a lot, you can consider moving them to individual files.

Local Demo with web-dev-server

npm start

To run a local development server that serves the basic demo located in demo/index.html