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

mm-react-reusable

v1.11.3

Published

Made with create-react-library

Downloads

41

Readme

mm-react-reusable

Reusable Components built with AntD 4.0 and used by Managed Methods

Install

npm install --save mm-react-reusable

Import

import {
  BulkActionModal,
  QuickFilter,
  SimpleButton,
  MainFilter,
  Sort
} from "mm-react-reusable";

Example Simple Button

<SimpleButton
  disabled={isRestoreButtonDisabled()}
  type="primary"
  size="small"
  icon={<SafetyCertificateOutlined />}
  text="Restore"
  key="restore"
  textBold={true}
/>

Example Main Filter Options

import React from "react";
import moment from "moment";
import { Checkbox, Input, DatePicker, Select } from "antd";
const { Option } = Select;
const { RangePicker } = DatePicker;

const disabledDate = current => {
  return current && current > moment().endOf("day");
};

const mainFilterOptions = [
  {
    label: "Color",
    value: "color",
    rules: [
      {
        type: "array",
        required: false
      }
    ],
    component: (
      <Checkbox.Group options={["Red", "Blue", "Green", "Purple", "Brown"]} />
    )
  },
  {
    label: "Icon",
    value: "icon",
    rules: [
      {
        required: true
      }
    ],
    component: (
      <Select style={{ width: 100, textAlign: "center", borderLeft: 0 }}>
        {[
          "Android",
          "Apple",
          "Github",
          "Google",
          "Twitter",
          "Instagram",
          "Amazon",
          "Reddit"
        ].map(option => {
          return (
            <Option key={option} value={option}>
              {option}
            </Option>
          );
        })}
      </Select>
    )
  },
  {
    label: "Size",
    value: "size",
    component: <Input></Input>,
    options: null
  },
  {
    label: "Release Date",
    value: "date",
    component: (
      <RangePicker
        showTime={{ format: "HH:mm" }}
        format="YYYY-MM-DD HH:mm"
        placeholder={["Start Time", "End Time"]}
        disabledDate={disabledDate}
      ></RangePicker>
    ),
    options: null
  },
  {
    label: "Price Range",
    value: "price",
    component: "Custom Range",
    options: null
  }
];

export default mainFilterOptions;

Example Main Filter

mainFilter is a function which receives all the form values from inside of the filter drawer

<MainFilter
  mainFilterOptions={mainFilterOptions}
  filter={mainFilter}
></MainFilter>

Example Quick Filter Options

const quickFilterOptions = [
  "Android",
  "Apple",
  "Github",
  "Google",
  "Twitter",
  "Instagram",
  "Amazon",
  "Reddit"
];

export default quickFilterOptions;

Example Quick Filter

quickFilter is a function which receives the chosen filter

quickFilterReset is a boolean

<QuickFilter
  quickFilterOptions={quickFilterOptions}
  quickFilter={quickFilter}
  reset={quickFilterReset}
/>

Example Basic Table Options

const tableDataOptions = {
  columns: ["subject", "attachments", "sender", "mailbox", "sent_date"],
  data: [
    {
      key: "1",
      subject: "Updated Hire Info",
      attachments: 10,
      mailbox: "[email protected]",
      sent_date: "Apr 27, 2020, 7:03:14 AM",
      sender: "james"
    },
    {
      key: "2",
      subject: "Updated Hire Info",
      attachments: 1,
      mailbox: "[email protected]",
      sent_date: "Apr 27, 2020, 7:03:13 AM",
      sender: "emma"
    },
    {
      key: "3",
      subject: "Managed Methods | SaaS Files and Folders",
      attachments: 1,
      mailbox: "[email protected]",
      sent_date: "Apr 27, 2020, 7:03:11 AM",
      sender: "john"
    },
    {
      key: "4",
      subject: "Managed Methods | SaaS Files and Folders",
      attachments: 7,
      mailbox: "[email protected]",
      sent_date: "Apr 27, 2020, 7:03:09 AM",
      sender: "sophia"
    },
    {
      key: "5",
      subject: "Managed Methods | SaaS Files and Folders",
      attachments: 2,
      mailbox: "[email protected]",
      sent_date: "Apr 27, 2020, 7:03:07 AM",
      sender: "olivia"
    }
  ]
};

Example Basic Table

<BasicTable
  type="checkbox" //checkbox or radio
  paginationPosition="bottomRight" //topLeft | topCenter | topRight |bottomLeft | bottomCenter | bottomRight
  tableDataOptions={tableDataOptions}
  loading={false} //true or false
  size="small" //default | middle | small
/>

Example Sort Options

const sortOptions = [
  "Subject",
  "Attachments",
  "Sender",
  "Mailbox",
  "Sent Date"
];

export default sortOptions;

Example Sort

sort is a function which receives both "ascend"/"descend" values and the field which to sort by

<Sort
  buttonStyle={{ float: "right", margin: 10 }}
  sortButtonOptions={sortOptions}
  sort={sort}
/>

Example Bulk Action Modal Options

const bulkActionModalOptions = {
  message: {
    title: "Are you sure you want to delete 1 record(s)?",
    content: "This action will permanently delete the email from the user",
    bulkActionCancel: "Cancel",
    bulkActionSubmit: "Ok"
  },
  form: {
    layout: "vertical",
    title: "Share Entities via Email",
    description:
      "Please enter the following details in order to share the selected emails.",
    toggleButtonText: "Mask the Risk",
    toggleButtonChecked: true,
    bulkActionCancel: "Cancel",
    bulkActionSubmit: "Share",
    fields: [
      {
        name: "recipient",
        label: "Recipient(s)",
        tooltipPresent: "yes",
        tooltipMessage: "Seperate multiple addresses with commas",
        input: "input",
        required: true,
        errorMessage: "Please provide recipient(s)",
        whitespaceAllowed: true
      },
      {
        name: "subject",
        label: "Subject",
        tooltipPresent: "no",
        input: "input",
        required: true,
        errorMessage: "Please provide subject",
        whitespaceAllowed: true
      },
      {
        name: "comment",
        label: "Comment",
        tooltipPresent: "no",
        input: "textarea"
      }
    ]
  }
};

Example Regular Search Options

const searchOptions = {
  options: ["subject", "attachments", "sender", "mailbox", "sent_date"]
};

Example Regular Search

<RegularSearch searchOnKey={true} searchOptions={searchOptions.options} />

License

MIT ©