Giter Club home page Giter Club logo

contexture-react's Introduction

⚠️ Development has moved to the contexture monorepo: This package lives in https://github.com/smartprocure/contexture/tree/master/packages/react

contexture-react

React components for building contexture interfaces https://smartprocure.github.io/contexture-react

CircleCI npm version dependencies Storybook

Installation

To install with npm:

$ npm i contexture-react

Structure & Usage

Contexture-react includes the following:

  1. React components for building contexture interfaces, known simply as search components throughout our documentation

  2. The GreyVest component library

  3. Some pre-made themes for our search components, including a GreyVest theme

  4. Utility functions for building contexture interfaces, theming, and more

  5. Storybook stories for documenting and testing our components

Here is a quick guide to the directory structure:

Folder Description
src/exampleTypes Contains React components for the set of example node types included in contexture-client. Exported as exampleTypes.
src/greyVest Contains the Grey Vest component library, which is exported as greyVest and consists of basic React components. Used by the Grey Vest theme.
src/themes Contains the Grey Vest, Blueberry, Material, and base themes, hopefully with more soon to come. Exported as themes.
src/purgatory Neither search components nor library components -- they just have nowhere else to go.
everything else

Documentation

Documentation lives in our Storybook. Stories of interest include:

Notes on this repository

This project was scaffolded generally following this link: https://medium.com/@efreyreg/create-react-component-libraries-with-storybook-and-styled-jsx-8999f423f06b

Cross Browser Testing

Cross browser testing is done using BrowserStack thanks to their awesome support for open source projects!

BrowserStack

contexture-react's People

Contributors

daedalus28 avatar michsa avatar stellarhoof avatar re1ro avatar sadasant avatar doug-patterson avatar akrion avatar dshishkov avatar dubiousdavid avatar ccalbaugh avatar geosp avatar decrapifier avatar chris110408 avatar sean-clayton avatar rudolph9 avatar vstlouis avatar nico-olivares avatar ultimabgd avatar chrislatorres avatar bgwaltney avatar

Stargazers

Vo Tran avatar Mark King avatar Kristoffer Hebert avatar  avatar Caffeinated Functionality avatar  avatar

Watchers

 avatar James Cloos avatar  avatar Scott Thomson avatar Baseer Siddiqui avatar Emre Celenli avatar Conrad Davis Jr avatar  avatar Dylan Parisi avatar  avatar Dominique Northecide avatar  avatar

contexture-react's Issues

Equal horizontal padding for .gv-button

I can't see any reason for it, but .gv-button gives left padding 25px and right padding 22px. It's not helping anything and the fact that the text isn't centered is just barely noticeable to someone with a keen eye

Fix CheckboxList Checkbox dependency

Checkbox list has lost its Checkbox -- has something to do with rearranging providers (seems related to a fix done for FilterList in 1.47.0) -- just need to import the Checkbox

export TagComponent from GreyVest

right now there's no way to reuse the TagComponent that's used in TagsQuery in stand-alone TagsInput instances. Creates code duplication issues if you want your TagsInput instances to have tags that look like the GreyVest TagsQuery tags, since the default Tag you get with TagsInput looks a lot worse than the TagComponent passed into TagsQuery.

Just need a one-liner to export TagComponent

Document / demo term stats table’s criteria field prop

Follow up to #128

It’s used for cases where your filtering by something other than the key field, such as a case we have in one of our products where you have a combo field with a name and ID that you’re doing the terms aggregation on but only need to filter by the name.

Other Matches Improvements

  • Shrink Column Width by not showing which fields match in the column (just in modal)
  • Render Empty Cell when there's no match

Reordering columns in Result Table Doesn't work when omitting fields from include

If you have fields in the includes array which are omitted from the fields prop (to hide them from the table), the reordering logic won't work right unless all omitted fields are always at the end of the includes array. Here's the RCA from the ticket where we identified the issue in our product using this library:

Incorrect/non functional reording behavior is caused by omitting fields that are present in the includes array. The indexes are off because the array index i of the visibleFields referenced here https://github.com/smartprocure/contexture-react/blob/master/src/exampleTypes/ResultTable.js#L150 isn't actually the index of the field in the actual includes array, it's the index of the includes array filtering out anything we're hiding. So for example, if includes is [a, b, c, d] and you omit b, the visible column index for c is going to be 1 even though it's really 2 on the actual includes array.

This can be fixed a few different ways. We could:

  • Patch contexture react so that when moving a column, we move it to be +/- 1 of the index whereever the occurence of the next visible item is (because if you have [a, b, c, d, e, f] and c, d, and e are all hidden, you have to know that moving b to the right actually means moving it to the end).
  • Just make sure that hidden fields are always at the end of the includes array.

