Releases: openlawteam/openlaw-elements
Releases · openlawteam/openlaw-elements
v1.1.2
- 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.0
- fixes unused var lint (#95) 4d442f7
- rolls back np due to publish issue (sindresorhus/np#470) (#94) 4123023
- Dependency bumps (#93) a4ea8ee
- fixes defined process.env strings from webpack (#92) 8a93c64
- adds OPENLAW_INSTANCE_NAME to example and documentation (#91) 76494ef
- bumps openlaw devDep to 0.2.20 (#90) b28d958
- Feature: Extra text (#89) 3c90bf9
- fixes 3 package vulnerabilities (#88) e8aea14
- Bump rollup from 1.19.4 to 1.27.8 (#83) 17326ce
- Bump @babel/preset-env from 7.5.5 to 7.7.4 (#82) 7595fc9
- Bump webpack-dev-server from 3.8.0 to 3.9.0 (#85) 5a7b1a6
- Bump webpack from 4.39.2 to 4.41.2 (#86) e36b0bb
- style changes for image base styles; Fragment for wrapping ImageCrop (#87) b2aa11f
v1.0.2
v1.0.1
v1.0.0
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
orchange
with some exceptions in types such asAddress
andImage
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 theeventType
, and returning a message accordingly. For example, showing a special error on thechange
event of theImage
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 theonChangeFunction
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 withYesNo
type and our async updates to templates.
Tests
- Coverage is now approximately 85%! I'd call that green.
jest-canvas-mock
added forImage
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
- Bug fix: All-plural periods of time no more! Via openlawteam/openlaw-core#175
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
andDate
.
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-beta.27
- Updates checkValidity to match new return type from
openlaw
- Fixes bug in
Image
where ifsavedValue
was present, theEdit ...
button would be disabled. - Better handling of
Text
onKeyUp validation inside aCollection
- Adds more tests
- Adds coverage npm script & coverage badge