Skip to content

Releases: openlawteam/openlaw-elements

v1.1.2

02 Mar 11:42
Compare
Choose a tag to compare
  • Bump rollup-plugin-postcss from 2.0.3 to 2.1.1 (#114) 2236d15
  • Bump react-dom from 16.12.0 to 16.13.0 (#112) 25b01dc
  • Bump @babel/plugin-proposal-object-rest-spread from 7.7.4 to 7.8.3 (#113) f4cd19a
  • Bump eslint-plugin-flowtype from 4.5.2 to 4.6.0 (#111) 534e7b3
  • Bump @babel/plugin-transform-runtime from 7.7.4 to 7.8.3 (#110) 11e7d60
  • Update root API URL in README.md (#109) 3dc95ab

v1.1.1...v1.1.2

v1.1.1

07 Feb 14:53
Compare
Choose a tag to compare

v1.1.0...v1.1.1

v1.1.0

04 Dec 21:28
Compare
Choose a tag to compare

v1.0.2...v1.1.0

v1.0.2

31 Oct 00:33
Compare
Choose a tag to compare
  • Fixes DatePicker tests to use current system time offset (#81) 34e575d
  • patch npm vulnerabilities: 1164, 1118 (#80) a7177f6

v1.0.1...v1.0.2

v1.0.1

26 Aug 04:39
Compare
Choose a tag to compare
  • fixes bug where Text was providing an empty string instead of undefined (#77) abdc99d
  • Clarity of "single component" 698baa1
  • Minor text updates and organization of headings 44a207f
  • A more descriptive explantation of the intention cb562f1

v1.0.0...v1.0.1

v1.0.0

19 Aug 07:42
Compare
Choose a tag to compare

Introduces contextual error messages to every field (with the option to change or hide the message), validation which propagates to parent components, and other tweaks, styles, and stability improvements to our fields.

Visible error messages

  • When an OpenLaw input fails to validate as per the rules in OpenLaw Core (e.g. data type, format, etc.) we now let the user know.
  • A simple error message is displayed beneath the field.
  • Validation generally happens on blur or change with some exceptions in types such as Address and Image for example where the events aren't as cut-and-dry.
  • By default our internal error messages are shown beneath the field on the blur event, so as not to pelt the user with errors on every keystroke.
  • When an error message can provide more info as to why it failed it does so. For example, async operations within the Address type.
  • Errors will continue to improve as OpenLaw Core eventually may move toward standardized error objects delivered to OpenLaw Client then onto OpenLaw Elements!

The onValidate Callback

  • The onValidate prop is a callback that allows a user to "hook into" the validation process of our fields.
  • It's up to the user how they want to organize their custom validation within the function (e.g. smaller functions, switch/case, if/else, etc.).
  • The parameter provdied to onValidate is an object of validation data which tells you the current status of the field you're editing or moving away from.
  • Custom validation data can be returned from the function which currently has the ability to customize or hide an error message (empty string) via { errorMessage: String }.
  • Error message timing can be altered within onValidate by detecting the eventType, and returning a message accordingly. For example, showing a special error on the change event of the Image type.

Below is a representation of the onValidate callback parameter. As necessary, we will iterate in future releases on this object to improve error handling for parent components.

FieldError {
	elementName: string,
	elementType: <All Valid OpenLaw Field Types>,
	errorMessage: string,
	eventType: 'blur' | 'change',
	isError: boolean,
	value: string | { file: File | void, value: string },
}

CSS

  • The Elements classNames are revamped to use the BEM style, with a base namespace (absolutely no style collisions on import), and are generally now very comprehensible.
  • The default styles have now changed and are possibly more generic for other MVP or startup apps who want to use our forms without the headache of re-styling.
  • In terms of UI, the styles are visually clearer and make the fields slightly more comprehensible.
  • UX imrovements were taken to improve the keyboard navigation of the fields from start to finish.
  • Internally, CSS classnames are Flowtyped so you can't just willy-nilly add your own. Helps us to think about classes more critically and hopefully avoid bloat. Works well especially since the lib is small.

Changes to onChangeFunction

  • The required onChangeFunction prop is now called each time the field changes, regardless of error. This improves the predicatbility of usage (before it was only called if things were OK) for the onChangeFunction callback and allows us to proactively respond to errors within the callback if needed (e.g. exit early, call error logging, etc.).
  • Validation data is now passed into the onChangeFunction(key: string, value: string, validationResult: FieldError) as the final argument.
  • The former force: boolean argument has been removed, as it is not necessary. This is/was specific to our OpenLaw app to do with YesNo type and our async updates to templates.

Tests

  • Coverage is now approximately 85%! I'd call that green.
  • jest-canvas-mock added for Image

Address

  • Slightly refactors how Address shows, creates and deletes addresses to play nice with our shiny error propagation.
  • Async operations now report if things go haywire
  • A new "Searching addresses..." now shows on search within the results box. This was not as easy as it should have been, Autosuggest (yeah, looking at you!).

Date

  • Date is now cleaner in the way it instantiates and destroys the flatpickr instance.
  • Bug fix: Dates in a Collection used to be mutated every time the Collection changed. No more! Via openlawteam/openlaw-core#176

Period

ARIA-Compatibility & Accessibility

  • Still embarrassing, but that's another release. Sorry!
  • Bonus: Keyboard-ing through the fields is much better tho! Especially for Address, Image and Date.

Package updates across the board

  • Except react-image-crop as it needs a migration path.

Example app

  • I got a little tired of scrolling up to check the rendered preview, so I changed the UI and UX of the example app (hopefully for the better - gosh!)
  • App was getting big; refactored the components of the example app into separate files. Sanity now in check.
  • Now you can toggle a feature called "Auto Run" to get constant updates to the rendered preview.
  • Removes bloated Collapsible Stackoverflow Special component - good riddance!

Eslint

  • New globals were added to stop nagging the test files using Node methods
  • Added a rule for flat ternary expressions, since the code makes use of nested ternaries for cleaner value evaluation logic. Flat ternaries make logic much more readable.

Types

  • New types added to increase our static typing "coverage". Catch those compilation errors!

v1.0.0-beta.28...v1.0.0

v1.0.0-beta.28

26 Jul 22:53
50e79e4
Compare
Choose a tag to compare
v1.0.0-beta.28 Pre-release
Pre-release
  • Added new element type: ExternalSignature (#69) f457ed8

v1.0.0-beta.27...v1.0.0-beta.28

v1.0.0-beta.27

12 Jul 08:11
Compare
Choose a tag to compare
v1.0.0-beta.27 Pre-release
Pre-release
  • Updates checkValidity to match new return type from openlaw
  • Fixes bug in Image where if savedValue was present, the Edit ... button would be disabled.
  • Better handling of Text onKeyUp validation inside a Collection
  • Adds more tests
  • Adds coverage npm script & coverage badge

v1.0.0-beta.26...v1.0.0-beta.27

v1.0.0-beta.26

10 Jul 06:40
Compare
Choose a tag to compare
v1.0.0-beta.26 Pre-release
Pre-release

v1.0.0-beta.25...v1.0.0-beta.26

v1.0.0-beta.25

09 Jul 15:56
846e3a5
Compare
Choose a tag to compare
v1.0.0-beta.25 Pre-release
Pre-release
  • bumps openlaw package to 0.2.12 (#64) b619028
  • Fixes DatePicker not responding to props changes (#63) e742412

v1.0.0-beta.24...v1.0.0-beta.25