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 🙏

© 2025 – Pkg Stats / Ryan Hefner

jattac.libs.webshell

v0.3.5

Published

Simple authentication screen and navigation UI for React

Readme

Jattac Libraries WebShell

Version
License
React Version

Jattac Libraries WebShell is a simple authentication screen and navigation UI component library for React. It provides a set of reusable components that facilitate user authentication and navigation in your applications, making it easier to implement these features consistently and efficiently.

Table of Contents

Features

  • Reusable Components: Modular components for buttons, text boxes, and authentication screens.
  • TypeScript Support: Built with TypeScript for type safety and better development experience.
  • Customizable: Easily customizable components to fit your design needs.
  • User Context: Manage user state and context across your application effortlessly.

Installation

You can install the library using npm or yarn:

# Using npm
npm install jattac.libs.webshell

# Using yarn
yarn add jattac.libs.webshell

Usage

Components

WebShellButton

The WebShellButton component is a customizable button that you can use in your application. The mandatory props include onClick and label.

import React from 'react';
import { WebShellButton } from 'jattac.libs.webshell';

const App = () => {
  const handleClick = () => {
    alert('Button clicked!');
  };

  return (
    <div>
      <WebShellButton
        onClick={handleClick}
        label="Click Me"
        // Optional props
        style={{ backgroundColor: 'blue', color: 'white' }}
        disabled={false}
      />
    </div>
  );
};

export default App;

WebShell

The WebShell component provides a complete layout for authenticated users. It requires the userService prop.

import React from 'react';
import { WebShell, WebShellUserService } from 'jattac.libs.webshell';

const App = () => {
  const userService = new WebShellUserService();

  return (
    <WebShell userService={userService}>
      <h1>Welcome to the WebShell!</h1>
      <p>This is your dashboard.</p>
    </WebShell>
  );
};

export default App;

WebShellTextBox

The WebShellTextBox component is a styled input field. The mandatory props include value and onChange.

import React, { useState } from 'react';
import { WebShellTextBox } from 'jattac.libs.webshell';

const App = () => {
  const [value, setValue] = useState('');

  const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
    setValue(event.target.value);
  };

  return (
    <div>
      <WebShellTextBox
        value={value}
        onChange={handleChange}
        placeholder="Enter your text here"
        // Optional props
        type="text"
        maxLength={100}
        style={{ border: '1px solid gray' }}
      />
    </div>
  );
};

export default App;

User Context

The library provides a context for managing user authentication states. You can use the UserProvider to wrap your application and access user-related data via WebShellUserContext.

import React from 'react';
import { UserProvider, WebShellUserContext } from 'jattac.libs.webshell';

const App = () => {
  return (
    <UserProvider>
      <UserConsumerComponent />
    </UserProvider>
  );
};

const UserConsumerComponent = () => {
  const { user } = React.useContext(WebShellUserContext);

  return <div>{user ? `Hello, ${user.name}` : 'Not logged in'}</div>;
};

Examples

Complete Authentication Flow

Here’s how you can implement a simple authentication flow using the components provided:

import React, { useState } from 'react';
import { UserProvider, WebShellButton, WebShellTextBox, WebShellUserService } from 'jattac.libs.webshell';

const AuthApp = () => {
  const userService = new WebShellUserService();
  const [username, setUsername] = useState('');
  const [password, setPassword] = useState('');

  const handleLogin = () => {
    userService.login(username, password);
  };

  return (
    <UserProvider>
      <div>
        <WebShellTextBox
          value={username}
          onChange={(e) => setUsername(e.target.value)}
          placeholder="Username"
          type="text"
        />
        <WebShellTextBox
          value={password}
          onChange={(e) => setPassword(e.target.value)}
          placeholder="Password"
          type="password"
        />
        <WebShellButton onClick={handleLogin} label="Login" />
      </div>
    </UserProvider>
  );
};

export default AuthApp;

API Reference

WebShellButton

  • Props:
    • onClick: Function to handle button click (mandatory).
    • label: Text to display on the button (mandatory).
    • style: Optional custom styles for the button.
    • disabled: Optional prop to disable the button.

WebShell

  • Props:
    • userService: An instance of WebShellUserService to manage user sessions (mandatory).

WebShellTextBox

  • Props:
    • value: Current value of the text box (mandatory).
    • onChange: Function to handle input changes (mandatory).
    • placeholder: Placeholder text for the input (optional).
    • type: Input type, such as "text" or "password" (optional).
    • maxLength: Maximum length of the input (optional).
    • style: Optional custom styles for the text box.

UserProvider

Wraps your application to provide user context.

WebShellUserContext

Context to access user state across your application.

License

This project is licensed under the MIT License - see the LICENSE file for details.