0.140.0 • Published 2 years ago

pouncejs v0.140.0

Weekly downloads
198
License
MIT
Repository
github
Last release
2 years ago

Pounce

🐯A Set of Composable React Primitives for Building UI Dashboards

CircleCI

Description

This project contains common UI components for building dashboards written in TypeScript. It's currently used by Panther

Docs

Documentation is available on http://pouncejs.surge.sh/.

Installation

Pounce heavily depends on Typescript and thus has a limitation of Typescript 3.8.x. Please make sure that your project doesn't use an older version of Typescript.

$ npm install pouncejs

Usage

Quick Start

  1. To start, wrap your app with the ThemeProvider components:
import { ThemeProvider } from 'pouncejs';

const App = () => (
    <ThemeProvider>
       <Router>
         ...
       </Router
    </ThemeProvider>
)
  1. Install DM Sans:
<link
  rel="stylesheet"
  href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&display=swap"
/>
  1. Then you are ready to go!
import { Box, Button } from 'pouncejs';

Advanced

To use the library you'll need to wrap your app with the <ThemeProvider> so that your components can have access to the theme. By default <ThemeProvider> utilises the default Theme that Pounce exposes, but you can easily override that by passing a theme prop to it.

This can be done like so:

import { ThemeProvider } from 'pouncejs';
import theme from '../my/theme.js';

const App = () => (
    <ThemeProvider theme={theme}>
       <Router>
         ...
       </Router
    </ThemeProvider>
)

Make sure to wrap your entire app with a <ThemeProvider> to avoid un-necessary reconciliations and to gain in performance.

The next step would be to make sure you have your selected font-family installed. By default, Pounce uses DM Sans as it fits the default theme the best. If you are using the default theme, make sure you install DM Sans in your prefered way. The easiest of them all is by adding a link tag in your html:

<link
  rel="stylesheet"
  href="https://fonts.googleapis.com/css2?family=DM+Sans:400,500,700&display=swap"
/>

If you want to use another font-family, simply install it and make sure to mimic this change in the theme that you will provide to <ThemeProvider />. The change that you need to make is in the fonts.primary key of the theme. For example:

import { defaultTheme } from 'pouncejs';

export const myTheme = {
  ...defaultTheme,
  fonts: {
    ...defaultTheme.fonts,
    primary: 'Lato, sans-serif',
  },
};

This way you can keep all the defaults and only change the font-family exposed. You can also add keys to the theme if you want to have a centralised theme configuration that can also be used outside the context of pounce:

import { defaultTheme } from 'pouncejs';

export const myTheme = {
  ...defaultTheme,
  fonts: {
    ...defaultTheme.fonts,
    secondary: 'Inconsolata, monospace',
  },
};

By default, pounce ships with dashboard-related icons, but you may add new ones by extending the icons keyy of the theme. For example, if you want to add a new icon named my-icon you would override the theme and pass it again to the <ThemeProvider> component.

import { theme as defaultTheme } from 'pouncejs';

const myIcons = {
  'my-icon': {
    path: (
      <g id="collapse-table" stroke="none" fill="none">
        <rect x="0" y="0" width="24" height="24" />
      </g>
    ),
    viewBox: '0 0 24 24', // can be omitted if viewBox is `0 0 24 24` which is the default value
  },
};

const theme = {
  ...defaultTheme,
  icons: {
    ...defaultTheme.icons,
    ...myIcons,
  },
};

For typescript users, the new icons won't be available by default in the typings. To make them available, you need to create a declaration file anywhere in your project and extend the CustomIcons interface. For example:

// src/overrides.d.ts

import 'pouncejs';
import { myIcons } from '../myTheme'; // customIcons are declare in the snippet aoove

declare module 'pouncejs' {
  type MyIcons = typeof myIcons;
  export interface CustomIcons extends MyIcons {}
}

This way the my-icon value will be available in all Components that use icons.

SSR

SSR works out of the box with PounceJS. There's no need to add anything in your NextJS or custom-SSR app to enable it.

Performance

Pounce is on its beta phase right now, which means that the performance is constantly getting tuned.

If bundle size is something super crucial, you can safely import each module individually by doing import Box from 'pouncejs/dist/esm/components/Box' instead of the typical import { Box } from 'pouncejs' which will make sure to only pull what's needed for this particular component.

As it stands, it utilizes the latest @emotion/xxx @ 11.x.x internally, so if you are using a CSS-in-JS library in your project, it would be recommended to utilize the same library at a similar major version in order to not have two separate versions of a CSS-in-JS library in your project

License

Apache

0.137.0

2 years ago

0.140.0

2 years ago

0.136.0

2 years ago

0.139.0

2 years ago

0.131.0

2 years ago

0.138.0

