├── pattern-library ├── components │ ├── button │ │ ├── description.md │ │ └── default │ │ │ ├── description.md │ │ │ └── markup.html │ ├── label │ │ ├── description.md │ │ └── default │ │ │ ├── description.md │ │ │ └── markup.html │ ├── check-field │ │ ├── description.md │ │ ├── checkbox │ │ │ ├── description.md │ │ │ └── markup.html │ │ ├── radio │ │ │ ├── description.md │ │ │ └── markup.html │ │ └── error-state │ │ │ ├── description.md │ │ │ └── markup.html │ ├── input-field │ │ ├── tel │ │ │ ├── description.md │ │ │ └── markup.html │ │ ├── text │ │ │ ├── description.md │ │ │ └── markup.html │ │ ├── email │ │ │ ├── description.md │ │ │ └── markup.html │ │ ├── number │ │ │ ├── description.md │ │ │ └── markup.html │ │ ├── search │ │ │ ├── description.md │ │ │ └── markup.html │ │ ├── text-area │ │ │ ├── description.md │ │ │ └── markup.html │ │ ├── error-state │ │ │ ├── description.md │ │ │ └── markup.html │ │ └── description.md │ └── select-field │ │ ├── description.md │ │ ├── error-state │ │ ├── description.md │ │ └── markup.html │ │ └── select-menu │ │ ├── description.md │ │ └── markup.html ├── favicon.png ├── assets │ ├── js │ │ └── patterns.js │ └── images │ │ └── logo │ │ └── logo.svg ├── LICENSE.txt ├── data.json ├── app │ ├── js │ │ ├── main.min.js │ │ └── main.js │ └── css │ │ ├── styles.min.css │ │ └── styles.css └── index.html ├── .env.sample ├── astrum-config.json ├── dist ├── markup │ ├── button │ │ └── default │ │ │ └── markup.html │ ├── input-field │ │ ├── tel │ │ │ └── markup.html │ │ ├── text │ │ │ └── markup.html │ │ ├── error-state │ │ │ └── markup.html │ │ ├── number │ │ │ └── markup.html │ │ ├── search │ │ │ └── markup.html │ │ ├── text-area │ │ │ └── markup.html │ │ └── email │ │ │ └── markup.html │ ├── label │ │ └── default │ │ │ └── markup.html │ ├── check-field │ │ ├── checkbox │ │ │ └── markup.html │ │ ├── radio │ │ │ └── markup.html │ │ └── error-state │ │ │ └── markup.html │ └── select-field │ │ ├── select-menu │ │ └── markup.html │ │ └── error-state │ │ └── markup.html ├── css │ ├── boilerform.css.map │ ├── boilerform.min.css │ └── boilerform.css └── js │ ├── boilerform.min.js │ ├── boilerform.min.js.map │ ├── boilerform.js.map │ └── boilerform.js ├── .babelrc ├── .github ├── PULL_REQUEST_TEMPLATE.md └── ISSUE_TEMPLATE.md ├── .gitignore ├── assets ├── scss │ ├── layouts │ │ └── _l-form.scss │ ├── _functions.scss │ ├── mixins │ │ └── _namespace.scss │ ├── _helpers.scss │ ├── components │ │ ├── _c-input-field.scss │ │ ├── _c-label.scss │ │ ├── _c-button.scss │ │ ├── _c-select-field.scss │ │ └── _c-check-field.scss │ ├── boilerform.scss │ ├── _config.scss │ └── _reset.scss └── js │ ├── boilerform.js │ └── modules │ └── validation.js ├── .eslintrc ├── generator └── dist.js ├── LICENSE.txt ├── package.json ├── webpack.config.js ├── readme.md └── CONTRIBUTING.md /pattern-library/components/button/description.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pattern-library/components/label/description.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.env.sample: -------------------------------------------------------------------------------- 1 | CSS_OUTPUT_PATH= 2 | JS_OUTPUT_PATH= 3 | -------------------------------------------------------------------------------- /pattern-library/components/check-field/description.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pattern-library/components/button/default/description.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pattern-library/components/input-field/tel/description.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pattern-library/components/input-field/text/description.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pattern-library/components/label/default/description.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pattern-library/components/select-field/description.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /astrum-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "path": "pattern-library" 3 | } -------------------------------------------------------------------------------- /pattern-library/components/check-field/checkbox/description.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pattern-library/components/check-field/radio/description.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pattern-library/components/input-field/email/description.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pattern-library/components/input-field/number/description.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pattern-library/components/input-field/search/description.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pattern-library/components/input-field/text-area/description.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pattern-library/components/check-field/error-state/description.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pattern-library/components/input-field/error-state/description.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pattern-library/components/select-field/error-state/description.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pattern-library/components/select-field/select-menu/description.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dist/markup/button/default/markup.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["env"], 3 | "plugins": ["babel-plugin-add-module-exports"] 4 | } -------------------------------------------------------------------------------- /pattern-library/components/button/default/markup.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dist/markup/input-field/tel/markup.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dist/markup/input-field/text/markup.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pattern-library/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Andy-set-studio/boilerform/HEAD/pattern-library/favicon.png -------------------------------------------------------------------------------- /dist/css/boilerform.css.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":[],"names":[],"mappings":"","file":"../css/boilerform.css","sourceRoot":""} -------------------------------------------------------------------------------- /pattern-library/components/input-field/tel/markup.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pattern-library/components/input-field/text/markup.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dist/markup/input-field/error-state/markup.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dist/markup/input-field/number/markup.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dist/markup/input-field/search/markup.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dist/markup/input-field/text-area/markup.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dist/markup/label/default/markup.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /pattern-library/components/input-field/error-state/markup.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pattern-library/components/input-field/number/markup.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dist/markup/input-field/email/markup.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pattern-library/components/input-field/search/markup.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pattern-library/components/input-field/text-area/markup.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pattern-library/components/label/default/markup.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /pattern-library/components/input-field/email/markup.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pattern-library/components/input-field/description.md: -------------------------------------------------------------------------------- 1 | Generic input fields with variations for size, placeholders and validation states. Relevant attributes are added to help users input data as efficiently as possible. -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Fixes Issue # (Delete if not applicable) 2 | 3 | ## Proposed Changes 4 | 5 | - 6 | - 7 | - 8 | 9 | ## Add a GIF that demonstrates how this Pull Request makes you feel (optional) 10 | ![alt text](Path to image) -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Expected Behavior 2 | 3 | 4 | ## Actual Behavior 5 | 6 | 7 | ## Steps to Reproduce the Problem 8 | 9 | 1. 10 | 1. 11 | 1. 12 | 13 | ## Specifications 14 | 15 | - Version: 16 | - Platform: 17 | - Browser: 18 | - Environment/Url: -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Common 2 | node_modules 3 | .DS_Store 4 | .sass-cache 5 | *.log 6 | *.scssc 7 | npm-debug.* 8 | .env 9 | 10 | # Compiled assets 11 | pattern-library/assets/css 12 | 13 | # Ignore 'sandbox'. This is where you can play around with features etc 14 | sandbox/ 15 | -------------------------------------------------------------------------------- /pattern-library/assets/js/patterns.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var componentSamples = [].slice.call(document.querySelectorAll('.ndpl-component__sample')); 3 | 4 | if(componentSamples.length) { 5 | componentSamples.map(function(item) { 6 | item.classList.add('boilerform'); 7 | }); 8 | } 9 | }()); -------------------------------------------------------------------------------- /assets/scss/layouts/_l-form.scss: -------------------------------------------------------------------------------- 1 | /*------------------------------------*\ 2 | FORM LAYOUT 3 | 4 | The main form layout that gives 5 | you rythm, alignment and flow 6 | \*------------------------------------*/ 7 | $namespace: ".l-form"; 8 | 9 | #{ $namespace } { 10 | 11 | @include namespace() { 12 | 13 | } 14 | } -------------------------------------------------------------------------------- /dist/markup/check-field/checkbox/markup.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 |
-------------------------------------------------------------------------------- /pattern-library/components/check-field/checkbox/markup.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 |
-------------------------------------------------------------------------------- /assets/scss/_functions.scss: -------------------------------------------------------------------------------- 1 | /*------------------------------------*\ 2 | COLOR 3 | 4 | Pass in a group name and a key 5 | to get a value. 6 | 7 | E.G color(field, background) will return 8 | the background item in the field group. 9 | 10 | Colors are defined in $colors in _config.scss 11 | \*------------------------------------*/ 12 | @function color($group, $color) { 13 | @return map-get(map-get($colors, $group), $color); 14 | } -------------------------------------------------------------------------------- /dist/markup/select-field/select-menu/markup.html: -------------------------------------------------------------------------------- 1 |
2 | 9 | 10 |
-------------------------------------------------------------------------------- /dist/markup/select-field/error-state/markup.html: -------------------------------------------------------------------------------- 1 |
2 | 9 | 10 |
-------------------------------------------------------------------------------- /pattern-library/components/select-field/select-menu/markup.html: -------------------------------------------------------------------------------- 1 |
2 | 9 | 10 |
-------------------------------------------------------------------------------- /pattern-library/components/select-field/error-state/markup.html: -------------------------------------------------------------------------------- 1 |
2 | 9 | 10 |
-------------------------------------------------------------------------------- /assets/scss/mixins/_namespace.scss: -------------------------------------------------------------------------------- 1 | /*------------------------------------*\ 2 | NAMESPACE 3 | 4 | This mixin encapsulates CSS within 5 | a namespace to prevent outside 6 | conflicts as much as possible. 7 | \*------------------------------------*/ 8 | @mixin namespace($isRoot: false) { 9 | 10 | @if ($isRoot == true) { 11 | .boilerform { 12 | @content; 13 | } 14 | } 15 | @else { 16 | .boilerform & { 17 | @content; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "babel-eslint", 3 | "env": { 4 | "browser": true, 5 | "commonjs": true, 6 | "es6": true, 7 | "node": true 8 | }, 9 | "rules": { 10 | "no-const-assign": "warn", 11 | "no-this-before-super": "warn", 12 | "no-unreachable": "warn", 13 | "no-unused-vars": "warn", 14 | "constructor-super": "warn", 15 | "valid-typeof": "warn", 16 | "quotes": [2, "single", { "allowTemplateLiterals": true }] 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /assets/js/boilerform.js: -------------------------------------------------------------------------------- 1 | import Validation from './modules/validation'; 2 | 3 | // Import Sass so that webpack picks it up 4 | require('../scss/boilerform.scss'); 5 | 6 | (function() { 7 | 8 | // Look for child and root forms 9 | const boilerforms = [...document.querySelectorAll('.boilerform form, form.boilerform')]; 10 | 11 | if(boilerforms.length) { 12 | 13 | // Add a validator to each form instance 14 | boilerforms.map(item => { 15 | let validationInstance = new Validation(item); 16 | 17 | validationInstance.init(); 18 | }); 19 | } 20 | }()); 21 | -------------------------------------------------------------------------------- /generator/dist.js: -------------------------------------------------------------------------------- 1 | var findRemoveSync = require('find-remove'); 2 | var fs = require('fs'); 3 | var ncp = require('ncp'); 4 | var path = require('path'); 5 | var rimraf = require('rimraf'); 6 | 7 | // Delete the markup dist dir 8 | rimraf(path.join(__dirname, '../dist/markup'), function() { 9 | 10 | // Copy the components from the pattern lib 11 | ncp(path.join(__dirname, '../pattern-library/components'), path.join(__dirname, '../dist/markup'), function(error) { 12 | 13 | if(error) return console.log(error); 14 | 15 | // Remove all markdown files 16 | findRemoveSync(path.join(__dirname, '../dist/markup'), { extensions: '.md' }); 17 | }); 18 | }); -------------------------------------------------------------------------------- /assets/scss/_helpers.scss: -------------------------------------------------------------------------------- 1 | // All input fields share these styles. Also includes select menus 2 | %c-field-shared-inputs { 3 | background: color(field, background); 4 | border: 1px solid color(base, border); 5 | padding: $input-field-padding; 6 | border-radius: $border-radius; 7 | font-size: $input-field-font-size; 8 | } 9 | 10 | // Visually hide an element, but allow a screen-reader to see it 11 | %visually-hidden { 12 | display: block; 13 | height: 1px; 14 | width: 1px; 15 | overflow: hidden; 16 | clip: rect(1px 1px 1px 1px); 17 | clip: rect(1px, 1px, 1px, 1px); 18 | clip-path: inset(1px); 19 | white-space: nowrap; 20 | position: absolute; 21 | } 22 | -------------------------------------------------------------------------------- /dist/markup/check-field/radio/markup.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 |
6 |
7 | 8 | 9 | 10 |
-------------------------------------------------------------------------------- /dist/markup/check-field/error-state/markup.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 |
6 |
7 | 8 | 9 | 10 |
11 | -------------------------------------------------------------------------------- /pattern-library/components/check-field/radio/markup.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 |
6 |
7 | 8 | 9 | 10 |
-------------------------------------------------------------------------------- /pattern-library/components/check-field/error-state/markup.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 |
6 |
7 | 8 | 9 | 10 |
11 | -------------------------------------------------------------------------------- /assets/scss/components/_c-input-field.scss: -------------------------------------------------------------------------------- 1 | /*------------------------------------*\ 2 | INPUT FIELD COMPONENT 3 | 4 | All input based form field elements 5 | \*------------------------------------*/ 6 | $namespace: ".c-input-field"; 7 | 8 | #{ $namespace } { 9 | 10 | @include namespace() { 11 | 12 | @extend %c-field-shared-inputs; 13 | 14 | // Reduce right-hand padding for number inputs 15 | &[type="number"] { 16 | padding-right: #{ $input-field-padding / 2 }; 17 | } 18 | 19 | // Multiline fields like