semantic-forms 2.1.1 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/package.json +2 -2
- package/semanticForms.js +5 -3
package/README.md
CHANGED
|
@@ -22,6 +22,8 @@ Apply the `semanticForms` class to your `<form>` elements:
|
|
|
22
22
|
|
|
23
23
|
Then the CSS/JS enhancements to your forms will apply automatically.
|
|
24
24
|
|
|
25
|
+
If you add new forms to the DOM after the initial initialization, you can call the global `semanticForms` function to initialize new forms that have been added to the DOM since the initial initialization.
|
|
26
|
+
|
|
25
27
|
See `semanticForms.html` or the [live demo](https://kethinov.github.io/semanticforms/semanticForms.html) for a complete pattern library with examples of all UI patterns.
|
|
26
28
|
|
|
27
29
|
# Features
|
|
@@ -152,8 +154,8 @@ See `semanticForms.html` or the [live demo](https://kethinov.github.io/semanticf
|
|
|
152
154
|
# Contributing
|
|
153
155
|
|
|
154
156
|
- Fork/clone this repo.
|
|
155
|
-
- `npm
|
|
156
|
-
- Make your changes. If you want to alter the CSS, do the changes in `
|
|
157
|
+
- `npm ci`
|
|
158
|
+
- Make your changes. If you want to alter the CSS, do the changes in the `.less` files.
|
|
157
159
|
- `npm run build`. The build step compiles the LESS file into CSS.
|
|
158
160
|
- Test your changes by opening `semanticForms.html` in your browser.
|
|
159
161
|
- Commit, push, open pull request.
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "semantic-forms",
|
|
3
3
|
"description": "Semantic Forms",
|
|
4
4
|
"author": "Eric Newport <kethinov@gmail.com>",
|
|
5
|
-
"version": "2.1.
|
|
5
|
+
"version": "2.1.2",
|
|
6
6
|
"files": [
|
|
7
7
|
"semanticForms.css",
|
|
8
8
|
"semanticForms.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"dependencies": {},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"less": "4.1.3",
|
|
20
|
-
"standard": "17.
|
|
20
|
+
"standard": "17.1.0"
|
|
21
21
|
},
|
|
22
22
|
"scripts": {
|
|
23
23
|
"test": "echo \"TODO: tests\"",
|
package/semanticForms.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
window.semanticForms = function () {
|
|
2
2
|
// do some feature detection so none of the JS executes if the browser is too old
|
|
3
3
|
if (typeof document.getElementsByClassName !== 'function' || typeof document.querySelector !== 'function' || !document.body.classList) {
|
|
4
4
|
return
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
const forms = document.querySelectorAll('form.semanticForms')
|
|
7
|
+
const forms = document.querySelectorAll('form.semanticForms:not(.semanticFormsActive)')
|
|
8
8
|
const fl = forms.length
|
|
9
9
|
let f
|
|
10
10
|
let form
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
|
|
29
29
|
for (f = 0; f < fl; f++) {
|
|
30
30
|
form = forms[f]
|
|
31
|
+
form.classList.add('semanticFormsActive')
|
|
31
32
|
if (!form.classList.contains('lowFlow')) {
|
|
32
33
|
clearfieldHorizontalOffset = parseInt(form.getAttribute('data-clearfield-horizontal-offset')) || 21
|
|
33
34
|
clearfieldVerticalOffset = parseInt(form.getAttribute('data-clearfield-vertical-offset')) || 5
|
|
@@ -159,4 +160,5 @@
|
|
|
159
160
|
}
|
|
160
161
|
return true
|
|
161
162
|
}
|
|
162
|
-
}
|
|
163
|
+
}
|
|
164
|
+
window.semanticForms()
|