2 years ago

0.130.0

2 years ago

0.133.0

2 years ago

0.129.1

2 years ago

0.132.1

2 years ago

0.132.0

2 years ago

0.135.1

2 years ago

0.135.0

2 years ago

0.134.0

2 years ago

0.125.0

2 years ago

0.124.0

2 years ago

0.127.0

2 years ago

0.126.0

2 years ago

0.129.0

2 years ago

0.128.0

2 years ago

0.123.0

2 years ago

0.118.0

3 years ago

0.118.1

3 years ago

0.121.1

2 years ago

0.121.0

2 years ago

0.120.0

2 years ago

0.119.0

3 years ago

0.122.0

2 years ago

0.117.1

3 years ago

0.117.2

3 years ago

0.117.0

3 years ago

0.116.0

3 years ago

0.114.0

3 years ago

0.113.1

3 years ago

0.113.2

3 years ago

0.113.3

3 years ago

0.113.0

3 years ago

0.109.0

3 years ago

0.115.0

3 years ago

0.110.0

3 years ago

0.112.0

3 years ago

0.108.0

3 years ago

0.111.0

3 years ago

0.106.1

3 years ago

0.106.0

3 years ago

0.105.0

3 years ago

0.107.0

3 years ago

0.104.0

3 years ago

0.103.1

3 years ago

0.103.0

3 years ago

0.102.7

3 years ago

0.102.6

3 years ago

0.102.5

3 years ago

0.102.3

3 years ago

0.102.4

3 years ago

0.102.1

3 years ago

0.102.2

3 years ago

0.102.0

3 years ago

0.101.7

3 years ago

0.101.8

3 years ago

0.101.6

3 years ago

0.101.4

3 years ago

0.101.5

3 years ago

0.101.3

3 years ago

0.101.2

3 years ago

0.101.0

3 years ago

0.101.1

3 years ago

0.99.9

3 years ago

0.100.0

3 years ago

0.100.1

3 years ago

0.100.2

3 years ago

0.99.8

3 years ago

0.99.7

3 years ago

0.99.4

3 years ago

0.99.5

3 years ago

0.99.6

3 years ago

0.99.0

3 years ago

0.99.1

3 years ago

0.99.2

3 years ago

0.99.3

3 years ago

0.98.0

3 years ago

0.97.6

3 years ago

0.97.7

3 years ago

0.97.5

4 years ago

0.97.4

4 years ago

0.97.2

4 years ago

0.97.0

4 years ago

0.97.1

4 years ago

0.96.0

4 years ago

0.94.9

4 years ago

0.94.5

4 years ago

0.94.6

4 years ago

0.94.7

4 years ago

0.94.8

4 years ago

0.94.3

4 years ago

0.94.4

4 years ago

0.95.0

4 years ago

0.95.1

4 years ago

0.95.2

4 years ago

0.93.2

4 years ago

0.93.3

4 years ago

0.93.4

4 years ago

0.93.0

4 years ago

0.93.1

4 years ago

0.94.1

4 years ago

0.94.2

4 years ago

0.94.0

4 years ago

0.92.3

4 years ago

0.92.4

4 years ago

0.92.5

4 years ago

0.92.0

4 years ago

0.92.1

4 years ago

0.92.2

4 years ago

0.91.14

4 years ago

0.91.18

4 years ago

0.91.17

4 years ago

0.91.16

4 years ago

0.91.15

4 years ago

0.91.13

4 years ago

0.91.12

4 years ago

0.91.11

4 years ago

0.91.10

4 years ago

0.91.9

4 years ago

0.91.8

4 years ago

0.91.7

4 years ago

0.91.4

4 years ago

0.91.5

4 years ago

0.91.6

4 years ago

0.91.1

4 years ago

0.91.2

4 years ago

0.91.3

4 years ago

0.90.0

4 years ago

0.91.0

4 years ago

0.89.1

4 years ago

0.88.1

4 years ago

0.88.2

4 years ago

0.88.3

4 years ago

0.89.0

4 years ago

0.88.0

4 years ago

0.86.0

4 years ago

0.87.0

4 years ago

0.85.0

4 years ago

0.84.3

4 years ago

0.84.1

4 years ago

0.84.2

4 years ago

0.84.0

4 years ago

0.83.0

4 years ago

0.82.0

4 years ago

0.81.0

4 years ago

0.80.1

4 years ago

0.80.0

4 years ago

0.79.4

4 years ago

0.79.3

4 years ago

0.79.2

4 years ago

0.79.1

4 years ago

0.79.0

4 years ago

0.78.0

4 years ago

0.77.0

4 years ago

0.76.1

4 years ago

0.76.0

4 years ago

0.75.2

4 years ago

0.75.1

