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

@mmb-digital/ui-components-auto

v1.0.4

Published

UI components used in development of MONETA's web applications. See the project vision in the ROADMAP.md file and a more detailed description on [Confluence](https://monetamoneybank.atlassian.net/wiki/spaces/RD/pages/42900394/ui-components).

Downloads

10

Readme

ui-components

UI components used in development of MONETA's web applications. See the project vision in the ROADMAP.md file and a more detailed description on Confluence.

Click here to see the components!

Useful commands

Install dependencies: yarn

Start the development environment: yarn start

Generate a new component: yarn run generate

Specific features of the library

Message prop

Because we use react-intl in all of our projects, you can pass a message descriptor to any component for convenience as the message (or messages) prop.

Usage example

const message = {
  id: 'react.intl.example.id',
  defaultMessage: 'Hi!'
}

<BButton message={message}>

// alternatively, you may pass a string!
// this is convenient for debugging

<BButton message="Hi!">

// if you can pass more messages to the component,
// use the plural version

<BSelect messages={{ error: message, label: message }}>

Theme prop

Because ui-components are supposed to be used primarily with CSS modules, all components feature the theme prop. The theme prop allows you to pass a prioritised CSS module (or an array of CSS modules) or a string, which will be used in addition to all other class names.

A CSS Module is an object, where the keys specify the source class and the values the hashed/minified class.

Usage example

/* styles.css file in a React app */

.btn {
  composes: btn from '<business>';
  color: salmon;
}
// part of a component file in a React app

import styles from './styles.css'

// ...

<BButton theme={styles} />

// `btn` would otherwise be applied from `ui-styles`
// instead, it is applied from the theme.

// this is how the `styles` import looks:

// { btn: 'styles__btn___3idho' }

You can also create your own CSS modules of sorts! This is useful if you want to use predefined global class names throughout your application.

const styles = {
  btn: 'button',
  'btn-primary': 'button-primary',
  // ...
}

export default styles

And in your application root:

import React from 'react'
import { BButton, injectTheme, ThemeProvider } from '@prague-digi/ui-components'
import styles from './styles'

const Button = injectTheme(BButton)

// ...

<ThemeProvider theme={styles}>
  <Button message="I look pretty!" />
</ThemeProvider>

You can even pass the theme prop to the Button itself! Everything will work just fine. The priority is right-to-left, meaning that if you choose to pass an array of CSS modules, the rightmost one will have priority.

This is the priority list for almost all use cases (from highest to lowest priority). Remember that the resolution is not chained! Once the class name is found in a CSS module, the search STOPS.

  1. theme prop
  2. context theme from <ThemeProvider />
  3. ./scss/bootstrap or a styles.css file
  4. the string is used as-is