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

sublime-components

v1.0.52

Published

Made with create-react-library

Downloads

16

Readme

NPM JavaScript Style Guide

part of react-sublime

Install

npm install sublime-components sublime-styles

Usage

In your app.css

@import "sublime-styles/button.scss";
@import "sublime-styles/form.scss";
@import "sublime-styles/input.scss";
@import "sublime-styles/layout.scss";
@import "sublime-styles/list.scss";
@import "sublime-styles/popup.scss";
@import "sublime-styles/table.scss";
@import "sublime-styles/text.scss";
@import "sublime-styles/title.scss";

Popup Component

This component provides a flexible way to manage popups and modals in React applications.

Usage
import React from 'react';
import { Popup } from 'sublime-components';

function App() {
  const openPopup = async () => {
    await Popup.fire({
      // Specify the content of the popup
      //...textComponentConfig
      // Optionally provide additional configuration
      // bg: 'dark', // Specify background style
      // canClose: true, // Enable closing the popup by clicking outside
      // form: { /* Form configuration */ }, // Render a form inside the popup
      // modal: YourCustomModalComponent, // Render a custom modal component
    });
  };

  const closePopup = async () => {
    await Popup.close();
  };

  return (
    <div>
      <button onClick={openPopup}>Open Popup</button>
      <button onClick={closePopup}>Close Popup</button>
      <Popup />
    </div>
  );
}

export default App;

Button Component

This component renders a button or a link with customizable properties.

Usage

import React from 'react';
import { Button } from 'sublime-components';

function MyComponent() {
  const handleClick = () => {
    console.log('Button clicked!');
  };

  return (
    <div>
      <Button label="Click me" onClick={handleClick} />
      <Button label="Visit website" variant="primary" href="https://example.com" />
    </div>
  );
}

export default MyComponent;

Layout Component

This component renders a layout with flexible configurations.

Usage

types : default, center, split, split-right, split-left

import React from 'react';
import { Layout } from 'sublime-components';

function MyComponent() {
  return (
    <Layout type="split-right" variant="dark">
      <div>Content 1</div>
      <div>Content 2</div>
    </Layout>
  );
}

export default MyComponent;

Input Component

This component provides various input fields with validation support.

Usage

import React from 'react';
import { Input } from 'sublime-components';

function MyForm() {
  const handleChange = (value) => {
    console.log('Input value changed:', value);
  };

  return (
    <div>
      <Input type="text" label="Name" onChange={handleChange} />
      <Input type="email" label="Email" onChange={handleChange} />
      <Input type="password" label="Password" onChange={handleChange} />
      <Input type="date" label="Date" onChange={handleChange} />
      <Input type="boolean" label="Agree to terms" onChange={handleChange} />
      {/* Add more input fields as needed */}
    </div>
  );
}

export default MyForm;

Form Component

This component provides a customizable form with input fields and submission handling.

Usage

import React from 'react';
import { Form } from 'sublime-components';

function MyForm() {
  const handleSubmit = async (formData) => {
    // Handle form submission
    console.log('Form submitted with data:', formData);
    // Example: Call API to submit form data
    // const response = await submitFormData(formData);
    // return response.success;
  };

  const formFields = [
    { name: 'username', label: 'Username', type: 'text', require: true },
    { name: 'email', label: 'Email', type: 'email', require: true },
    { name: 'password', label: 'Password', type: 'password', require: true },
  ];

  const buttonText = 'Submit';

  return (
    <Form
      fields={formFields}
      button={{ label: buttonText, variant: 'primary' }}
      onSubmit={handleSubmit}
      submittedText={{ content: 'Form submitted successfully!' }}
    />
  );
}

export default MyForm;

List Component

This component renders a list of items with customizable styles and navigation indicators.

Usage

import React from 'react';
import { List } from 'sublime-components';

function MyList() {
  const itemList = ['Item 1', 'Item 2', 'Item 3'];

  return (
    <List
      list={itemList}
      variant="default"
      className=""
      dots={true}
      arrows={false}
      align="left"
    />
  );
}

export default MyList;

Text Component

This component displays text content with optional icon, title, paragraphs, and list.

Usage

import React from 'react';
import { Text } from 'sublime-components';

function MyText() {
  const paragraphs = [
    'Paragraph 1',
    'Paragraph 2',
    'Paragraph 3'
  ];

  const listItems = ['Item 1', 'Item 2', 'Item 3'];

  return (
    <Text
      icon="exampleIcon"
      title={{ content: 'Example Title', variant: 'h2' }}
      pre="Pre-text"
      text="Main text content"
      extra="Extra text content"
      paragraphs={paragraphs}
      variant="default"
      align="center"
      className=""
      list={listItems}
    />
  );
}

export default MyText;

License

MIT © Damian-Mostert