semantic-forms 4.0.0 → 4.0.1
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 +14 -0
- package/package.json +2 -2
- package/semanticForms.css +30 -18
- package/semanticForms.scss +21 -10
package/README.md
CHANGED
|
@@ -300,6 +300,20 @@ Inputs with the `required` attribute will result in a visual indicator (*) being
|
|
|
300
300
|
</form>
|
|
301
301
|
```
|
|
302
302
|
|
|
303
|
+
You can set a paragraph of text below a field to only appear when a field is invalid with the `data-invalid-text` attribute:
|
|
304
|
+
|
|
305
|
+
```html
|
|
306
|
+
<form class="semanticForms">
|
|
307
|
+
<dl>
|
|
308
|
+
<dt><label for="password">Password label</label><dt>
|
|
309
|
+
<dd>
|
|
310
|
+
<input type="password" name="password" id="password" minlength="8">
|
|
311
|
+
<p data-invalid-text>Password must be at least 8 characters long.</p>
|
|
312
|
+
</dd>
|
|
313
|
+
</dl>
|
|
314
|
+
</form>
|
|
315
|
+
```
|
|
316
|
+
|
|
303
317
|
You can adjust the tooltip text of the asterisk with the `data-asterisk-text` attribute:
|
|
304
318
|
|
|
305
319
|
```html
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"url": "https://github.com/rooseveltframework/semantic-forms/graphs/contributors"
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
|
-
"version": "4.0.
|
|
11
|
+
"version": "4.0.1",
|
|
12
12
|
"files": [
|
|
13
13
|
"semanticForms.css",
|
|
14
14
|
"semanticForms.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"eslint": "9.10.0",
|
|
23
23
|
"eslint-plugin-html": "8.1.1",
|
|
24
|
-
"nodemon": "
|
|
24
|
+
"nodemon": "3.1.4",
|
|
25
25
|
"sass": "1.78.0",
|
|
26
26
|
"serve": "14.2.3",
|
|
27
27
|
"standard": "17.1.2"
|
package/semanticForms.css
CHANGED
|
@@ -165,14 +165,14 @@ form.semanticForms textarea[disabled] {
|
|
|
165
165
|
cursor: not-allowed;
|
|
166
166
|
opacity: 0.5;
|
|
167
167
|
}
|
|
168
|
-
form.semanticForms input:not([type=submit], [type=reset], [type=image], [type=checkbox], [type=radio])[disabled]
|
|
169
|
-
form.semanticForms select[disabled]
|
|
170
|
-
form.semanticForms textarea[disabled]
|
|
168
|
+
form.semanticForms input:not([type=submit], [type=reset], [type=image], [type=checkbox], [type=radio])[disabled] ~ label:first-of-type,
|
|
169
|
+
form.semanticForms select[disabled] ~ label:first-of-type,
|
|
170
|
+
form.semanticForms textarea[disabled] ~ label:first-of-type {
|
|
171
171
|
opacity: 0.5;
|
|
172
172
|
}
|
|
173
|
-
form.semanticForms input:not([type=submit], [type=reset], [type=image], [type=checkbox], [type=radio])[disabled]
|
|
174
|
-
form.semanticForms select[disabled]
|
|
175
|
-
form.semanticForms textarea[disabled]
|
|
173
|
+
form.semanticForms input:not([type=submit], [type=reset], [type=image], [type=checkbox], [type=radio])[disabled] ~ label + button,
|
|
174
|
+
form.semanticForms select[disabled] ~ label + button,
|
|
175
|
+
form.semanticForms textarea[disabled] ~ label + button {
|
|
176
176
|
display: none;
|
|
177
177
|
}
|
|
178
178
|
form.semanticForms input:not([type=submit], [type=reset], [type=image]):focus,
|
|
@@ -196,8 +196,8 @@ form.semanticForms input[type=radio] {
|
|
|
196
196
|
height: 1.4em;
|
|
197
197
|
cursor: pointer;
|
|
198
198
|
}
|
|
199
|
-
form.semanticForms input[type=checkbox]
|
|
200
|
-
form.semanticForms input[type=radio]
|
|
199
|
+
form.semanticForms input[type=checkbox] ~ label:first-of-type,
|
|
200
|
+
form.semanticForms input[type=radio] ~ label:first-of-type {
|
|
201
201
|
color: var(--formTextColor) !important;
|
|
202
202
|
}
|
|
203
203
|
form.semanticForms input[type=file] {
|
|
@@ -239,12 +239,12 @@ form.semanticForms button.clear {
|
|
|
239
239
|
align-items: center;
|
|
240
240
|
justify-content: center;
|
|
241
241
|
}
|
|
242
|
-
form.semanticForms textarea
|
|
242
|
+
form.semanticForms textarea ~ .clear {
|
|
243
243
|
bottom: auto;
|
|
244
244
|
}
|
|
245
|
-
form.semanticForms input:placeholder-shown
|
|
246
|
-
form.semanticForms textarea:placeholder-shown
|
|
247
|
-
form.semanticForms input[type=file]
|
|
245
|
+
form.semanticForms input:placeholder-shown ~ .clear,
|
|
246
|
+
form.semanticForms textarea:placeholder-shown ~ .clear,
|
|
247
|
+
form.semanticForms input[type=file] ~ .clear {
|
|
248
248
|
display: none;
|
|
249
249
|
}
|
|
250
250
|
form.semanticForms input[type=submit],
|
|
@@ -288,15 +288,15 @@ form.semanticForms .floatLabelForm div {
|
|
|
288
288
|
position: relative;
|
|
289
289
|
width: 100%;
|
|
290
290
|
}
|
|
291
|
-
form.semanticForms .floatLabelForm div dd:not(.singleCheckbox, .checkboxes, .radios) input:not([type=submit], [type=reset], [type=image]):focus:not([type=checkbox], [type=radio])
|
|
292
|
-
form.semanticForms .floatLabelForm div dd:not(.singleCheckbox, .checkboxes, .radios) select:focus:not([type=checkbox], [type=radio])
|
|
293
|
-
form.semanticForms .floatLabelForm div dd:not(.singleCheckbox, .checkboxes, .radios) select:not(:placeholder-shown, [type=checkbox], [type=radio])
|
|
294
|
-
form.semanticForms .floatLabelForm div dd:not(.singleCheckbox, .checkboxes, .radios) textarea:focus:not([type=checkbox], [type=radio])
|
|
295
|
-
form.semanticForms .floatLabelForm div dd:not(.singleCheckbox, .checkboxes, .radios) textarea:not(:placeholder-shown, [type=checkbox], [type=radio])
|
|
291
|
+
form.semanticForms .floatLabelForm div dd:not(.singleCheckbox, .checkboxes, .radios) input:not([type=submit], [type=reset], [type=image]):focus:not([type=checkbox], [type=radio]) ~ label:first-of-type, form.semanticForms .floatLabelForm div dd:not(.singleCheckbox, .checkboxes, .radios) input:not([type=submit], [type=reset], [type=image]):not(:placeholder-shown, [type=checkbox], [type=radio]) ~ label:first-of-type,
|
|
292
|
+
form.semanticForms .floatLabelForm div dd:not(.singleCheckbox, .checkboxes, .radios) select:focus:not([type=checkbox], [type=radio]) ~ label:first-of-type,
|
|
293
|
+
form.semanticForms .floatLabelForm div dd:not(.singleCheckbox, .checkboxes, .radios) select:not(:placeholder-shown, [type=checkbox], [type=radio]) ~ label:first-of-type,
|
|
294
|
+
form.semanticForms .floatLabelForm div dd:not(.singleCheckbox, .checkboxes, .radios) textarea:focus:not([type=checkbox], [type=radio]) ~ label:first-of-type,
|
|
295
|
+
form.semanticForms .floatLabelForm div dd:not(.singleCheckbox, .checkboxes, .radios) textarea:not(:placeholder-shown, [type=checkbox], [type=radio]) ~ label:first-of-type {
|
|
296
296
|
color: var(--formTextColor) !important;
|
|
297
297
|
transform: translateY(-150%) scale(0.7);
|
|
298
298
|
}
|
|
299
|
-
form.semanticForms .floatLabelForm div dd:not(.singleCheckbox, .checkboxes, .radios) select
|
|
299
|
+
form.semanticForms .floatLabelForm div dd:not(.singleCheckbox, .checkboxes, .radios) select ~ label:first-of-type {
|
|
300
300
|
color: var(--formTextColor) !important;
|
|
301
301
|
}
|
|
302
302
|
form.semanticForms .floatLabelForm div dd:not(.singleCheckbox, .checkboxes, .radios) label:first-of-type {
|
|
@@ -496,6 +496,10 @@ form.semanticForms.lowFlow fieldset.colspan-1 dl, form.semanticForms.lowFlow dl.
|
|
|
496
496
|
form.semanticForms.lowFlow fieldset.colspan-1 dl dt:nth-of-type(n + 1), form.semanticForms.lowFlow fieldset.colspan-1 dl dd:nth-of-type(n + 1), form.semanticForms.lowFlow dl.colspan-1 dt:nth-of-type(n + 1), form.semanticForms.lowFlow dl.colspan-1 dd:nth-of-type(n + 1) {
|
|
497
497
|
grid-column: 1;
|
|
498
498
|
}
|
|
499
|
+
form.semanticForms [data-invalid-text] {
|
|
500
|
+
display: none;
|
|
501
|
+
color: var(--invalid);
|
|
502
|
+
}
|
|
499
503
|
form.semanticForms input:not([type=submit], [type=reset], [type=image]).invalid, form.semanticForms input:not([type=submit], [type=reset], [type=image]):user-invalid,
|
|
500
504
|
form.semanticForms select.invalid,
|
|
501
505
|
form.semanticForms select:user-invalid,
|
|
@@ -510,6 +514,14 @@ form.semanticForms textarea.invalid ~ label:nth-of-type(2),
|
|
|
510
514
|
form.semanticForms textarea:user-invalid ~ label:nth-of-type(2) {
|
|
511
515
|
color: var(--invalid) !important;
|
|
512
516
|
}
|
|
517
|
+
form.semanticForms input:not([type=submit], [type=reset], [type=image]).invalid ~ [data-invalid-text], form.semanticForms input:not([type=submit], [type=reset], [type=image]):user-invalid ~ [data-invalid-text],
|
|
518
|
+
form.semanticForms select.invalid ~ [data-invalid-text],
|
|
519
|
+
form.semanticForms select:user-invalid ~ [data-invalid-text],
|
|
520
|
+
form.semanticForms textarea.invalid ~ [data-invalid-text],
|
|
521
|
+
form.semanticForms textarea:user-invalid ~ [data-invalid-text] {
|
|
522
|
+
font-size: small;
|
|
523
|
+
display: flex;
|
|
524
|
+
}
|
|
513
525
|
form.semanticForms input:-webkit-autofill,
|
|
514
526
|
form.semanticForms input:-webkit-autofill:hover,
|
|
515
527
|
form.semanticForms input:-webkit-autofill:focus,
|
package/semanticForms.scss
CHANGED
|
@@ -195,11 +195,11 @@ form.semanticForms {
|
|
|
195
195
|
cursor: not-allowed;
|
|
196
196
|
opacity: 0.5;
|
|
197
197
|
|
|
198
|
-
|
|
198
|
+
~ label:first-of-type {
|
|
199
199
|
opacity: 0.5;
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
-
|
|
202
|
+
~ label + button {
|
|
203
203
|
display: none;
|
|
204
204
|
}
|
|
205
205
|
}
|
|
@@ -235,7 +235,7 @@ form.semanticForms {
|
|
|
235
235
|
height: 1.4em;
|
|
236
236
|
cursor: pointer;
|
|
237
237
|
|
|
238
|
-
&
|
|
238
|
+
& ~ label:first-of-type {
|
|
239
239
|
color: var(--formTextColor) !important;
|
|
240
240
|
}
|
|
241
241
|
}
|
|
@@ -288,14 +288,14 @@ form.semanticForms {
|
|
|
288
288
|
}
|
|
289
289
|
|
|
290
290
|
// custom styling of clear button on textarea
|
|
291
|
-
textarea
|
|
291
|
+
textarea ~ .clear {
|
|
292
292
|
bottom: auto;
|
|
293
293
|
}
|
|
294
294
|
|
|
295
295
|
// hide clear button while placeholder text is visible
|
|
296
|
-
input:placeholder-shown
|
|
297
|
-
textarea:placeholder-shown
|
|
298
|
-
input[type=file]
|
|
296
|
+
input:placeholder-shown ~ .clear,
|
|
297
|
+
textarea:placeholder-shown ~ .clear,
|
|
298
|
+
input[type=file] ~ .clear {
|
|
299
299
|
display: none;
|
|
300
300
|
}
|
|
301
301
|
|
|
@@ -349,14 +349,14 @@ form.semanticForms {
|
|
|
349
349
|
input:not([type='submit'], [type='reset'], [type='image']),
|
|
350
350
|
select,
|
|
351
351
|
textarea {
|
|
352
|
-
&:focus:not([type=checkbox], [type=radio])
|
|
353
|
-
&:not(:placeholder-shown, [type=checkbox], [type=radio])
|
|
352
|
+
&:focus:not([type=checkbox], [type=radio]) ~ label:first-of-type,
|
|
353
|
+
&:not(:placeholder-shown, [type=checkbox], [type=radio]) ~ label:first-of-type {
|
|
354
354
|
color: var(--formTextColor) !important;
|
|
355
355
|
transform: translateY(-150%) scale(0.7);
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
358
|
|
|
359
|
-
select
|
|
359
|
+
select ~ label:first-of-type {
|
|
360
360
|
// force label to be correct color
|
|
361
361
|
color: var(--formTextColor) !important;
|
|
362
362
|
}
|
|
@@ -651,6 +651,11 @@ form.semanticForms {
|
|
|
651
651
|
// #endregion
|
|
652
652
|
|
|
653
653
|
// #region invalid styling
|
|
654
|
+
[data-invalid-text] {
|
|
655
|
+
display: none;
|
|
656
|
+
color: var(--invalid);
|
|
657
|
+
}
|
|
658
|
+
|
|
654
659
|
input:not([type='submit'], [type='reset'], [type='image']),
|
|
655
660
|
select,
|
|
656
661
|
textarea {
|
|
@@ -661,7 +666,13 @@ form.semanticForms {
|
|
|
661
666
|
~ label:nth-of-type(2) {
|
|
662
667
|
color: var(--invalid) !important;
|
|
663
668
|
}
|
|
669
|
+
|
|
670
|
+
~ [data-invalid-text] {
|
|
671
|
+
font-size: small;
|
|
672
|
+
display: flex;
|
|
673
|
+
}
|
|
664
674
|
}
|
|
675
|
+
|
|
665
676
|
}
|
|
666
677
|
// #endregion
|
|
667
678
|
|