semantic-forms 5.0.7 → 5.0.8

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/CHANGELOG.md ADDED
@@ -0,0 +1,191 @@
1
+ ## 5.0.8
2
+
3
+ - Altered dark mode support so that it does not apply if the `<html>` or `<body>` tag has a class of `"light"`.
4
+ - Updated dependencies.
5
+
6
+ ## 5.0.7
7
+
8
+ - Fixed a bug where the responsive grid layout would not always line up correctly.
9
+ - Fixed a bug that prevented text from being longer than input element, causing graphical errors.
10
+ - Updated dependencies.
11
+
12
+ ## 5.0.6
13
+
14
+ - Added slicker live demo docs.
15
+ - Fixed a bug causing dark mode not to respect OS preference.
16
+ - Updated dependencies.
17
+
18
+ ## 5.0.5
19
+
20
+ - Added better error handling to the JS.
21
+ - Updated dependencies.
22
+
23
+ ## 5.0.4
24
+
25
+ - Fixed a periodic JS error.
26
+
27
+ ## 5.0.3
28
+
29
+ - Fixed a bug that prevented `semantic-forms` from detecting when you inserted new forms into the page.
30
+ - Updated dependencies.
31
+
32
+ ## 5.0.2
33
+
34
+ - Fixed a bug that would cause errors when `reinitialize()` was called.
35
+ - Fixed a bug that caused nested selects to lose their dropdown icon.
36
+ - Fixed a bug where required single checkboxes would not show an asterisk.
37
+ - Added a help text icon beside labels with a `title` attribute on their respective inputs, or on labels for checkboxes and radios. Enabled with a `data-show-help-icon` attribute.
38
+ - Updated various dependencies.
39
+
40
+ ## 5.0.1
41
+
42
+ - Fixed a bug that caused some devDependencies to end up in the production build.
43
+ - Updated various dependencies.
44
+
45
+ ## 5.0.0
46
+
47
+ - Breaking: Added JS module bundling to make it possible for you to import CJS, ESM, or a standalone version of the JavaScript in this library to your project. However you will need to change your imports to match the new file names. See README for details.
48
+ - Added show/hide toggle to password fields which can be disabled with a `data-no-reveal` attribute.
49
+ - Added hover text for the clear field button and the show/hide password button.
50
+ - Added ability to customize clear field button hover text and show/hide password button hover text using data attributes as well.
51
+ - Added support for undo/redo keyboard commands when pressing the clear field.
52
+ - Added test suite.
53
+ - Fixed some accessibility issues.
54
+ - Updated various dependencies.
55
+
56
+ ## 4.0.4
57
+
58
+ - Fixed a bug that caused menu items with buttons to appear as a list.
59
+ - Updated various dependencies.
60
+
61
+ ## 4.0.3
62
+
63
+ - Fixed bug in which a form entry consisting of a single checkbox would be misaligned.
64
+ - Fixed bug that prevented some inputs from expanding to the width of its container.
65
+ - Fixed bug in which CSS reset for elements within a semantic forms form was overly aggressive, making it harder to style unrelated content within such a form.
66
+ - Updated various dependencies.
67
+
68
+ ## 4.0.2
69
+
70
+ - Fixed a visual bug that occurred when single checkbox elements had extra elements included.
71
+ - Updated various dependencies.
72
+
73
+ ## 4.0.1
74
+
75
+ - Added invalid help text support.
76
+ - Fixed a bug that caused float labels to break when certain browser extensions were enabled.
77
+
78
+ ## 4.0.0
79
+
80
+ - 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.
81
+ - Altered fields to fit available space better at various screen sizes.
82
+ - Added multiple utility classes that define how wide inputs will span in the responsive layout.
83
+ - Added support for input type=image.
84
+ - Added support for secondary labels.
85
+ - Added styling for invalid form fields.
86
+ - Added asterisk that appears on required inputs.
87
+ - Improved accessibility considerably. Now has 100% Lighthouse score.
88
+ - Added feature to progressively nest fieldsets with progressively darker/lighter background colors.
89
+ - Fixed bug causing clear button appearing on disabled inputs.
90
+ - Fixed bug causing clear button to overlap with scrollbars on textareas.
91
+ - Fixed bug causing nested fieldset to have incorrect padding and margins.
92
+ - Fixed various other small bugs.
93
+ - Replaced the `less` CSS preprocessor with `sass`.
94
+ - Updated various dependencies.
95
+
96
+ ## 3.2.1
97
+
98
+ - Fixed a bug that could cause checkboxes and radio buttons to not submit their values to the server properly.
99
+ - Updated various dependencies.
100
+
101
+ ## 3.2.0
102
+
103
+ - Added a reinitialization method to re-scan existing forms. Called with `window.semanticForms.reinitialize(formName)`.
104
+ - Altered logic to enhance forms so that it now ignores inputs that have already been enhanced.
105
+ - Updated dependencies.
106
+
107
+ ## 3.1.0
108
+
109
+ - Added dark mode support.
110
+ - Deprecated "reset" versions and "no images" versions.
111
+ - Added mutation observer that 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, you may still need to call `window.semanticForms()`.
112
+ - Fixed a bug that caused DOM events to be duplicated when DOM elements are added dynamically after the first page load.
113
+ - Updated dependencies.
114
+
115
+ ## 3.0.8
116
+
117
+ - Fixed main export on case-sensitive file systems.
118
+ - Updated dependencies.
119
+
120
+ ## 3.0.7
121
+
122
+ - Fixed Chrome issue for forms with no placeholder.
123
+
124
+ ## 3.0.6
125
+
126
+ - Fixed missing files in npm package.
127
+
128
+ ## 3.0.5
129
+
130
+ - Added "reset" versions of the CSS files that set `all: unset;` before applying any semantic forms styles to help avoid conflicts with other CSS. There is a performance degradation to using this technique, so you should only use this if absolutely necessary.
131
+
132
+ ## 3.0.4
133
+
134
+ - Reduced size of select box text.
135
+
136
+ ## 3.0.3
137
+
138
+ - Fixed issue that prevented id selectors from allowing dots in the string.
139
+ - Fixed issue that prevented the clear field from dispatching an input event.
140
+
141
+ ## 3.0.2
142
+
143
+ - Added support for a single checkbox rather than a group of checkboxes.
144
+
145
+ ## 3.0.1
146
+
147
+ - Fixed alignment issue.
148
+
149
+ ## 3.0.0
150
+
151
+ - Removed default two column layout. Now defaults to as many columns as the container is wide.
152
+ - Added `x2` class you can put on `dd` elements to double the width of a form. Does not apply on small screens.
153
+
154
+ ## 2.1.2
155
+
156
+ - Added a function to the JS files's global scope called `semanticForms` that you can call to initialize new forms that have been added to the DOM since the initial initialization.
157
+ - Updated dependencies.
158
+
159
+ ## 2.1.1
160
+
161
+ - Fixed a situation that could lead to a JS error.
162
+ - Fix minor alignment issue.
163
+
164
+ ## 2.1.0
165
+
166
+ - Added all input types.
167
+ - Fixed clear field.
168
+ - Fixed markup mistakes in the examples.
169
+ - Fixed CSS to support `<menu>` elements correctly.
170
+ - Refactored the JavaScript to modernize it.
171
+ - Updated dependencies.
172
+
173
+ ## 2.0.0
174
+
175
+ - Replaced `<div class="buttonGroup">` with a `<menu>` element. You will need to refactor your HTML accordingly.
176
+ - Fixed alignment issue caused by browser engines changing their alignment calculations since the first release.
177
+ - Various other refactoring.
178
+ - Pinned deps.
179
+ - Updated dependencies.
180
+
181
+ ## 1.0.5
182
+
183
+ - Restricted JS events to target elements within `semanticForms` class form elements.
184
+ - Switched font sizes to % in case someone finds 16px too small and changes the default font size in the browser, these form fields will no longer stay fixed.
185
+ - Published to npm.
186
+ - Started CHANGELOG.
187
+ - Updated dependencies.
188
+
189
+ ## 1.0.4 and below
190
+
191
+ [Here be dragons](https://en.wikipedia.org/wiki/Here_be_dragons)...
@@ -0,0 +1,30 @@
1
+ # How to contribute to this project
2
+
3
+ ## Coding
4
+
5
+ - Fork/clone this repo.
6
+ - `npm ci`
7
+ - Make your changes. If you want to alter the CSS, do the changes in the `.scss` files.
8
+ - `npm run build`. The build step compiles the SCSS file into CSS.
9
+ - You can also run `npm run watch` automatically compiles the CSS file after a change is detected in the SCSS file.
10
+ - Test your changes by opening `semanticForms.html` in your browser.
11
+ - If you want to test your work on an actual HTTP server, run `npm run dev` or `npm run d`, and then visit http://localhost:3000/test/semanticForms
12
+ - Commit, push, open pull request.
13
+
14
+ ## Before opening a pull request
15
+
16
+ - Be sure all tests pass: `npm t`.
17
+ - Ensure 100% code coverage and write new tests if necessary: `npm run coverage`.
18
+ - Add your changes to `CHANGELOG.md`.
19
+
20
+ ## Release process
21
+
22
+ If you are a maintainer of this project, please follow the following release procedure:
23
+
24
+ - Merge all desired pull requests into master.
25
+ - Bump `package.json` to a new version and run `npm i` to generate a new `package-lock.json`.
26
+ - Alter CHANGELOG "Next version" section and stamp it with the new version.
27
+ - Paste contents of CHANGELOG into new version commit.
28
+ - Open and merge a pull request with those changes.
29
+ - Tag the merge commit as the a new release version number.
30
+ - Publish commit to npm.
@@ -26,7 +26,7 @@ form.semanticForms, form.semanticForms.light {
26
26
  }
27
27
 
28
28
  @media (prefers-color-scheme: dark) {
29
- form.semanticForms {
29
+ html:not(.light) body:not(.light) form.semanticForms {
30
30
  --formBackgroundColor: #555;
31
31
  --inputBackgroudColor: rgba(85,85,85,0.1);
32
32
  --formSubBackgroundColor: #2f2f2f;
@@ -46,11 +46,11 @@ form.semanticForms, form.semanticForms.light {
46
46
  --selectIcon: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='%23fff'%3E%3Cpolygon stroke='%23fff' points='0,0 100,0 50,50'/%3E%3C/svg%3E");
47
47
  --customResizer: url("data:image/svg+xml;utf8,%3Csvg width='20' height='20' viewBox='0 0 5.2916665 5.2916666' version='1.1' id='svg5' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3E%3Cdefs id='defs2' /%3E%3Cg id='layer1'%3E%3Cpath style='fill:%23c9c9c9;stroke:%23c9c9c9;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1' d='M 2.8245112,5.0994569 C 4.9396993,2.9842685 4.9396993,2.9842685 4.9396993,2.9842685' id='path1034' /%3E%3Cpath style='fill:%23c9c9c9;stroke:%23c9c9c9;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1' d='M 1.515747,5.0406977 C 4.8873304,1.6691138 4.8873304,1.6691138 4.8873304,1.6691138' id='path1034-1' /%3E%3Cpath style='fill:%23c9c9c9;stroke:%23c9c9c9;stroke-width:0.264583;stroke-linecap:butt;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:1' d='M 0.20657789,5.0909782 C 4.9312207,0.3663348 4.9312207,0.3663348 4.9312207,0.3663348' id='path1034-9' /%3E%3C/g%3E%3C/svg%3E");
48
48
  }
49
- form.semanticForms input::-webkit-calendar-picker-indicator {
49
+ html:not(.light) body:not(.light) form.semanticForms input::-webkit-calendar-picker-indicator {
50
50
  filter: invert(100%);
51
51
  }
52
52
  }
53
- form.semanticForms.dark {
53
+ html:not(.light) body:not(.light) form.semanticForms.dark {
54
54
  --formBackgroundColor: #555;
55
55
  --inputBackgroudColor: rgba(85,85,85,0.1);
56
56
  --formSubBackgroundColor: #2f2f2f;
@@ -70,7 +70,7 @@ form.semanticForms.dark {
70
70
  --selectIcon: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='%23fff'%3E%3Cpolygon stroke='%23fff' points='0,0 100,0 50,50'/%3E%3C/svg%3E");
71
71
  --customResizer: url("data:image/svg+xml;utf8,%3Csvg width='20' height='20' viewBox='0 0 5.2916665 5.2916666' version='1.1' id='svg5' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3E%3Cdefs id='defs2' /%3E%3Cg id='layer1'%3E%3Cpath style='fill:%23c9c9c9;stroke:%23c9c9c9;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1' d='M 2.8245112,5.0994569 C 4.9396993,2.9842685 4.9396993,2.9842685 4.9396993,2.9842685' id='path1034' /%3E%3Cpath style='fill:%23c9c9c9;stroke:%23c9c9c9;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1' d='M 1.515747,5.0406977 C 4.8873304,1.6691138 4.8873304,1.6691138 4.8873304,1.6691138' id='path1034-1' /%3E%3Cpath style='fill:%23c9c9c9;stroke:%23c9c9c9;stroke-width:0.264583;stroke-linecap:butt;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:1' d='M 0.20657789,5.0909782 C 4.9312207,0.3663348 4.9312207,0.3663348 4.9312207,0.3663348' id='path1034-9' /%3E%3C/g%3E%3C/svg%3E");
72
72
  }
73
- form.semanticForms.dark input::-webkit-calendar-picker-indicator {
73
+ html:not(.light) body:not(.light) form.semanticForms.dark input::-webkit-calendar-picker-indicator {
74
74
  filter: invert(100%);
75
75
  }
76
76
 
@@ -1 +1 @@
1
- {"version":3,"sourceRoot":"","sources":["../semanticForms.scss"],"names":[],"mappings":"AACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AA4BF;EACE;IAzBA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAEA;IACE;;;AAUJ;EA9BE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;;AAeJ;EACE;EACA;EACA;EACA;EACA;EACA;;AAGA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAYE;EACA;EACA;EACA;EACA;;AAIF;AAAA;AAAA;AAAA;AAAA;EAGE;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;AAAA;AAAA;AAAA;AAAA;EACE;;AAGF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EACE;;AAGF;AAAA;AAAA;AAAA;AAAA;EACE;EACA;;AAEA;AAAA;AAAA;AAAA;AAAA;EACE;;AAGF;AAAA;AAAA;AAAA;AAAA;EACE;;AAUJ;AAAA;AAAA;AAAA;AAAA;EACE;EACA;;AAIJ;AAAA;AAAA;EAEE;;AAIF;EACE;EACA;EACA;;AAGF;AAAA;AAAA;EAGE;EACA;EACA;EACA;;AAEA;AAAA;AAAA;EACE;;AAIJ;EACE;EACA;;AAGF;EACE;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;;AAKF;EACE;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EAC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A;AAAA;AAAA;AAAA;AAAA;IAIE;;EAGF;IACE;;EAGF;IAME;;EAEA;IAEE;;EAGF;IAEE;;EAGF;IAEE;;;AAKN;EACE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;IAME;;EAGF;AAAA;AAAA;AAAA;AAAA;IAGE;;EAGF;IAQE;;EAEA;IAEE;;EAGF;IAEE;;;AAKN;EACE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;IASE;;EAGF;IACE;;EAGF;IAUE;;EAEA;IAEE;;;AASN;EACE;EACA;EACA;;AAEA;EACG;;AAIC;EACE;EACA;;AAMN;EACE;EACA;;AAIE;EACE;;AAKJ;AAAA;AAAA;AAAA;AAAA;EAGE;;AAIF;EACE;EACA;EACA;;AAKN;AAAA;AAAA;EAEE","file":"semantic-forms.css"}
1
+ {"version":3,"sourceRoot":"","sources":["../semanticForms.scss"],"names":[],"mappings":"AACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AA4BF;EAGM;IA3BJ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAEA;IACE;;;AAgBA;EApCF;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;;AAuBJ;EACE;EACA;EACA;EACA;EACA;EACA;;AAGA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAYE;EACA;EACA;EACA;EACA;;AAIF;AAAA;AAAA;AAAA;AAAA;EAGE;E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AA;EAYE;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGA;EACE;EACA;;AAGA;AAAA;AAAA;AAAA;AAAA;EAGE;;AAKN;EACE;;AAGF;EACE;;AAIF;EACE;IACE;;EAEA;IACE;IACA;IACA;IACA;IACA;IACA;;;AAON;EACE;EACA;EACA;EACA;;AAEA;EACE;;AAEA;EACE;EACA;;AAGA;EACE;EACA;;AAGF;EACE;EACA;;AAEA;EACE;;AAKN;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;;AAQN;EACE;EACA;EACA;;AAIF;EACE;EACA;EACA;EACA;;AAIJ;AAAA;AAAA;EAEE;EACA;EACA;EACA;EACA;;AAMF;AAAA;AAAA;EAGE;EACA;;AAEA;AAAA;AAAA;EACE;EACA;EACA;;AAGF;AAAA;AAAA;EACE;EACA;;AAKF;EACE;EACA;EACA;EACA;;AAMI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAEE;EACA;;AAIJ;EAEE;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;;AAIF;EACE;EACA;EACA;EACA;;AAGF;AAAA;AAAA;AAAA;AAAA;EAGE;;AAGF;AAAA;AAAA;EAEE;;AAEA;AAAA;AAAA;EACE;EACA;;AAGF;AAAA;AAAA;EACE;EACA;;AAGF;AAAA;AAAA;EACE;EACA;;AAGF;AAAA;AAAA;EACE;EACA;;AAKA;AAAA;AAAA;EACE;;AAGF;AAAA;AAAA;EACE;;AAGF;AAAA;AAAA;EACE;;AAGF;AAAA;AAAA;EACE;;AAKN;EACE;EACA;EACA;;AAEA;EACE;EACA;EACA;;AAGF;EACE;EACA;;AAMN;EACE;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;;AAOF;EACE;EACA;EACA;EACA;;AAQN;EACE;EACA;;AASF;EACE;;AAGF;EACE;;AAGF;EACE;;AAGF;EACE;;AAGF;EACE;;AAGF;EACE;;AAGF;EACE;;AAMF;AAAA;AAAA;EACE;;AAIJ;AAAA;AAAA;EAEE;;AAGF;AAAA;AAAA;EAEE;;AAGF;AAAA;AAAA;EAEE;;AAIF;AAAA;AAAA;EAEE;;AAGF;AAAA;AAAA;EAEE;;AAGF;AAAA;AAAA;EAEE;;AAMF;EACE;IAEE;;EAEA;IAEE;;EAGF;IAEE;;EAGF;IAEE;;EAGF;IAEE;;EAGF;IAEE;;EAGF;IAEE;;;AAKN;EACE;IAEE;;EAEA;IAEE;;EAGF;IAEE;;EAGF;IAEE;;EAGF;IAEE;;EAGF;IAEE;;;AAKN;EACE;AAAA;AAAA;IAEE;;EAGF;IACE;;EAGF;IAIE;;EAEA;IAEE;;EAGF;IAEE;;EAGF;IAEE;;EAGF;IAEE;;;AAKN;EACE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;IAIE;;EAGF;IACE;;EAGF;IAME;;EAEA;IAEE;;EAGF;IAEE;;EAGF;IAEE;;;AAKN;EACE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;IAME;;EAGF;AAAA;AAAA;AAAA;AAAA;IAGE;;EAGF;IAQE;;EAEA;IAEE;;EAGF;IAEE;;;AAKN;EACE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;IASE;;EAGF;IACE;;EAGF;IAUE;;EAEA;IAEE;;;AASN;EACE;EACA;EACA;;AAEA;EACG;;AAIC;EACE;EACA;;AAMN;EACE;EACA;;AAIE;EACE;;AAKJ;AAAA;AAAA;AAAA;AAAA;EAGE;;AAIF;EACE;EACA;EACA;;AAKN;AAAA;AAAA;EAEE","file":"semantic-forms.css"}
@@ -0,0 +1,25 @@
1
+ <include src="layouts/main">
2
+ <arg pageTitle>Semantic Forms</arg>
3
+ <arg pageContent>
4
+ <article>
5
+ <p><a href="https://www.npmjs.com/package/semantic-forms" rel="nofollow"><img src="https://camo.githubusercontent.com/2d457be17e5ab897546fc268ed46e55e54f9c8750c4cafe5fa44101461a19eb4/68747470733a2f2f696d672e736869656c64732e696f2f6e706d2f762f73656d616e7469632d666f726d732e737667" alt="npm"></a> 🎯 <strong>semantic-forms</strong></p>
6
+
7
+ <p>A pattern library of attractive forms for your website with the following design goals:</p>
8
+
9
+ <ul>
10
+ <li>Attractive, modern float label visual design.</li>
11
+ <li>Responsive layout based on modern CSS grid technique.</li>
12
+ <li>Clear fields.</li>
13
+ <li>Light and dark mode.</li>
14
+ <li>Invalid field styling.</li>
15
+ <li>Good accessibility.</li>
16
+ <li>Semantic HTML (no div soup).</li>
17
+ <li>Uses a progressive enhancement approach so that core functionality and most of the features still work with JavaScript disabled.</li>
18
+ <li>Sets no global styles and is scoped by a single class name <code>semanticForms</code> applied to <code><!--#<form>--></code> elements.</li>
19
+ <li>No dependencies.</li>
20
+ </ul>
21
+
22
+ <p>This module was built and is maintained by the <a href="https://rooseveltframework.org">Roosevelt web framework team</a>, but it can be used independently of Roosevelt as well.</p>
23
+ </article>
24
+ </arg>
25
+ </include>
@@ -0,0 +1,33 @@
1
+ <!DOCTYPE html> <!--! roosevelt-blocklist (this comment prevents the template from being exposed publicly) -->
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <meta name="format-detection" content="telephone=no">
7
+ <title>Semantic Forms documentation</title>
8
+ <meta name="description" content="Describe your website here">
9
+ <!--! this inline script makes it possible for check-if-CSS-is-disabled to listen for any CSS files that fail to load -->
10
+ <script>window.addEventListener('error', (event) => { if (event?.target?.tagName === 'LINK') { window.linkTagError = true } }, true)</script>
11
+ <link rel="preload" href="/css/styles.css" as="style">
12
+ <link rel="preload" href="/js/main.js" as="script">
13
+ <link rel="stylesheet" href="/css/styles.css">
14
+ <link rel="stylesheet" href="/css/highlight.js.light.css">
15
+ <link rel="stylesheet" href="/css/highlight.js.dark.css" media="(prefers-color-scheme: dark)">
16
+ <script src="/js/main.js" defer></script>
17
+ </head>
18
+ <body class="no-js" id="semantic-forms-usage">
19
+ <main>
20
+ <header>
21
+ <h1>Semantic Forms</h1>
22
+ <h2>documentation</h2>
23
+ </header>
24
+ <nav>
25
+ <ul>
26
+ <li><a href="/index.html">About</a></li>
27
+ <li><a href="/usage.html">Usage</a></li>
28
+ </ul>
29
+ </nav>
30
+ {pageContent|s}
31
+ </main>
32
+ </body>
33
+ </html>
@@ -0,0 +1,523 @@
1
+ <include src="layouts/main">
2
+ <arg pageTitle>Semantic Forms — usage</arg>
3
+ <arg pageContent>
4
+ <article>
5
+ <h2 id="install">Install</h2>
6
+
7
+ <p><code>npm install semantic-forms</code></p>
8
+
9
+ <p>The package is distributed with the following builds available:</p>
10
+
11
+ <ul>
12
+ <li><code>dist/semantic-forms.cjs</code>: CommonJS bundle: <code>const semanticForms = require('semantic-forms')</code></li>
13
+ <li><code>dist/semantic-forms.js</code>: Standalone bundle that can be included via <code><!--#<script>--></code> tags. Declares a global variable called: <code>semanticForms</code></li>
14
+ <li><code>dist/semantic-forms.min.js</code>: Minified standalone bundle that can be included via <code><!--#<p>--></code> tags. Declares a global variable called: <code>semanticForms</code></li>
15
+ <li><code>dist/semantic-forms.mjs</code>: ES module: <code>import semanticForms from 'semantic-forms'</code></li>
16
+ <li><code>dist/semantic-forms.min.mjs</code>: Minified ES module: <code>import semanticForms from 'semantic-forms/min'</code></li>
17
+ </ul>
18
+
19
+ <h2 id="use">Use</h2>
20
+
21
+ <p>Include the <code>dist/semantic-forms.css</code> and whichever of the above versions of the JS file you prefer from this repo into your project.</p>
22
+
23
+ <p>Then apply the <code>semanticForms</code> class to your <code><!--#<form>--></code> elements:</p>
24
+
25
+ <pre><code class="language-html"><escape>
26
+ <form class="semanticForms">
27
+ <!-- your form here -->
28
+ </form>
29
+ </escape></code></pre>
30
+
31
+ <p>Then apply the JavaScript enhancements:</p>
32
+
33
+ <pre><code class='language-javascript'>semanticForms()</code></pre>
34
+
35
+ <p>Then the CSS/JS enhancements to your forms will apply automatically, assuming the markup structure you use is one of the supported patterns.</p>
36
+
37
+ <p>If you make changes to the DOM after Semantic Forms is activated and want to activate any additional <code>semanticForms</code> forms you insert, you can re-scan for new forms by calling <code>semanticForms.reinitialize()</code> again. If you only want to reinitialize one form instead of all of them, call <code>semanticForms.reinitialize(formElement)</code>.</p>
38
+
39
+ <h3 id="features">Features</h3>
40
+
41
+ <h4 id="floatlabel">Float label inputs</h4>
42
+
43
+ <p>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.</p>
44
+
45
+ <h5 id="floatlabelex">Example</h5>
46
+
47
+ <pre><code class='language-html' lang='html'><escape>
48
+ <form class="semanticForms">
49
+ <dl>
50
+ <dt><label for="name">Name</label></dt>
51
+ <dd><input id="name" name="name" type="text" placeholder="e.g. John Smith"></dd>
52
+ </dl>
53
+ </form>
54
+ </escape></code></pre>
55
+
56
+ <form class="semanticForms">
57
+ <dl>
58
+ <dt><label for="name">Name</label></dt>
59
+ <dd><input id="name" name="name" type="text" placeholder="e.g. John Smith"></dd>
60
+ </dl>
61
+ </form>
62
+
63
+ <h5 id="floatlabelextextarea">Or with a <code><!--#<textarea>--></code></h5>
64
+
65
+ <pre><code class='language-html' lang='html'><escape>
66
+ <form class="semanticForms">
67
+ <dl>
68
+ <dt><label for="textarea">Textarea</label></dt>
69
+ <dd><textarea id="textarea" name="textarea" rows="5" cols="50" placeholder="e.g. Long string of text"></textarea></dd>
70
+ </dl>
71
+ </form>
72
+ </escape></code></pre>
73
+
74
+ <form class="semanticForms">
75
+ <dl>
76
+ <dt><label for="textarea">Textarea</label></dt>
77
+ <dd><textarea id="textarea" name="textarea" rows="5" cols="50" placeholder="e.g. Long string of text"></textarea></dd>
78
+ </dl>
79
+ </form>
80
+
81
+ <h5 id="addhelptext">Add help text</h5>
82
+
83
+ <p>Include a label in the <code><!--#<dd>--></code> element with a matching <code>for</code> attribute to place help text beneath the input:</p>
84
+
85
+ <pre><code class='language-html' lang='html'><escape>
86
+ <form class="semanticForms">
87
+ <dl>
88
+ <dt><label for="password">Password</label></dt>
89
+ <dd>
90
+ <input id="password" name="password" type="password" placeholder="Enter a password" minlength="8" required>
91
+ <label for="password">Must be at least 8 characters long.</label>
92
+ </dd>
93
+ </dl>
94
+ </form>
95
+ </escape></code></pre>
96
+
97
+ <form class="semanticForms">
98
+ <dl>
99
+ <dt><label for="password">Password</label></dt>
100
+ <dd>
101
+ <input id="password" name="password" type="password" placeholder="Enter a password" minlength="8" required>
102
+ <label for="password">Must be at least 8 characters long.</label>
103
+ </dd>
104
+ </dl>
105
+ </form>
106
+
107
+ <h5 id="custominputfields">Customizing input fields</h5>
108
+
109
+ <p>By default, input fields will display an X icon to clear the text and password fields will also display a show/hide toggle for displaying the password in plain text. You can customize this behavior as follows:</p>
110
+
111
+ <ul>
112
+ <li><p>Customize the hover text of the clear field button by applying a <code>data-clear-field-text=&quot;your text&quot;</code> attribute to the input.</p></li>
113
+ <li><p>Customize the hover text of the show password button by applying a <code>data-show-password-text=&quot;your text&quot;</code> attribute to the input.</p></li>
114
+ <li><p>Customize the hover text of the hide password button by applying a <code>data-hide-password-text=&quot;your text&quot;</code> attribute to the input.</p></li>
115
+ <li><p>Prevent the show/hide toggle from appearing on password fields by applying a <code>data-no-reveal</code> attribute to the input.</p></li>
116
+ <li>
117
+ <p>Show a help text icon next to labels of inputs that contain a <code>title</code> attribute by applying a <code>data-show-help-icon</code> attribute to the label.</p>
118
+ <ul>
119
+ <li>Note that checkboxes and radios should have a <code>title</code> attribute on the label instead of the inputs.</li>
120
+ </ul>
121
+ </li>
122
+ </ul>
123
+
124
+ <h4 id="responsivecolumns">Responsive columns</h4>
125
+
126
+ <p>This feature makes it so the form fields will grow, shrink, expand the number of columns, or reduce the number of columns based on how much space exists in the container. You can customize it by applying various <code>colspan-#</code> classes to various elements in the form markup structure.</p>
127
+
128
+ <h5 id="colspan">Set number of columns for a group of forms</h5>
129
+
130
+ <p>You can limit the number of columns on your forms using the <code>colspan-#</code> class on a <code><!--#<dl>--></code> element:</p>
131
+
132
+ <pre><code class='language-html' lang='html'><escape>
133
+ <form class="semanticForms">
134
+ <dl class="colspan-2">
135
+ <dt><label for="input-a">Input A</label></dt>
136
+ <dd><input type="text" id="input-a" name="input-a"></dd>
137
+
138
+ <dt><label for="input-b">Input B</label></dt>
139
+ <dd><input type="text" id="input-b" name="input-b"></dd>
140
+
141
+ <!-- wraps to the next row -->
142
+ <dt><label for="input-c">Input C</label></dt>
143
+ <dd><input type="text" id="input-c" name="input-c"></dd>
144
+ </dl>
145
+ </form>
146
+ </escape></code></pre>
147
+
148
+ <form class="semanticForms">
149
+ <dl class="colspan-2">
150
+ <dt><label for="input-a">Input A</label></dt>
151
+ <dd><input type="text" id="input-a" name="input-a"></dd>
152
+
153
+ <dt><label for="input-b">Input B</label></dt>
154
+ <dd><input type="text" id="input-b" name="input-b"></dd>
155
+
156
+ <!-- wraps to the next row -->
157
+ <dt><label for="input-c">Input C</label></dt>
158
+ <dd><input type="text" id="input-c" name="input-c"></dd>
159
+ </dl>
160
+ </form>
161
+
162
+ <p>You can also apply the class to a <code><!--#<fieldset>--></code> which will apply that styling to all nested <code><!--#<dl>--></code> elements:</p>
163
+
164
+ <pre><code class='language-html' lang='html'><escape>
165
+ <form class="semanticForms">
166
+ <fieldset class="colspan-3">
167
+ <!-- inherits 3 column class -->
168
+ <dl>
169
+ <dt><label for="f-ex-input-a">Input A</label></dt>
170
+ <dd><input type="text" id="f-ex-input-a" name="f-ex-input-a"></dd>
171
+
172
+ <dt><label for="f-ex-input-b">Input B</label></dt>
173
+ <dd><input type="text" id="f-ex-input-b" name="f-ex-input-b"></dd>
174
+
175
+ <dt><label for="f-ex-input-c">Input C</label></dt>
176
+ <dd><input type="text" id="f-ex-input-c" name="f-ex-input-c"></dd>
177
+ </dl>
178
+
179
+ <!-- has 4 columns -->
180
+ <dl class="colspan-4">
181
+ <dt><label for="f-ex-input-d">Input D</label></dt>
182
+ <dd><input type="text" id="f-ex-input-d" name="f-ex-input-d"></dd>
183
+
184
+ <dt><label for="f-ex-input-e">Input E</label></dt>
185
+ <dd><input type="text" id="f-ex-input-e" name="f-ex-input-e"></dd>
186
+
187
+ <dt><label for="f-ex-input-f">Input F</label></dt>
188
+ <dd><input type="text" id="f-ex-input-f" name="f-ex-input-f"></dd>
189
+ </dl>
190
+ </fieldset>
191
+ </form>
192
+ </escape></code></pre>
193
+
194
+ <form class="semanticForms">
195
+ <fieldset class="colspan-3">
196
+ <!-- inherits 3 column class -->
197
+ <dl>
198
+ <dt><label for="f-ex-input-a">Input A</label></dt>
199
+ <dd><input type="text" id="f-ex-input-a" name="f-ex-input-a"></dd>
200
+
201
+ <dt><label for="f-ex-input-b">Input B</label></dt>
202
+ <dd><input type="text" id="f-ex-input-b" name="f-ex-input-b"></dd>
203
+
204
+ <dt><label for="f-ex-input-c">Input C</label></dt>
205
+ <dd><input type="text" id="f-ex-input-c" name="f-ex-input-c"></dd>
206
+ </dl>
207
+
208
+ <!-- has 4 columns -->
209
+ <dl class="colspan-4">
210
+ <dt><label for="f-ex-input-d">Input D</label></dt>
211
+ <dd><input type="text" id="f-ex-input-d" name="f-ex-input-d"></dd>
212
+
213
+ <dt><label for="f-ex-input-e">Input E</label></dt>
214
+ <dd><input type="text" id="f-ex-input-e" name="f-ex-input-e"></dd>
215
+
216
+ <dt><label for="f-ex-input-f">Input F</label></dt>
217
+ <dd><input type="text" id="f-ex-input-f" name="f-ex-input-f"></dd>
218
+ </dl>
219
+ </fieldset>
220
+ </form>
221
+
222
+ <h5 id="setcolspannumber">Set number of columns a single input field takes up</h5>
223
+
224
+ <p>You can specify the number of columns an input will span using the <code>colspan-#</code> class on the <code><!--#<dd>--></code> element. The inputs are responsive and will shrink according to available space. Available numbered classes are <code>colspan-1</code> through <code>colspan-5</code>:</p>
225
+
226
+ <pre><code class='language-html' lang='html'><escape>
227
+ <form class="semanticForms">
228
+ <fieldset>
229
+ <dl>
230
+ <dt><label for="cspan-ex-input-a">Input A</label></dt>
231
+ <!-- 1 column -->
232
+ <dd class="colspan-1"><input type="text" id="cspan-ex-input-a" name="cspan-ex-input-a"></dd>
233
+
234
+ <dt><label for="cspan-ex-input-b">Input B</label></dt>
235
+ <!-- 2 columns -->
236
+ <dd class="colspan-2"><input type="text" id="cspan-ex-input-b" name="cspan-ex-input-b"></dd>
237
+
238
+ <dt><label for="cspan-ex-input-c">Input C</label></dt>
239
+ <!-- 5 columns (max) -->
240
+ <dd class="colspan-5"><input type="text" id="cspan-ex-input-c" name="cspan-ex-input-c"></dd>
241
+ </dl>
242
+ </fieldset>
243
+ </form>
244
+ </escape></code></pre>
245
+
246
+ <form class="semanticForms">
247
+ <fieldset>
248
+ <dl>
249
+ <dt><label for="cspan-ex-input-a">Input A</label></dt>
250
+ <!-- 1 column -->
251
+ <dd class="colspan-1"><input type="text" id="cspan-ex-input-a" name="cspan-ex-input-a"></dd>
252
+
253
+ <dt><label for="cspan-ex-input-b">Input B</label></dt>
254
+ <!-- 2 columns -->
255
+ <dd class="colspan-2"><input type="text" id="cspan-ex-input-b" name="cspan-ex-input-b"></dd>
256
+
257
+ <dt><label for="cspan-ex-input-c">Input C</label></dt>
258
+ <!-- 5 columns (max) -->
259
+ <dd class="colspan-5"><input type="text" id="cspan-ex-input-c" name="cspan-ex-input-c"></dd>
260
+ </dl>
261
+ </fieldset>
262
+ </form>
263
+
264
+ <p><code>colspan-full</code> can also be used to force an input to take up the entire width of a form:</p>
265
+
266
+ <pre><code class='language-html' lang='html'><escape>
267
+ <form class="semanticForms">
268
+ <fieldset>
269
+ <dl>
270
+ <dt><label for="cspanfull-ex-input-a">Input A</label></dt>
271
+ <!-- this spans 2 columns on row 1 -->
272
+ <dd class="colspan-2"><input type="text" id="cspanfull-ex-input-a" name="cspanfull-ex-input-a"></dd>
273
+
274
+ <dt><label for="cspanfull-ex-input-b">Input B</label></dt>
275
+ <!-- this spans the full width of row 2 -->
276
+ <dd class="colspan-full"><input type="text" id="cspanfull-ex-input-b" name="cspanfull-ex-input-b"></dd>
277
+
278
+ <!-- this spans 1 column on row 3 -->
279
+ <dt><label for="cspanfull-ex-input-c">Input C</label></dt>
280
+ <dd><input type="text" id="cspanfull-ex-input-c" name="cspanfull-ex-input-c"></dd>
281
+ </dl>
282
+ </fieldset>
283
+ </form>
284
+ </escape></code></pre>
285
+
286
+ <form class="semanticForms">
287
+ <fieldset>
288
+ <dl>
289
+ <dt><label for="cspanfull-ex-input-a">Input A</label></dt>
290
+ <!-- this spans 2 columns on row 1 -->
291
+ <dd class="colspan-2"><input type="text" id="cspanfull-ex-input-a" name="cspanfull-ex-input-a"></dd>
292
+
293
+ <dt><label for="cspanfull-ex-input-b">Input B</label></dt>
294
+ <!-- this spans the full width of row 2 -->
295
+ <dd class="colspan-full"><input type="text" id="cspanfull-ex-input-b" name="cspanfull-ex-input-b"></dd>
296
+
297
+ <!-- this spans 1 column on row 3 -->
298
+ <dt><label for="cspanfull-ex-input-c">Input C</label></dt>
299
+ <dd><input type="text" id="cspanfull-ex-input-c" name="cspanfull-ex-input-c"></dd>
300
+ </dl>
301
+ </fieldset>
302
+ </form>
303
+
304
+ <h4 id="buttongroups">Button groups</h4>
305
+
306
+ <p>You can align buttons side-by-side, or in left/right/center groups.</p>
307
+
308
+ <h5 id="nongroupedbuttons">Non-grouped example</h5>
309
+
310
+ <p>Nothing fancy here:</p>
311
+
312
+ <pre><code class='language-html' lang='html'><escape>
313
+ <form class="semanticForms">
314
+ <button type="submit" name="submit">Non-grouped submit button</button>
315
+ <button type="submit" name="submit">Another one</button>
316
+ </form>
317
+ </escape></code></pre>
318
+
319
+ <form class="semanticForms">
320
+ <button type="submit" name="submit">Non-grouped submit button</button>
321
+ <button type="submit" name="submit">Another one</button>
322
+ </form>
323
+
324
+ <h6 id="buttongroupex">Button groups</h6>
325
+
326
+ <p>Driven by flexbox to intelligently align the buttons based on how many are in the group:</p>
327
+
328
+ <pre><code class='language-html' lang='html'><escape>
329
+ <form class="semanticForms">
330
+ <!-- aligns left/right -->
331
+ <menu>
332
+ <li><button type="submit" name="submit">Button 1</button></li>
333
+ <li><button type="submit" name="submit">Button 2</button></li>
334
+ </menu>
335
+
336
+ <!-- aligns left/center/right -->
337
+ <menu>
338
+ <li><button type="submit" name="submit">Button 1</button></li>
339
+ <li><button type="submit" name="submit">Button 2</button></li>
340
+ <li><button type="submit" name="submit">Button 3</button></li>
341
+ </menu>
342
+ </form>
343
+ </escape></code></pre>
344
+
345
+ <form class="semanticForms">
346
+ <!-- aligns left/right -->
347
+ <menu>
348
+ <li><button type="submit" name="submit">Button 1</button></li>
349
+ <li><button type="submit" name="submit">Button 2</button></li>
350
+ </menu>
351
+
352
+ <!-- aligns left/center/right -->
353
+ <menu>
354
+ <li><button type="submit" name="submit">Button 1</button></li>
355
+ <li><button type="submit" name="submit">Button 2</button></li>
356
+ <li><button type="submit" name="submit">Button 3</button></li>
357
+ </menu>
358
+ </form>
359
+
360
+ <h4 id="checkboxesandradios">Checkboxes and radio buttons</h4>
361
+
362
+ <p>Checkboxes and radio buttons need to follow the following markup structure:</p>
363
+
364
+ <h5 id="singlecheckbox">A single checkbox</h5>
365
+
366
+ <p>Not too different than other inputs:</p>
367
+
368
+ <pre><code class='language-html' lang='html'><escape>
369
+ <form class="semanticForms">
370
+ <dl>
371
+ <dt><label for="some_field_name">Single checkbox</label></dt>
372
+ <dd><input type="checkbox" name="some_field_name" id="some_field_name"></dd>
373
+ </dl>
374
+ </form>
375
+ </escape></code></pre>
376
+
377
+ <form class="semanticForms">
378
+ <dl>
379
+ <dt><label for="some_field_name">Single checkbox</label></dt>
380
+ <dd><input type="checkbox" name="some_field_name" id="some_field_name"></dd>
381
+ </dl>
382
+ </form>
383
+
384
+ <h5 id="checkboxgroup">Checkbox group</h5>
385
+
386
+ <pre><code class='language-html' lang='html'><escape>
387
+ <form class="semanticForms">
388
+ <dl>
389
+ <dt><label data-for="some_checkboxes">Checkboxes:</label></dt>
390
+ <dd class="checkboxes">
391
+ <ul id="some_checkboxes">
392
+ <li><input type="checkbox" name="some_field_name" id="some_field_name_checkboxes_one"> <label for="some_field_name_checkboxes_one">One</label></li>
393
+ <li><input type="checkbox" name="some_field_name" id="some_field_name_checkboxes_two"> <label for="some_field_name_checkboxes_two">Two</label></li>
394
+ <li><input type="checkbox" name="some_field_name" id="some_field_name_checkboxes_three"> <label for="some_field_name_checkboxes_three">Three</label></li>
395
+ </ul>
396
+ </dd>
397
+ </dl>
398
+ </form>
399
+ </escape></code></pre>
400
+
401
+ <form class="semanticForms">
402
+ <dl>
403
+ <dt><label data-for="some_checkboxes">Checkboxes:</label></dt>
404
+ <dd class="checkboxes">
405
+ <ul id="some_checkboxes">
406
+ <li><input type="checkbox" name="some_field_name" id="some_field_name_checkboxes_one"> <label for="some_field_name_checkboxes_one">One</label></li>
407
+ <li><input type="checkbox" name="some_field_name" id="some_field_name_checkboxes_two"> <label for="some_field_name_checkboxes_two">Two</label></li>
408
+ <li><input type="checkbox" name="some_field_name" id="some_field_name_checkboxes_three"> <label for="some_field_name_checkboxes_three">Three</label></li>
409
+ </ul>
410
+ </dd>
411
+ </dl>
412
+ </form>
413
+
414
+ <h5 id="radiobuttons">Radio buttons</h5>
415
+
416
+ <pre><code class='language-html' lang='html'><escape>
417
+ <form class="semanticForms">
418
+ <dl>
419
+ <dt><label data-for="some_radios">Radios:</label></dt>
420
+ <dd class="radios">
421
+ <ul id="some_radios">
422
+ <li><input type="radio" name="some_field_name" id="some_field_name_radios_one"> <label for="some_field_name_radios_one">One</label></li>
423
+ <li><input type="radio" name="some_field_name" id="some_field_name_radios_two"> <label for="some_field_name_radios_two">Two</label></li>
424
+ <li><input type="radio" name="some_field_name" id="some_field_name_radios_three"> <label for="some_field_name_radios_three">Three</label></li>
425
+ </ul>
426
+ </dd>
427
+ </dl>
428
+ </form>
429
+ </escape></code></pre>
430
+
431
+ <form class="semanticForms">
432
+ <dl>
433
+ <dt><label data-for="some_radios">Radios:</label></dt>
434
+ <dd class="radios">
435
+ <ul id="some_radios">
436
+ <li><input type="radio" name="some_field_name" id="some_field_name_radios_one"> <label for="some_field_name_radios_one">One</label></li>
437
+ <li><input type="radio" name="some_field_name" id="some_field_name_radios_two"> <label for="some_field_name_radios_two">Two</label></li>
438
+ <li><input type="radio" name="some_field_name" id="some_field_name_radios_three"> <label for="some_field_name_radios_three">Three</label></li>
439
+ </ul>
440
+ </dd>
441
+ </dl>
442
+ </form>
443
+
444
+ <h4 id="validationstyles">Validation styles</h4>
445
+
446
+ <p>Inputs with the <code>required</code> attribute will result in a visual indicator (*) being added to its label. You can disable this indicator with the <code>data-no-asterisk</code> attribute on the label element:</p>
447
+
448
+ <pre><code class='language-html' lang='html'><escape>
449
+ <form class="semanticForms">
450
+ <dl>
451
+ <dt><label for="input" data-no-asterisk>Input label</label></dt>
452
+ <dd><input type="text" name="input" id="input" required>
453
+ </dl>
454
+ </form>
455
+ </escape></code></pre>
456
+
457
+ <form class="semanticForms">
458
+ <dl>
459
+ <dt><label for="input" data-no-asterisk>Input label</label></dt>
460
+ <dd><input type="text" name="input" id="input" required>
461
+ </dl>
462
+ </form>
463
+
464
+ <p>You can set a paragraph of text below a field to only appear when a field is invalid with the <code>data-invalid-text</code> attribute:</p>
465
+
466
+ <pre><code class='language-html' lang='html'><escape>
467
+ <form class="semanticForms">
468
+ <dl>
469
+ <dt><label for="password_validation">Password label</label></dt>
470
+ <dd>
471
+ <input type="password" name="password" id="password_validation" minlength="8">
472
+ <p data-invalid-text>Password must be at least 8 characters long.</p>
473
+ </dd>
474
+ </dl>
475
+ </form>
476
+ </escape></code></pre>
477
+
478
+ <form class="semanticForms">
479
+ <dl>
480
+ <dt><label for="password_validation">Password label</label></dt>
481
+ <dd>
482
+ <input type="password" name="password" id="password_validation" minlength="8">
483
+ <p data-invalid-text>Password must be at least 8 characters long.</p>
484
+ </dd>
485
+ </dl>
486
+ </form>
487
+
488
+ <p>You can adjust the tooltip text of the asterisk with the <code>data-asterisk-text</code> attribute:</p>
489
+
490
+ <pre><code class='language-html' lang='html'><escape>
491
+ <form class="semanticForms">
492
+ <dl>
493
+ <dt><label for="input_validation" data-asterisk-text="This is a custom tooltip.">Input label</label></dt>
494
+ <dd><input type="text" name="input" id="input_validation" required>
495
+ </dl>
496
+ </form>
497
+ </escape></code></pre>
498
+
499
+ <form class="semanticForms">
500
+ <dl>
501
+ <dt><label for="input_validation" data-asterisk-text="This is a custom tooltip.">Input label</label></dt>
502
+ <dd><input type="text" name="input" id="input_validation" required>
503
+ </dl>
504
+ </form>
505
+
506
+ <h3 id="lightanddarkmode">Light mode and dark mode</h3>
507
+
508
+ <p>Light mode and dark mode will be detected automatically based on operating system preference. To set it manually, you can apply an additional class of <code>light</code> or <code>dark</code> to your <code><!--#<form>--></code> elements to force the mode.</p>
509
+
510
+ <h3 id="lowflowmode">Low flow (JavaScript disabled) mode</h3>
511
+
512
+ <p>The low flow will be displayed if JS is disabled.</p>
513
+
514
+ <p>You can also activate the low flow (JavaScript disabled) mode manually by adding the <code>lowFlow</code> class to your <code><!--#<form>--></code> element.</p>
515
+
516
+ <p>The low-flow mode reverts the float label pattern to traditional labels and doesn't include other JS-exclusive enhancements, but preserves the other visual design enhancements driven purely by CSS.</p>
517
+
518
+ <h3 id="more">More</h3>
519
+
520
+ <p>See a page demoing all features <a href="https://rooseveltframework.github.io/semantic-forms/test/semanticForms.html">here</a>.</p>
521
+ </article>
522
+ </arg>
523
+ </include>
package/package.json CHANGED
@@ -8,19 +8,21 @@
8
8
  "url": "https://github.com/rooseveltframework/semantic-forms/graphs/contributors"
9
9
  }
10
10
  ],
11
- "version": "5.0.7",
11
+ "version": "5.0.8",
12
12
  "files": [
13
13
  "dist",
14
- "semanticForms.scss"
14
+ "semanticForms.scss",
15
+ "docs/statics/pages",
16
+ "*.md"
15
17
  ],
16
- "homepage": "https://github.com/rooseveltframework/semantic-forms",
18
+ "homepage": "https://rooseveltframework.org/docs/semantic-forms/latest",
17
19
  "license": "CC-BY-4.0",
18
20
  "main": "semanticForms.js",
19
21
  "readmeFilename": "README.md",
20
22
  "devDependencies": {
21
23
  "@jsdevtools/coverage-istanbul-loader": "3.0.5",
22
24
  "@playwright/test": "1.52.0",
23
- "eslint": "9.25.1",
25
+ "eslint": "9.26.0",
24
26
  "eslint-plugin-html": "8.1.2",
25
27
  "express": "5.1.0",
26
28
  "nodemon": "3.1.10",
@@ -52,13 +52,21 @@ form.semanticForms, form.semanticForms.light {
52
52
  }
53
53
 
54
54
  @media (prefers-color-scheme: dark) {
55
- form.semanticForms {
56
- @include dark-mode;
55
+ html:not(.light) {
56
+ body:not(.light) {
57
+ form.semanticForms {
58
+ @include dark-mode;
59
+ }
60
+ }
57
61
  }
58
62
  }
59
63
 
60
- form.semanticForms.dark {
61
- @include dark-mode;
64
+ html:not(.light) {
65
+ body:not(.light) {
66
+ form.semanticForms.dark {
67
+ @include dark-mode;
68
+ }
69
+ }
62
70
  }
63
71
  // #endregion
64
72
 
@@ -257,7 +265,7 @@ form.semanticForms, form.semanticForms.light {
257
265
  }
258
266
  }
259
267
  // #endregion
260
-
268
+
261
269
  // #region invalid styling
262
270
  [data-invalid-text] {
263
271
  display: none;
@@ -609,65 +617,65 @@ form.semanticForms, form.semanticForms.light {
609
617
  &[class^='colspan-'] {
610
618
  max-width: 100%;
611
619
  }
612
-
620
+
613
621
  &.colspan-full {
614
622
  grid-column: 1 / -1;
615
623
  }
616
-
624
+
617
625
  &.colspan-5 {
618
626
  grid-column: span 5;
619
627
  }
620
-
628
+
621
629
  &.colspan-4 {
622
630
  grid-column: span 4;
623
631
  }
624
-
632
+
625
633
  &.colspan-3 {
626
634
  grid-column: span 3;
627
635
  }
628
-
636
+
629
637
  &.colspan-2 {
630
638
  grid-column: span 2;
631
639
  }
632
-
640
+
633
641
  &.colspan-1 {
634
642
  grid-column: span 1;
635
643
  }
636
644
  }
637
-
645
+
638
646
  fieldset[class^='colspan-'] dl,
639
647
  dl[class^='colspan-'] {
640
648
  div {
641
649
  max-width: 100%;
642
650
  }
643
651
  }
644
-
652
+
645
653
  fieldset.colspan-full dl,
646
654
  dl.colspan-full {
647
655
  grid-template-columns: repeat(auto-fit, minmax(var(--inputMinWidth), 1fr));
648
656
  }
649
-
657
+
650
658
  fieldset.colspan-5 dl,
651
659
  dl.colspan-5 {
652
660
  grid-template-columns: repeat(5, minmax(var(--inputMinWidth), 1fr));
653
661
  }
654
-
662
+
655
663
  fieldset.colspan-4 dl,
656
664
  dl.colspan-4 {
657
665
  grid-template-columns: repeat(4, minmax(var(--inputMinWidth), 1fr));
658
666
  }
659
-
660
-
667
+
668
+
661
669
  fieldset.colspan-3 dl,
662
670
  dl.colspan-3 {
663
671
  grid-template-columns: repeat(3, minmax(var(--inputMinWidth), 1fr));
664
672
  }
665
-
673
+
666
674
  fieldset.colspan-2 dl,
667
675
  dl.colspan-2 {
668
676
  grid-template-columns: repeat(2, minmax(var(--inputMinWidth), 1fr));
669
677
  }
670
-
678
+
671
679
  fieldset.colspan-1 dl,
672
680
  dl.colspan-1 {
673
681
  grid-template-columns: repeat(1, minmax(var(--inputMinWidth), 1fr));
@@ -897,7 +905,7 @@ form.semanticForms, form.semanticForms.light {
897
905
  }
898
906
 
899
907
  // #region low flow form
900
- &:not(.semanticFormsActive) {
908
+ &:not(.semanticFormsActive) {
901
909
  dl {
902
910
  display: flex;
903
911
  flex-direction: column;