semantic-forms 3.2.1 → 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.
@@ -0,0 +1,997 @@
1
+ // #region global styles
2
+ form.semanticForms {
3
+ --formBackgroundColor: #fff;
4
+ --formSubBackgroundColor: #f5f5f5;
5
+ --formTextColor: #000;
6
+ --buttonBackgroundColor: #f5f5f5;
7
+ --borderColor: #c0c0c0;
8
+ --subBorderColor: #c0c0c0;
9
+ --placeholderColor: rgba(0, 0, 0, 0.75);
10
+ --scrollbarColor: #c0c0c0;
11
+ --clearButtonColor: #000;
12
+ --buttonGradientLight: #fff;
13
+ --buttonGradientDark: #c0c0c0;
14
+ --invalid: #f00;
15
+ --invalidBorder: 1px solid var(--invalid);
16
+ --inputHeight: 38px;
17
+ --inputFontSize: 16px;
18
+ --inputTopMargin: 15px;
19
+ --inputMinWidth: 250px;
20
+ --borderRadius: 10px;
21
+ --nestedFieldset: rgba(0, 0, 0, .05);
22
+ --nestedFieldsetBorder: 1px rgba(0, 0, 0, .2) solid;
23
+ --nestedInput: #fff;
24
+ --border: 1px var(--borderColor) solid;
25
+ --selectIcon: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='%23000'%3E%3Cpolygon points='0,0 100,0 50,50'/%3E%3C/svg%3E");
26
+ --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:%23aaa;stroke:%23aaa;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:%23aaa;stroke:%23aaa;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:%23aaa;stroke:%23aaa;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")
27
+ }
28
+
29
+ form.semanticForms.dark {
30
+ --formBackgroundColor: #555;
31
+ --inputBackgroudColor: rgba(85,85,85,0.1);
32
+ --formSubBackgroundColor: #2f2f2f;
33
+ --formTextColor: #fff;
34
+ --buttonBackgroundColor: #454545;
35
+ --borderColor: #656565;
36
+ --subBorderColor: #3f3f3f;
37
+ --placeholderColor: rgba(255, 255, 255, 0.85);
38
+ --scrollbarColor: #373737;
39
+ --clearButtonColor: #fff;
40
+ --buttonGradientLight: #6f6f6f;
41
+ --buttonGradientDark: #373737;
42
+ --nestedFieldset: rgba(255, 255, 255, .05);
43
+ --nestedFieldsetBorder: 1px rgba(255, 255, 255, .1) solid;
44
+ --nestedInput: rgba(255, 255, 255, .15);
45
+ --border: none;
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
+ --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
+
49
+ input::-webkit-calendar-picker-indicator {
50
+ filter: invert(100%);
51
+ }
52
+ }
53
+ // #endregion
54
+
55
+ form.semanticForms {
56
+ width: 100%;
57
+ container-type: inline-size;
58
+ container-name: semanticForm;
59
+ display: flex;
60
+ flex-direction: column;
61
+ gap: 10px;
62
+
63
+ // style reset
64
+ * {
65
+ color: var(--formTextColor);
66
+ box-sizing: border-box;
67
+ font-family: sans-serif;
68
+ margin: 0;
69
+ padding: 0;
70
+ }
71
+
72
+ // #region container layout
73
+ fieldset {
74
+ border-radius: var(--borderRadius);
75
+ background: var(--formSubBackgroundColor);
76
+ border: 1px var(--subBorderColor) solid;
77
+ display: flex;
78
+ flex-direction: column;
79
+ gap: 5px;
80
+ padding: 10px 10px 20px 10px;
81
+ margin-bottom: 15px;
82
+
83
+ // nested fieldsets are darkened
84
+ > fieldset {
85
+ background-color: var(--nestedFieldset);
86
+ border: var(--nestedFieldsetBorder);
87
+
88
+ // add opacity to styled inputs to prevent blending with background
89
+ input:not([type='submit'], [type='reset'], [type='image'], [type=checkbox], [type=radio]),
90
+ select,
91
+ textarea {
92
+ background: var(--nestedInput);
93
+ }
94
+ }
95
+
96
+ }
97
+
98
+ dl {
99
+ display: grid;
100
+ grid-template-columns: repeat(2, minmax(var(--inputMinWidth), 1fr));
101
+ gap: 10px;
102
+ margin-bottom: 10px;
103
+
104
+ dd {
105
+ position: relative;
106
+
107
+ &:not(.checkboxes, .radios) {
108
+ display: flex;
109
+ gap: 10px;
110
+ max-width: 100%;
111
+
112
+ // places all items within the <dd> horizontally
113
+ &:not(.singleCheckbox) {
114
+ flex-direction: column;
115
+ }
116
+ }
117
+
118
+ &.checkboxes ul, &.radios ul {
119
+ display: flex;
120
+ flex-direction: column;
121
+ margin-top: var(--inputTopMargin);
122
+ padding-left: 10px;
123
+ gap: 5px;
124
+
125
+ li {
126
+ display: flex;
127
+ align-items: center;
128
+ gap: 5px;
129
+
130
+ label {
131
+ // shift text down to match center
132
+ font-size: var(--inputFontSize);
133
+ margin-top: 2px;
134
+ }
135
+ }
136
+ }
137
+ }
138
+ }
139
+
140
+ p {
141
+ input, select, textarea {
142
+ max-width: 350px;
143
+ }
144
+
145
+ // input/label combo
146
+ &:has(input:not([type='checkbox'], [type='radio']), textarea, label) {
147
+ display: flex;
148
+ flex-direction: column;
149
+ gap: 5px;
150
+ }
151
+
152
+ // checkbox or radio/label combo
153
+ &:has(input[type='checkbox'], input[type='radio'], label) {
154
+ display: flex;
155
+ flex-direction: row;
156
+ align-items: center;
157
+ gap: 5px;
158
+ }
159
+ }
160
+
161
+ menu, ul {
162
+ display: flex;
163
+ justify-content: space-between;
164
+ flex-wrap: wrap;
165
+ gap: 10px;
166
+ list-style-type: none;
167
+ }
168
+
169
+ details[open], summary {
170
+ margin-bottom: 10px;
171
+ }
172
+
173
+ summary {
174
+ cursor: pointer;
175
+ }
176
+ // #endregion
177
+
178
+ // #region input styling
179
+ input:not([type='submit'], [type='reset'], [type='image'], [type=checkbox], [type=radio]),
180
+ select,
181
+ textarea {
182
+ font-size: var(--inputFontSize);
183
+ background: var(--formBackgroundColor);
184
+ border: var(--border);
185
+ border-radius: var(--borderRadius);
186
+ width: 100%;
187
+ touch-action: manipulation;
188
+ outline: none;
189
+
190
+ &:not([type="range"]) {
191
+ padding: 6px 30px 6px 20px;
192
+ }
193
+
194
+ &[disabled] {
195
+ cursor: not-allowed;
196
+ opacity: 0.5;
197
+
198
+ ~ label:first-of-type {
199
+ opacity: 0.5;
200
+ }
201
+
202
+ ~ label + button {
203
+ display: none;
204
+ }
205
+ }
206
+ }
207
+
208
+ // focused styles
209
+ input:not([type='submit'], [type='reset'], [type='image']),
210
+ select,
211
+ textarea {
212
+ // custom focus highlight
213
+ &:focus {
214
+ outline: none;
215
+ box-shadow: 0 0 0 1px var(--borderColor);
216
+ }
217
+ }
218
+
219
+ input:not([type='submit'], [type='reset'], [type='image'], [type=checkbox], [type=radio]),
220
+ select {
221
+ height: var(--inputHeight);
222
+ }
223
+
224
+ // specific styling for color input
225
+ input[type=color] {
226
+ height: var(--inputHeight);
227
+ padding: 4px !important;
228
+ padding-right: 30px !important;
229
+ }
230
+
231
+ input[type=checkbox],
232
+ input[type=radio] {
233
+ // 30% larger based on parent font size
234
+ width: 1.4em;
235
+ height: 1.4em;
236
+ cursor: pointer;
237
+
238
+ & ~ label:first-of-type {
239
+ color: var(--formTextColor) !important;
240
+ }
241
+ }
242
+
243
+ input[type=file] {
244
+ cursor: pointer;
245
+ font-size: var(--inputFontSize);
246
+ }
247
+
248
+ select {
249
+ cursor: pointer;
250
+ // custom dropdown graphic on select element
251
+ background-image: var(--selectIcon);
252
+ background-size: 14px;
253
+ background-position: calc(100% - 8px) 16px;
254
+ background-repeat: no-repeat;
255
+ -webkit-appearance: none;
256
+ -moz-appearance: none;
257
+ appearance: none;
258
+ }
259
+
260
+ textarea {
261
+ resize: vertical;
262
+ width: 100%;
263
+ min-height: 38px;
264
+ height: 100px;
265
+ }
266
+ // #endregion
267
+
268
+ // #region buttons
269
+ button.clear {
270
+ cursor: pointer;
271
+ appearance: none;
272
+ -webkit-appearance: none;
273
+ position: absolute;
274
+ height: min-content;
275
+ // account for margin above each input
276
+ top: calc(var(--inputTopMargin) + 6px);
277
+ right: 0;
278
+ width: 25px;
279
+ height: 25px;
280
+ margin: auto 6px;
281
+ padding: 5px;
282
+ background: none;
283
+ border: none;
284
+ color: var(--clearButtonColor);
285
+ display: flex;
286
+ align-items: center;
287
+ justify-content: center;
288
+ }
289
+
290
+ // custom styling of clear button on textarea
291
+ textarea ~ .clear {
292
+ bottom: auto;
293
+ }
294
+
295
+ // hide clear button while placeholder text is visible
296
+ input:placeholder-shown ~ .clear,
297
+ textarea:placeholder-shown ~ .clear,
298
+ input[type=file] ~ .clear {
299
+ display: none;
300
+ }
301
+
302
+ // button styling
303
+ input[type='submit'],
304
+ input[type='reset'],
305
+ button:not(.clear) {
306
+ appearance: none;
307
+ -moz-appearance: none;
308
+ -webkit-appearance: none;
309
+ cursor: pointer;
310
+ max-width: max-content;
311
+ background-image: linear-gradient(to bottom, var(--buttonGradientLight) 0%, var(--buttonGradientDark) 100%);
312
+ border: 2px var(--buttonGradientDark) solid;
313
+ border-radius: 20px;
314
+ padding: 5px 25px;
315
+ font-size: 100%;
316
+ line-height: 1;
317
+
318
+ &:active,
319
+ &:focus {
320
+ background-image: linear-gradient(to bottom, var(--buttonGradientDark) 0%, var(--buttonGradientLight) 100%);
321
+ }
322
+ }
323
+
324
+ input[type='submit'],
325
+ input[type='reset'],
326
+ input[type='image'],
327
+ button:not(.clear) {
328
+ transition: filter 0.1s;
329
+
330
+ &:hover {
331
+ filter: brightness(1.05);
332
+ }
333
+ }
334
+ // #endregion
335
+
336
+ // #region labels
337
+ .floatLabelForm {
338
+ &:not(:has(div:nth-of-type(2))) {
339
+ dd:not(.checkboxes, .radios):not(:has(textarea)) {
340
+ max-width: 350px;
341
+ }
342
+ }
343
+
344
+ div {
345
+ position: relative;
346
+ width: 100%;
347
+
348
+ dd:not(.singleCheckbox, .checkboxes, .radios) {
349
+ input:not([type='submit'], [type='reset'], [type='image']),
350
+ select,
351
+ textarea {
352
+ &:focus:not([type=checkbox], [type=radio]) ~ label:first-of-type,
353
+ &:not(:placeholder-shown, [type=checkbox], [type=radio]) ~ label:first-of-type {
354
+ color: var(--formTextColor) !important;
355
+ transform: translateY(-150%) scale(0.7);
356
+ }
357
+ }
358
+
359
+ select ~ label:first-of-type {
360
+ // force label to be correct color
361
+ color: var(--formTextColor) !important;
362
+ }
363
+
364
+ label:first-of-type {
365
+ line-height: 1.2;
366
+ font-size: var(--inputFontSize);
367
+ position: absolute;
368
+ transform-origin: left center;
369
+ pointer-events: none;
370
+ // when the label is positioned within the input it needs a buffer
371
+ top: calc(var(--inputTopMargin) + 10px);
372
+ left: 20px;
373
+ transition: transform 250ms;
374
+ cursor: text;
375
+ white-space: nowrap;
376
+ overflow: hidden;
377
+ text-overflow: ellipsis;
378
+ }
379
+
380
+ // subtext
381
+ label:nth-of-type(2) {
382
+ margin-top: -5px;
383
+ padding-left: 20px;
384
+ font-size: small;
385
+ color: var(--formTextColor);
386
+ }
387
+
388
+ input,
389
+ textarea,
390
+ select {
391
+ margin-top: var(--inputTopMargin);
392
+ }
393
+
394
+ input,
395
+ textarea {
396
+ transition: opacity 250ms;
397
+ // hide placeholder content until input is focused
398
+ &::placeholder {
399
+ opacity: 0;
400
+ transition: opacity 250ms;
401
+ }
402
+
403
+ &::-moz-placeholder {
404
+ opacity: 0;
405
+ transition: opacity 250ms;
406
+ }
407
+
408
+ &::-webkit-input-placeholder {
409
+ opacity: 0;
410
+ transition: opacity 250ms;
411
+ }
412
+
413
+ &:-ms-input-placeholder {
414
+ opacity: 0;
415
+ transition: opacity 250ms;
416
+ }
417
+
418
+ // show placeholder content when focused
419
+ &:focus {
420
+ &::placeholder {
421
+ opacity: 1;
422
+ }
423
+
424
+ &::-moz-placeholder {
425
+ opacity: 1;
426
+ }
427
+
428
+ &::-webkit-input-placeholder {
429
+ opacity: 1;
430
+ }
431
+
432
+ &:-ms-input-placeholder {
433
+ opacity: 1;
434
+ }
435
+ }
436
+ }
437
+
438
+ label:first-of-type {
439
+ user-select: none;
440
+ color: var(--placeholderColor);
441
+ touch-action: manipulation;
442
+
443
+ span {
444
+ cursor: help;
445
+ pointer-events: auto;
446
+ color: red;
447
+ }
448
+ }
449
+ }
450
+
451
+ // top level label for checkbox and radio groups
452
+ dt {
453
+ position: relative;
454
+
455
+ label {
456
+ user-select: auto;
457
+ color: var(--formTextColor);
458
+ position: absolute;
459
+ transform: translateY(-100%) scale(0.8);
460
+ top: var(--inputTopMargin);
461
+ }
462
+ }
463
+
464
+ &:has(dd input:required) {
465
+ dt {
466
+ label > span {
467
+ margin-left: 5px;
468
+ cursor: help;
469
+ pointer-events: auto;
470
+ color: red;
471
+ }
472
+
473
+ }
474
+ }
475
+ }
476
+
477
+ input, textarea {
478
+ &::placeholder {
479
+ color: var(--placeholderColor);
480
+ opacity: 1;
481
+ }
482
+ }
483
+ // #endregion
484
+
485
+ }
486
+
487
+ // #region colspan classes
488
+ div {
489
+ &.colspan-full {
490
+ grid-column: 1 / -1;
491
+ }
492
+
493
+ &.colspan-5 {
494
+ grid-column: span 5;
495
+ }
496
+
497
+ &.colspan-4 {
498
+ grid-column: span 4;
499
+ }
500
+
501
+ &.colspan-3 {
502
+ grid-column: span 3;
503
+ }
504
+
505
+ &.colspan-2 {
506
+ grid-column: span 2;
507
+ }
508
+
509
+ &.colspan-1 {
510
+ grid-column: span 1;
511
+ }
512
+ }
513
+
514
+ fieldset.colspan-full dl,
515
+ dl.colspan-full {
516
+ grid-template-columns: repeat(auto-fit, minmax(var(--inputMinWidth), 1fr));
517
+ }
518
+
519
+ fieldset.colspan-5 dl,
520
+ dl.colspan-5 {
521
+ grid-template-columns: repeat(5, minmax(var(--inputMinWidth), 1fr));
522
+ }
523
+
524
+ fieldset.colspan-4 dl,
525
+ dl.colspan-4 {
526
+ grid-template-columns: repeat(4, minmax(var(--inputMinWidth), 1fr));
527
+ }
528
+
529
+
530
+ fieldset.colspan-3 dl,
531
+ dl.colspan-3 {
532
+ grid-template-columns: repeat(3, minmax(var(--inputMinWidth), 1fr));
533
+ }
534
+
535
+ fieldset.colspan-2 dl,
536
+ dl.colspan-2 {
537
+ grid-template-columns: repeat(2, minmax(var(--inputMinWidth), 1fr));
538
+ }
539
+
540
+ fieldset.colspan-1 dl,
541
+ dl.colspan-1 {
542
+ grid-template-columns: repeat(1, minmax(var(--inputMinWidth), 1fr));
543
+ }
544
+
545
+ // low flow version
546
+ &.lowFlow fieldset.colspan-full dl,
547
+ &.lowFlow dl.colspan-full,
548
+ &.lowFlow fieldset.colspan-5 dl,
549
+ &.lowFlow dl.colspan-5 {
550
+ grid-template-columns: repeat(5, minmax(var(--inputMinWidth), 1fr));
551
+
552
+ & dt:nth-of-type(5n + 1),
553
+ & dd:nth-of-type(5n + 1) {
554
+ grid-column: 1;
555
+ }
556
+
557
+ & dt:nth-of-type(5n + 2),
558
+ & dd:nth-of-type(5n + 2) {
559
+ grid-column: 2;
560
+ }
561
+
562
+ & dt:nth-of-type(5n + 3),
563
+ & dd:nth-of-type(5n + 3) {
564
+ grid-column: 3;
565
+ }
566
+
567
+ & dt:nth-of-type(5n + 4),
568
+ & dd:nth-of-type(5n + 4) {
569
+ grid-column: 4;
570
+ }
571
+
572
+ & dt:nth-of-type(5n + 5),
573
+ & dd:nth-of-type(5n + 5) {
574
+ grid-column: 5;
575
+ }
576
+ }
577
+
578
+ &.lowFlow fieldset.colspan-4 dl,
579
+ &.lowFlow dl.colspan-4 {
580
+ grid-template-columns: repeat(4, minmax(var(--inputMinWidth), 1fr));
581
+
582
+ & dt:nth-of-type(4n + 1),
583
+ & dd:nth-of-type(4n + 1) {
584
+ grid-column: 1;
585
+ }
586
+
587
+ & dt:nth-of-type(4n + 2),
588
+ & dd:nth-of-type(4n + 2) {
589
+ grid-column: 2;
590
+ }
591
+
592
+ & dt:nth-of-type(4n + 3),
593
+ & dd:nth-of-type(4n + 3) {
594
+ grid-column: 3;
595
+ }
596
+
597
+ & dt:nth-of-type(4n + 4),
598
+ & dd:nth-of-type(4n + 4) {
599
+ grid-column: 4;
600
+ }
601
+ }
602
+
603
+ &.lowFlow fieldset.colspan-3 dl,
604
+ &.lowFlow dl.colspan-3 {
605
+ grid-template-columns: repeat(3, minmax(var(--inputMinWidth), 1fr));
606
+
607
+ // 1, 4, 7, ...
608
+ & dt:nth-of-type(3n + 1),
609
+ & dd:nth-of-type(3n + 1) {
610
+ grid-column: 1;
611
+ }
612
+
613
+ // 2, 5, 8, ...
614
+ & dt:nth-of-type(3n + 2),
615
+ & dd:nth-of-type(3n + 2) {
616
+ grid-column: 2;
617
+ }
618
+
619
+ // 3, 6, 9, ...
620
+ & dt:nth-of-type(3n + 3),
621
+ & dd:nth-of-type(3n + 3) {
622
+ grid-column: 3;
623
+ }
624
+ }
625
+
626
+ &.lowFlow fieldset.colspan-2 dl,
627
+ &.lowFlow dl.colspan-2 {
628
+ grid-template-columns: repeat(2, minmax(var(--inputMinWidth), 1fr));
629
+
630
+ & dt:nth-of-type(2n + 1),
631
+ & dd:nth-of-type(2n + 1) {
632
+ grid-column: 1;
633
+ }
634
+
635
+ & dt:nth-of-type(2n + 2),
636
+ & dd:nth-of-type(2n + 2) {
637
+ grid-column: 2;
638
+ }
639
+ }
640
+
641
+ &.lowFlow fieldset.colspan-1 dl,
642
+ &.lowFlow dl.colspan-1 {
643
+ grid-template-columns: repeat(1, minmax(var(--inputMinWidth), 1fr));
644
+
645
+ & dt:nth-of-type(n + 1),
646
+ & dd:nth-of-type(n + 1) {
647
+ grid-column: 1;
648
+ }
649
+ }
650
+
651
+ // #endregion
652
+
653
+ // #region invalid styling
654
+ [data-invalid-text] {
655
+ display: none;
656
+ color: var(--invalid);
657
+ }
658
+
659
+ input:not([type='submit'], [type='reset'], [type='image']),
660
+ select,
661
+ textarea {
662
+ &.invalid,
663
+ &:user-invalid {
664
+ border: var(--invalidBorder) !important;
665
+
666
+ ~ label:nth-of-type(2) {
667
+ color: var(--invalid) !important;
668
+ }
669
+
670
+ ~ [data-invalid-text] {
671
+ font-size: small;
672
+ display: flex;
673
+ }
674
+ }
675
+
676
+ }
677
+ // #endregion
678
+
679
+ // disable autofill yellow
680
+ input:-webkit-autofill,
681
+ input:-webkit-autofill:hover,
682
+ input:-webkit-autofill:focus,
683
+ input:-webkit-autofill:active,
684
+ textarea:-webkit-autofill,
685
+ textarea:-webkit-autofill:hover,
686
+ textarea:-webkit-autofill:focus,
687
+ textarea:-webkit-autofill:active,
688
+ select:-webkit-autofill,
689
+ select:-webkit-autofill:hover,
690
+ select:-webkit-autofill:focus,
691
+ select:-webkit-autofill:active {
692
+ -webkit-box-shadow: 0 0 0 1000px var(--formBackgroundColor) inset;
693
+ transition: background-color 5000s ease-in-out 0s, color 5000s ease-in-out 0s;
694
+ transition-delay: 5000s;
695
+ transition-property: background-color, color;
696
+ }
697
+
698
+ // update for scrollbars
699
+ @supports (scrollbar-color: auto) {
700
+ textarea {
701
+ scrollbar-color: var(--scrollbarColor) transparent;
702
+
703
+ &::-webkit-resizer {
704
+ border: none;
705
+ background-image: var(--customResizer);
706
+ background-size: 14px;
707
+ background-repeat: no-repeat;
708
+ background-position: 100%;
709
+ margin: 0 2px 2px 0;
710
+ }
711
+ }
712
+ }
713
+
714
+ // #region low flow form
715
+ &.lowFlow {
716
+ dl {
717
+ grid-template-columns: repeat(2, minmax(var(--inputMinWidth), 1fr));
718
+ grid-auto-flow: dense;
719
+ gap: 5px;
720
+
721
+ // 1, 4, 7, ...
722
+ & > dt:nth-of-type(2n + 1),
723
+ & > dd:nth-of-type(2n + 1) {
724
+ grid-column: 1;
725
+ }
726
+
727
+ // 2, 5, 8, ...
728
+ & > dt:nth-of-type(2n + 2),
729
+ & > dd:nth-of-type(2n + 2) {
730
+ grid-column: 2;
731
+ }
732
+
733
+ dt {
734
+ // add required asterisk
735
+ &:has(+ dd input:required) {
736
+ label::after {
737
+ content: ' *';
738
+ color: red;
739
+ }
740
+ }
741
+ }
742
+
743
+
744
+ dd {
745
+ margin-bottom: 10px;
746
+
747
+ // nudge single checkboxes to match checkbox groups
748
+ &:not(.checkboxes) {
749
+ input[type="checkbox"] {
750
+ margin-left: 10px;
751
+ }
752
+ }
753
+
754
+ // remove "x" padding
755
+ input:not([type='submit'], [type='reset'], [type='image'], [type=checkbox], [type=radio], [type="range"]),
756
+ select,
757
+ textarea {
758
+ padding-right: 6px;
759
+ }
760
+
761
+ // subtext
762
+ label {
763
+ margin-top: -5px;
764
+ font-size: small;
765
+ color: var(--placeholderColor);
766
+ }
767
+ }
768
+ }
769
+
770
+ .checkboxes ul,
771
+ .radios ul {
772
+ margin-top: calc(var(--inputTopMargin) / 2);
773
+ }
774
+ }
775
+ // #endregion
776
+
777
+ // #region container queries
778
+ // The container is the <fieldset> element
779
+ @container semanticForm (width > 2250px) {
780
+ &.lowFlow fieldset dl,
781
+ &.lowFlow dl {
782
+ grid-template-columns: repeat(6, minmax(var(--inputMinWidth), 1fr));
783
+
784
+ & dt:nth-of-type(6n + 1),
785
+ & dd:nth-of-type(6n + 1) {
786
+ grid-column: 1;
787
+ }
788
+
789
+ & dt:nth-of-type(6n + 2),
790
+ & dd:nth-of-type(6n + 2) {
791
+ grid-column: 2;
792
+ }
793
+
794
+ & dt:nth-of-type(6n + 3),
795
+ & dd:nth-of-type(6n + 3) {
796
+ grid-column: 3;
797
+ }
798
+
799
+ & dt:nth-of-type(6n + 4),
800
+ & dd:nth-of-type(6n + 4) {
801
+ grid-column: 4;
802
+ }
803
+
804
+ & dt:nth-of-type(6n + 5),
805
+ & dd:nth-of-type(6n + 5) {
806
+ grid-column: 5;
807
+ }
808
+
809
+ & dt:nth-of-type(6n + 6),
810
+ & dd:nth-of-type(6n + 6) {
811
+ grid-column: 6;
812
+ }
813
+ }
814
+ }
815
+
816
+ @container semanticForm (width < 2250px) {
817
+ &.lowFlow fieldset dl,
818
+ &.lowFlow dl {
819
+ grid-template-columns: repeat(5, minmax(var(--inputMinWidth), 1fr));
820
+
821
+ & dt:nth-of-type(5n + 1),
822
+ & dd:nth-of-type(5n + 1) {
823
+ grid-column: 1;
824
+ }
825
+
826
+ & dt:nth-of-type(5n + 2),
827
+ & dd:nth-of-type(5n + 2) {
828
+ grid-column: 2;
829
+ }
830
+
831
+ & dt:nth-of-type(5n + 3),
832
+ & dd:nth-of-type(5n + 3) {
833
+ grid-column: 3;
834
+ }
835
+
836
+ & dt:nth-of-type(5n + 4),
837
+ & dd:nth-of-type(5n + 4) {
838
+ grid-column: 4;
839
+ }
840
+
841
+ & dt:nth-of-type(5n + 5),
842
+ & dd:nth-of-type(5n + 5) {
843
+ grid-column: 5;
844
+ }
845
+ }
846
+ }
847
+
848
+ @container semanticForm (width < 1300px) {
849
+ fieldset.colspan-5 dl,
850
+ dl.colspan-5 {
851
+ grid-template-columns: repeat(4, minmax(var(--inputMinWidth), 1fr)) !important;
852
+ }
853
+
854
+ div.colspan-5 {
855
+ grid-column: span 4 !important;
856
+ }
857
+
858
+ &.lowFlow fieldset dl,
859
+ &.lowFlow dl,
860
+ &.lowFlow fieldset.colspan-5 dl,
861
+ &.lowFlow dl.colspan-5 {
862
+ grid-template-columns: repeat(4, minmax(var(--inputMinWidth), 1fr));
863
+
864
+ & dt:nth-of-type(4n + 1),
865
+ & dd:nth-of-type(4n + 1) {
866
+ grid-column: 1;
867
+ }
868
+
869
+ & dt:nth-of-type(4n + 2),
870
+ & dd:nth-of-type(4n + 2) {
871
+ grid-column: 2;
872
+ }
873
+
874
+ & dt:nth-of-type(4n + 3),
875
+ & dd:nth-of-type(4n + 3) {
876
+ grid-column: 3;
877
+ }
878
+
879
+ & dt:nth-of-type(4n + 4),
880
+ & dd:nth-of-type(4n + 4) {
881
+ grid-column: 4;
882
+ }
883
+ }
884
+ }
885
+
886
+ @container semanticForm (width < 1050px) {
887
+ fieldset.colspan-4 dl,
888
+ fieldset.colspan-5 dl,
889
+ dl.colspan-4,
890
+ dl.colspan-5 {
891
+ grid-template-columns: repeat(3, minmax(var(--inputMinWidth), 1fr)) !important;
892
+ }
893
+
894
+ div.colspan-4, div.colspan-5 {
895
+ grid-column: span 3 !important;
896
+ }
897
+
898
+ &.lowFlow fieldset dl,
899
+ &.lowFlow dl,
900
+ &.lowFlow fieldset.colspan-4 dl,
901
+ &.lowFlow dl.colspan-4,
902
+ &.lowFlow fieldset.colspan-5 dl,
903
+ &.lowFlow dl.colspan-5 {
904
+ grid-template-columns: repeat(3, minmax(var(--inputMinWidth), 1fr));
905
+
906
+ & dt:nth-of-type(3n + 1),
907
+ & dd:nth-of-type(3n + 1) {
908
+ grid-column: 1;
909
+ }
910
+
911
+ & dt:nth-of-type(3n + 2),
912
+ & dd:nth-of-type(3n + 2) {
913
+ grid-column: 2;
914
+ }
915
+
916
+ & dt:nth-of-type(3n + 3),
917
+ & dd:nth-of-type(3n + 3) {
918
+ grid-column: 3;
919
+ }
920
+ }
921
+ }
922
+
923
+ @container semanticForm (width < 800px) {
924
+ fieldset.colspan-3 dl,
925
+ fieldset.colspan-4 dl,
926
+ fieldset.colspan-5 dl,
927
+ dl.colspan-3,
928
+ dl.colspan-4,
929
+ dl.colspan-5 {
930
+ grid-template-columns: repeat(2, minmax(var(--inputMinWidth), 1fr)) !important;
931
+ }
932
+
933
+ div.colspan-3,
934
+ div.colspan-4,
935
+ div.colspan-5 {
936
+ grid-column: span 2 !important;
937
+ }
938
+
939
+ &.lowFlow fieldset dl,
940
+ &.lowFlow dl,
941
+ &.lowFlow fieldset.colspan-3 dl,
942
+ &.lowFlow dl.colspan-3,
943
+ &.lowFlow fieldset.colspan-4 dl,
944
+ &.lowFlow dl.colspan-4,
945
+ &.lowFlow fieldset.colspan-5 dl,
946
+ &.lowFlow dl.colspan-5 {
947
+ grid-template-columns: repeat(2, minmax(var(--inputMinWidth), 1fr));
948
+
949
+ & dt:nth-of-type(2n + 1),
950
+ & dd:nth-of-type(2n + 1) {
951
+ grid-column: 1;
952
+ }
953
+
954
+ & dt:nth-of-type(2n + 2),
955
+ & dd:nth-of-type(2n + 2) {
956
+ grid-column: 2;
957
+ }
958
+ }
959
+ }
960
+
961
+ @container semanticForm (width < 550px) {
962
+ fieldset.colspan-2 dl,
963
+ fieldset.colspan-3 dl,
964
+ fieldset.colspan-4 dl,
965
+ fieldset.colspan-5 dl,
966
+ dl.colspan-2,
967
+ dl.colspan-3,
968
+ dl.colspan-4,
969
+ dl.colspan-5,
970
+ dl {
971
+ grid-template-columns: repeat(1, minmax(var(--inputMinWidth), 1fr)) !important;
972
+ }
973
+
974
+ div.colspan-2, div.colspan-3, div.colspan-4, div.colspan-5 {
975
+ grid-column: span 1 !important;
976
+ }
977
+
978
+ &.lowFlow fieldset dl,
979
+ &.lowFlow dl,
980
+ &.lowFlow fieldset.colspan-2 dl,
981
+ &.lowFlow dl.colspan-2,
982
+ &.lowFlow fieldset.colspan-3 dl,
983
+ &.lowFlow dl.colspan-3,
984
+ &.lowFlow fieldset.colspan-4 dl,
985
+ &.lowFlow dl.colspan-4,
986
+ &.lowFlow fieldset.colspan-5 dl,
987
+ &.lowFlow dl.colspan-5 {
988
+ grid-template-columns: repeat(1, minmax(var(--inputMinWidth), 1fr));
989
+
990
+ & dt:nth-of-type(n + 1),
991
+ & dd:nth-of-type(n + 1) {
992
+ grid-column: 1;
993
+ }
994
+ }
995
+ }
996
+ // #endregion
997
+ }