4 years ago

0.75.0

4 years ago

0.74.3

4 years ago

0.74.2

4 years ago

0.74.1

4 years ago

0.74.0

4 years ago

0.73.2

4 years ago

0.73.1

4 years ago

0.73.0

4 years ago

0.72.0

4 years ago

0.71.1

4 years ago

0.71.0

4 years ago

0.70.1

4 years ago

0.70.0

4 years ago

0.69.2

4 years ago

0.69.1

4 years ago

0.69.0

4 years ago

0.67.3

4 years ago

0.68.0

4 years ago

0.67.2

4 years ago

0.67.1

4 years ago

0.67.0

4 years ago

0.66.1

4 years ago

0.66.2

4 years ago

0.66.0

4 years ago

0.65.1

4 years ago

0.65.0

4 years ago

0.64.0

4 years ago

0.63.0

4 years ago

0.62.0

4 years ago

0.59.0

4 years ago

0.60.0

4 years ago

0.61.0

4 years ago

0.58.0

4 years ago

0.57.0

4 years ago

0.56.0

4 years ago

0.55.1

4 years ago

0.55.0

4 years ago

0.54.2

4 years ago

0.54.1

4 years ago

0.54.0

4 years ago

0.53.2

4 years ago

0.53.1

4 years ago

0.53.0

4 years ago

0.52.3

4 years ago

0.52.2

4 years ago

0.52.1

4 years ago

0.52.0

4 years ago

0.51.0

4 years ago

0.51.1

4 years ago

0.50.3

4 years ago

0.50.2

4 years ago

0.50.1

4 years ago

0.50.0

4 years ago

0.49.0

4 years ago

0.48.6

4 years ago

0.48.7

4 years ago

0.48.5

4 years ago

0.48.4

4 years ago

0.48.3

4 years ago

0.48.2

4 years ago

0.48.0

4 years ago

0.48.1

4 years ago

0.47.0

4 years ago

0.46.0

4 years ago

0.45.2

4 years ago

0.45.1

4 years ago

0.44.2

4 years ago

0.44.0

4 years ago

0.44.1

4 years ago

0.45.0

4 years ago

0.43.0

4 years ago

0.42.0

4 years ago

0.41.0

4 years ago

0.40.2

4 years ago

0.40.1

4 years ago

0.40.0

4 years ago

0.39.0

4 years ago

0.38.1

4 years ago

0.38.0

4 years ago

0.37.3

4 years ago

0.37.2

4 years ago

0.37.1

4 years ago

0.37.0

5 years ago

0.36.2

5 years ago

0.36.1

5 years ago

0.36.0

5 years ago

0.34.0

5 years ago

0.35.5

5 years ago

0.35.4

5 years ago

0.35.3

5 years ago

0.35.2

5 years ago

0.35.1

5 years ago

0.35.0

5 years ago

0.32.1

5 years ago

0.32.0

5 years ago

0.33.1

5 years ago

0.33.0

5 years ago

0.31.0

5 years ago

0.30.2

5 years ago

0.30.1

5 years ago

0.30.0

5 years ago

0.29.1

5 years ago

0.29.0

5 years ago

0.27.2

5 years ago

0.27.1

5 years ago

0.27.0

5 years ago

0.28.1

5 years ago

0.28.0

5 years ago

0.26.2

5 years ago

0.26.1

5 years ago

0.26.0

5 years ago

0.25.4

5 years ago

0.25.3

5 years ago

0.25.5

5 years ago

0.25.2

5 years ago

0.25.1

5 years ago

0.25.0

5 years ago

0.23.2

5 years ago

0.24.0

5 years ago

0.23.1

5 years ago

0.23.0

5 years ago

0.22.1

5 years ago

0.22.0

5 years ago

0.21.1

5 years ago

0.21.0

5 years ago

0.20.0

5 years ago

0.19.0

5 years ago

0.18.6

5 years ago

0.18.5

5 years ago

0.18.4

5 years ago

0.18.1

5 years ago

0.18.2

5 years ago

0.18.3

5 years ago

0.17.0

5 years ago

0.18.0

5 years ago

0.17.1

5 years ago

0.15.0

5 years ago

0.16.0

5 years ago

0.16.1

5 years ago

0.14.3

5 years ago

0.14.2

5 years ago

0.14.0

5 years ago

0.14.1

5 years ago

0.13.7

5 years ago

0.13.6

5 years ago

0.13.3

5 years ago

0.13.4

5 years ago

0.13.5

5 years ago

0.13.1

5 years ago

0.13.2

5 years ago

0.13.0

5 years ago

0.12.1

5 years ago

0.12.0

5 years ago

0.11.0

5 years ago

0.11.1

5 years ago

0.10.0

5 years ago