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

@aics/aics-react-labkey

v4.6.3

Published

React components to be shared across multiple LabKey modules

Downloads

51

Readme

AICS LabKey React Components

This repo hosts React components created by AICS that are used in multiple LabKey modules.

Components

  • AicsBlockUi
  • AicsGrid
  • LabKeyOptionSelector

Usage

Install:

npm install @aics/aics-react-labkey --save

Import into JavaScript file (must have tooling such as Webpack/Babel set up):

import '@aics/aics-react-labkey/dist/styles.css';
import { AicsGrid, AicsBlockUi, LabKeyOptionSelector } from '@aics/aics-react-labkey';

LabKeyOptionSelector props

LabKeyOptionSelector wraps react-select, and renames the following props:

  • old name -> new name
  • name -> id
  • value -> selected
  • labelKey -> optionNameKey
  • valueKey -> optionIdKey
  • onChange -> onOptionSelection
  • multi -> multiSelect

LabKeyOptionSelector adds some additional props related to the Bootstrap Form Group that surrounds it, which can be seen in the Selector demo.

It will also forward any props you pass to it to the underlying react-select component, which means you can pass any of the possible props, keeping in mind the renamed ones above.

LabKeyOptionSelector Async Mode

LabKeyOptionSelector can be configured to run in "async" mode if the async prop is set to true. Look at LabKeyOptionSelectorDemo.jsx for an example of how this works.

In "async" mode, LabKeyOptionSelector will also use the following props:

  • loadOptions (required)
  • autoload
  • cache

These props get forwarded to the underlying react-select component. Look at the documentation for more information.

Additionally, the options prop is not used in "async" mode.

LabKeyOptionSelector Creatable Mode

LabKeyOptionSelector can also be configured to run in "creatable" mode if the creatable prop is set to true. "Creatable" mode can only be used if not in "async" mode, and vice versa.

You can find more information about "creatable" mode and additional props in the react-select documentation.

View Examples

Install dependencies:

npm install

Start up Webpack Dev Server:

npm run dev

Changes will be live-reloaded.

Examples of how to use these components can be found in the examples/ directory.

Test Local Changes

While developing this library, it is common to want to test your changes in other repos that use this library without publishing your changes. This can easily be accomplished with npm link.

In this repo, run:

npm link

In the repo that you want to test your changes in, run:

npm link @aics/aics-react-labkey

This will create an entry in node_modules in the second repo that is symlinked to your copy of this repo.

To remove the link, run:

npm unlink @aics/aics-react-labkey

You may need to update the css loader to resolve to this path ('../labkey-aics-react-components/dist/styles.css') as opposed to just /node_modules/

 {
     test: /\.css$/,
     include: [/node_modules/, path.resolve(__dirname, '../labkey-aics-react-components/dist/styles.css')],
     use: [
         'style-loader',
         'css-loader'
     ]
 }

You may need to add aliases for react and react-dom to the Webpack config in the project you are testing in, as these libraries are only peer dependencies in aics-react-labkey.

resolve: {
    alias: {
        react: path.resolve('./node_modules/react'),
        'react-dom': path.resolve('./node_modules/react-dom')
    }
}

Publishing Changes

Publishing can be accomplished via the master branch on Jenkins:

https://jenkins.corp.alleninstitute.org/job/node-packages/job/aics-react-labkey/.

Once changes are in master, click "Build with Parameters". Check PUBLISH to true and set VERSION_TO_INCREMENT to one of the three drop down values: "patch", "minor", "major". Look up npm semantic versioning for more information. Additionally, this will also create a version commit and tag in git, and will push these to origin.

Finally, click Build to initiate process.