New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@translated/react-filters-bar

Package Overview
Dependencies
Maintainers
4
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@translated/react-filters-bar

A module that encloses the UX abstraction to create a dynamic filters bar.

  • 0.2.1
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-75%
Maintainers
4
Weekly downloads
 
Created
Source

FiltersBar

A module that encloses the UX abstraction to create a dynamic filters bar.

Installation

yarn add @translated/react-filters-bar

Anatomy

import {FiltersBar, FiltersPicker} from '@translated/react-filters-bar'

export function Anatomy() {
  return (
    <FiltersBar
      filtersDef={{
        fruit: (
          <UseFilter>
            {({data, setValue, setOperator, remove}) => (
              <div>
                <div>Fruit filter</div>
                <select
                  value={data.operator}
                  onChange={(e) => {
                    setOperator(e.currentTarget.value)
                  }}
                >
                  <option value="eq">is</option>
                  <option value="neq">is not</option>
                </select>
                <select
                  value={data.value}
                  onChange={(e) => {
                    setValue(e.currentTarget.value)
                  }}
                >
                  <option value="apple">Apple</option>
                  <option value="grape">Grape</option>
                  <option value="banana">Banana</option>
                  <option value="ananas">Ananas</option>
                </select>
                <button onClick={remove}>Remove</button>
              </div>
            )}
          </UseFilter>
        ),
        // ... add as many filter definitions you may need.
      }}
    >
      <FiltersBar.Filters />

      <FiltersPicker valuesMap={{fruit: 'Fruit' /* ... */}}>
        <FiltersPicker.Trigger />

        <FiltersPicker.Popover>
          <FiltersPicker.Search />
          <FiltersPicker.List>
            {(matches) => (
              <>
                {matches.map((match) => (
                  <FiltersPicker.Item key={match} value={match} />
                ))}
              </>
            )}
          </FiltersPicker.List>
        </FiltersPicker.Popover>
      </FiltersPicker>
    </FiltersBar>
  )
}

Todo

In the future the library will export more convenient primitives for defining Filters, like:

  • RemoveButton
  • OperatorPicker
  • ChoicePicker
  • SearchPicker
  • DatePicker

Keywords

FAQs

Package last updated on 12 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc