diff --git a/.gitignore b/.gitignore index 00cbbdf..4bcd1b9 100644 --- a/.gitignore +++ b/.gitignore @@ -57,3 +57,5 @@ typings/ # dotenv environment variables file .env +# sass map +*.css.map diff --git a/CHANGELOG.md b/CHANGELOG.md index c63963c..b12ef63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,27 @@ -# semanticforms changelog +# Semantic Forms changelog ## Next version - Put your changes here... +## 4.0.0 + +- Breaking: Overhauled entire codebase to drive it using mostly CSS grid instead of flexbox. This makes everything more flexible overall and fit more designs better. However the CSS and markup changes will likely cause breaking changes to previous integrations, so when upgrading make some time to visually test all your pages to alter any CSS overrides you had in place accordingly. You also might want to make some markup changes to make use of new available classes to tweak the fit of individual form fields on specific forms. +- Altered fields to fit available space better at various screen sizes. +- Added multiple utility classes that define how wide inputs will span in the responsive layout. +- Added support for input type=image. +- Added support for secondary labels. +- Added styling for invalid form fields. +- Added asterisk that appears on required inputs. +- Improved accessibility considerably. Now has 100% Lighthouse score. +- Added feature to progressively nest fieldsets with progressively darker/lighter background colors. +- Fixed bug causing clear button appearing on disabled inputs. +- Fixed bug causing clear button to overlap with scrollbars on textareas. +- Fixed bug causing nested fieldset to have incorrect padding and margins. +- Fixed various other small bugs. +- Replaced the `less` CSS preprocessor with `sass`. +- Updated various dependencies. + ## 3.2.1 - Fixed a bug that could cause checkboxes and radio buttons to not submit their values to the server properly. @@ -59,7 +77,7 @@ ## 3.0.0 -- Removed defualt two column layout. Now defaults to as many columns as the container is wide. +- Removed default two column layout. Now defaults to as many columns as the container is wide. - Added `x2` class you can put on `dd` elements to double the width of a form. Does not apply on small screens. ## 2.1.2 diff --git a/README.md b/README.md index a8e9372..ad4fa60 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,23 @@ [![npm](https://img.shields.io/npm/v/semantic-forms.svg)](https://www.npmjs.com/package/semantic-forms) -A pattern library of forms based on semantic HTML enhanced with a modern UX. +A pattern library of attractive forms for your website with the following design goals: + +- Attractive, modern float label visual design. +- Responsive layout based on modern CSS grid technique. +- Clear fields. +- Light and dark mode. +- Invalid field styling. +- Good accessibility. +- Semantic HTML (no div soup). +- Uses a progressive enhancement approach so that core functionality and most of the features still work with JavaScript disabled. +- Sets no global styles and is scoped by a single class name `semanticForms` applied to `
``` +Then apply the JavaScript enhancements: + +```javascript +window.semanticForms() +``` + Then the CSS/JS enhancements to your forms will apply automatically, assuming the markup structure you use is one of the supported patterns. -This library also monitors changes to the DOM and will enhance any additional `semanticForms` forms you insert, but the monitoring may not be perfect. If you want to re-scan for new forms to enhance manually, simply call `window.semanticForms()`. If you only want to reinitialize one form instead of all of them, call `window.semanticForms.reinitialize(formName)`. +If you make changes to the DOM after Semantic Forms is activated and want to activate any additional `semanticForms` forms you insert, you can re-scan for new forms by calling `window.semanticForms()` again. If you only want to reinitialize one form instead of all of them, call `window.semanticForms.reinitialize(formElement)`. # Features -Overview of pattern library features: - ## Float label inputs -The float label input pattern is notoriously difficult to implement in a fashion that doesn't degrade HTML semantics or accessibility. This pattern library implements a solution that solves that problem. Your label doesn't need to be a sibling of your input like with other implementations. This implementation also has a custom clear field driven by SVG embedded in the CSS. +The float label input pattern is notoriously difficult to implement in a fashion that doesn't degrade HTML semantics or accessibility. This pattern library implements a solution that solves that problem. Your label doesn't need to be a sibling of your input like with other implementations. This implementation also has a custom clear button for each input. ### Example @@ -52,25 +69,141 @@ The float label input pattern is notoriously difficult to implement in a fashion ``` -If you would like to manipulate the size of the area on the input field reserved for the click event of the clear field, apply one or both of the following `data-` attributes to your form: +### Add help text -Adjust the horizontal offset of the clear field's click event click area (the default is 21): +Include a label in the `