Better Theming API

Right now, theming is accomplished by components allowing you to override inner components via props. We currently create themes by using defaultProps from recompose and just packaging up all of the components. This works but makes it difficult to customize themes from outside the theme itself since it relies on components within the closure of the theme files.

A potentially better option is to introduce support for getting components from props or from a contextureTheme on context via Provider/inject. This would allow runtime changes of specific components so you could, for example, take the grey vest theme as is but just tweak one small thing externally instead of having to duplicate most of the theme. It would also make theming a bit more maintainable as you wouldn't import components from a theme (which makes it difficult to change a theme globally - somewhat defeating one of the main benefits of the theming concept), you'd use the contexture-react components directly and set the theme in the root of your app with Provider.

Tag Input State Persistence

TagsInput loses it's state between renders, which means that the tag currently being typed resets to empty string. For some reason, inputs are getting rerendered in some of search pages more than they should (likely due to loading indicators we don't really need there), but this also prevents us from implementing the "backspace" functionality to restore a tag. The plan was to wait for react 16.8's hooks to implement functional state, but we might be able to nest components deeper or something to work around it now.

Custom Date Component

It would be nice to enter dates like 1118 to get 01/01/2018. We should find or build one and put it in an example story

Change terms stats rows to require a passed click handler

Right now the terms stats component shows details on a click on a row even if the click target is a child of the row that's supposed to be independently clickable. We should rewire this so that the click handler is only active if you ask for it or pass a different one in.

DateRangePicker OnChange event handling bug

OnChange argument should be an event object. Code is broken currently since it assumes a simple value instead of an event object.

onChange={x => {
        let { from, to } = _.find({ label: x }, ranges)
        tree.mutate(node.path, { from, to })
      }}

GreyVest: Make only search button sticky

Right now the search input bar is also sticky, which is weird when scrolling especially with a lot of tags on a small screen. We'd like to find a way to make just the button sticky. The main challenge here is that sticky only scrolls inside a parent - so we'd likely need to move the search bar into a single top level grid that includes the results so that the button's parent can take up the full height of the results.

Improve Facet Options Filter Bar

Need to improve the usability of the facet options text field for filtering options -- right now it loses focus on every update.

Create a Find Best Range Component

The number type in contexture-elasticsearch supports lots extra analysis to help find the best range.

We should add a BestRangeButton example-type component that captures the client side functionality for this and export it, along with a higher order BestNumberRange component that just wraps up the existing Number example type component along with the new one (for use in dynamic filter lists, etc)

Kill Snapshots

It's been brought up a few times that jest snapshots in contexture-react add little value and are mostly just annoying. The only value they seem to provide is as a warning if you changed more DOM structure than you expected, but it seems like no one really looks at them anyway. Should we rip them out?

Number component should allow setting significant digits

In a currency input you don't want 3.14159. It's no good to round or truncate with the existing formatter prop since if that changes the value when it becomes the value of the input it will trigger a search update. Need to implement a significantDigits prop to which values will be rounded when they're set rather than when they're displayed.

Modal styling changes

Need a couple styling changes to the example types default modal to account for the fact that we get some pretty unruly content in there

  • set a px max-width instead of fit-content since that's experimental and isn't working with the crazy nested tables that come through
  • overflow-x: scroll
  • change the current padding to a border so x-scrollable content scrolls within the visible whitespace instead of over it

Wrap Modal in a Portal

Pretty sure it's as simple as:

props => ReactDOM.createPortal(
  <Modal {...props} />,
  document.body
)

This will fix issues with Modals inheriting styles from their parents, like opacity.

Better popover implementation

Right now, our popover renders under the parent's DOM node, making it susceptible to clipping even with a large z-index. Moreover, it can mess up the layout when it shows since it occupies space. The solution is to use a react portal to move it out of its parent's DOM node but to also get a reference to it so it can render in the correct position. We might want to wait until we use react with hooks to make this easier.

Alternatively we could look into a library like https://github.com/alexkatz/react-tiny-popover
This one is pretty small: https://github.com/dbtek/react-popover

Get this to Demo-able

  • SearchRoot needs to be able to take a path, e.g. <SearchRoot tree={root} path={['root', 'criteria']} />
  • Make some kind of functional field picker (text input box is fine)
  • Make facet example type functional (show context options as checkboxes and dispatch when checked or use a data reaction)
  • Make a functional query type (can be a text input mimicing "raw mode" and kill the words array thing we already have)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.