semantic-forms 5.1.10 → 5.1.12

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.
@@ -96,6 +96,10 @@ table.semanticForms.light {
96
96
  container-type: inline-size;
97
97
  container-name: semanticForm;
98
98
 
99
+ @supports (interpolate-size: allow-keywords) { // https://caniuse.com/wf-interpolate-size
100
+ interpolate-size: allow-keywords;
101
+ }
102
+
99
103
  // due to the specificity of some of these rules, [hidden] won't actually hide things, so we're forcing the issue
100
104
  [hidden] {
101
105
  display: none !important;
@@ -254,6 +258,10 @@ table.semanticForms.light {
254
258
  line-height: 1.5;
255
259
  width: 100%;
256
260
  min-height: 38px;
261
+
262
+ &[data-auto-grow] {
263
+ field-sizing: content;
264
+ }
257
265
  }
258
266
 
259
267
  input[type="search"] {
@@ -359,6 +367,15 @@ table.semanticForms.light {
359
367
  filter: brightness(1.05);
360
368
  }
361
369
  }
370
+
371
+ .button-link {
372
+ display: block;
373
+
374
+ &:visited,
375
+ &:link {
376
+ color: var(--semanticFormsTextColor) !important;
377
+ }
378
+ }
362
379
  // #endregion
363
380
 
364
381
  // #region invalid styling
@@ -430,7 +447,7 @@ table.semanticForms.light {
430
447
  }
431
448
  }
432
449
 
433
- // #region summary
450
+ // #region details
434
451
  details {
435
452
  box-sizing: border-box; // ensure sizings match across browsers
436
453
  position: relative;
@@ -443,14 +460,26 @@ table.semanticForms.light {
443
460
  padding: 20px 10px 10px 10px;
444
461
  margin-bottom: 15px;
445
462
  min-height: calc(var(--semanticFormsFontSize) + 20px);
446
-
463
+
447
464
  &::details-content {
448
465
  visibility: hidden;
449
466
  opacity: 0;
450
467
  transition: opacity 250ms ease-in, visibility 0ms ease-in 250ms;
451
468
  }
469
+
470
+ @supports (interpolate-size: allow-keywords) { // https://caniuse.com/wf-interpolate-size
471
+ transition: opacity 250ms ease-in, visibility 0ms ease-in 250ms, height 250ms;
472
+
473
+ &::details-content {
474
+ height: 0;
475
+ overflow: hidden;
476
+ transition: height 250ms, content-visibility 250ms;
477
+ transition-behavior: allow-discrete;
478
+ }
479
+ }
452
480
 
453
481
  summary {
482
+ cursor: pointer;
454
483
  margin: 0;
455
484
  line-height: 1;
456
485
  position: absolute;
@@ -477,20 +506,24 @@ table.semanticForms.light {
477
506
  transition: 250ms transform ease;
478
507
  }
479
508
  }
480
- }
481
509
 
482
- details[open] {
483
- padding-top: 35px; // TODO: remove this when animated detail label is reintroduced
510
+ &[open] {
511
+ &::details-content {
512
+ visibility: visible;
513
+ opacity: 1;
514
+ transition: opacity 250ms ease-in, visibility 0ms ease-in 0ms;
515
+ }
484
516
 
485
- &::details-content {
486
- visibility: visible;
487
- opacity: 1;
488
- transition: opacity 250ms ease-in, visibility 0ms ease-in 0ms;
489
- }
517
+ @supports (interpolate-size: allow-keywords) {
518
+ &::details-content {
519
+ height: auto;
520
+ }
521
+ }
490
522
 
491
- summary {
492
- &::after {
493
- transform: rotate(90deg);
523
+ summary {
524
+ &::before {
525
+ transform: rotate(90deg);
526
+ }
494
527
  }
495
528
  }
496
529
  }
@@ -498,10 +531,6 @@ table.semanticForms.light {
498
531
  details[open], summary {
499
532
  margin-bottom: 10px;
500
533
  }
501
-
502
- summary {
503
- cursor: pointer;
504
- }
505
534
  // #endregion
506
535
 
507
536
  // update for scrollbars
@@ -556,6 +585,42 @@ table.semanticForms.light {
556
585
  &:not(.singleCheckbox, .singleRadio) {
557
586
  display: flex;
558
587
  flex-direction: column;
588
+
589
+ // unless there is a button present, which will be placed beside the input
590
+ &:has(button:not(.clear, .show), input[type="submit"]:not(.clear, .show)) {
591
+ display: grid;
592
+ grid-template-columns: 2fr 1fr;
593
+
594
+ button.clear, button.show {
595
+ right: 36%; // adjust clear/show button to grid
596
+ }
597
+
598
+ input:not([type="submit"]), select, textarea {
599
+ grid-row: 1 / 2;
600
+ grid-column: 1 / 2;
601
+ }
602
+
603
+ button:not(.clear, .show),
604
+ input[type="submit"]:not(.clear, .show) {
605
+ grid-row: 1 / 2;
606
+ grid-column: 2 / 3;
607
+ width: 100%;
608
+ max-width: 100%;
609
+ padding: 10px; // reduce default padding to allow more button text to show
610
+ margin-top: var(--semanticFormsInputTopMargin);
611
+ height: var(--semanticFormsInputHeight);
612
+ text-overflow: ellipsis;
613
+ white-space: nowrap;
614
+ overflow: hidden;
615
+ display: inline-block;
616
+ }
617
+
618
+ // TODO: handle help text as well (will need to be grid-columns: 0 2 or whatever it is)
619
+ label:nth-of-type(2) {
620
+ grid-row: 2 / 3;
621
+ grid-column: 1 / -1;
622
+ }
623
+ }
559
624
  }
560
625
 
561
626
  &.singleCheckbox,
@@ -572,7 +637,7 @@ table.semanticForms.light {
572
637
  // single checkbox subtext
573
638
  label:nth-of-type(2) {
574
639
  grid-column: 1 / -1;
575
- padding-left: 20px;
640
+ padding: 0 10px;
576
641
  font-size: small;
577
642
  color: var(--semanticFormsTextColor);
578
643
  }
@@ -647,6 +712,8 @@ table.semanticForms.light {
647
712
  }
648
713
 
649
714
  span.help {
715
+ display: grid;
716
+ place-items: center;
650
717
  cursor: help;
651
718
  pointer-events: auto;
652
719
 
@@ -673,16 +740,8 @@ table.semanticForms.light {
673
740
  &:focus:not([type=checkbox], [type=radio], .no-float-label) ~ label:first-of-type,
674
741
  &:not(:placeholder-shown):not(.no-float-label):not([type=checkbox]):not([type=radio]) ~ label:first-of-type {
675
742
  color: var(--semanticFormsTextColor) !important;
676
- // TODO: finish this work on making the help icon responsive
677
- // width: 100%;
678
- // width: calc(100% + 20px);
679
743
  transform: translateY(-150%) scale(0.7);
680
-
681
- // span.required,
682
- // span.help {
683
- // position: static;
684
- // right: auto;
685
- // }
744
+ width: 100%;
686
745
  }
687
746
  }
688
747
 
@@ -723,7 +782,7 @@ table.semanticForms.light {
723
782
  // subtext
724
783
  label:nth-of-type(2) {
725
784
  margin-top: -5px;
726
- padding-left: 20px;
785
+ padding: 0 10px;
727
786
  font-size: small;
728
787
  color: var(--semanticFormsTextColor);
729
788
  }
@@ -786,30 +845,15 @@ table.semanticForms.light {
786
845
  align-items: center;
787
846
  gap: 5px;
788
847
 
789
- // TODO: same as below
790
- // &:has(span.help) {
791
- // width: 80%;
792
- // padding-right: 20px;
793
- // }
794
-
795
- // &:has(span.required) {
796
- // width: 80%;
797
- // padding-right: 10px;
798
- // }
799
-
800
848
  span.required {
801
- // TODO: this places the required asterisk too far to the right when the float label is shrunk
802
- // position: absolute;
803
- // right: 0;
804
849
  cursor: help;
805
850
  pointer-events: auto;
806
851
  color: red;
807
852
  }
808
853
 
809
854
  span.help {
810
- // TODO: this places the help icon too far to the right when the float label is shrunk
811
- // position: absolute;
812
- // right: 0;
855
+ display: grid;
856
+ place-items: center;
813
857
  cursor: help;
814
858
  pointer-events: auto;
815
859
 
@@ -817,16 +861,6 @@ table.semanticForms.light {
817
861
  width: 80%;
818
862
  }
819
863
  }
820
-
821
- // // TODO: cover the case where an input is required AND has help text
822
- // &:has(span.required, span.help) {
823
- // width: 80%;
824
- // padding-right: 30px;
825
-
826
- // span.required {
827
- // right: 18px;
828
- // }
829
- // }
830
864
  }
831
865
  }
832
866
 
@@ -835,6 +869,9 @@ table.semanticForms.light {
835
869
  position: relative;
836
870
 
837
871
  label {
872
+ display: flex;
873
+ align-items: center;
874
+ gap: 5px;
838
875
  z-index: 2; // ensure the hoverable icon is interactable
839
876
  user-select: auto;
840
877
  color: var(--semanticFormsTextColor);
@@ -848,16 +885,11 @@ table.semanticForms.light {
848
885
  overflow: hidden;
849
886
  text-overflow: ellipsis;
850
887
  min-width: 0;
851
- width: calc(100% + 20px);
852
-
853
- // TODO: remove this? // &:has(span.help) {
854
- // width: 100%;
855
- // padding-right: 20px;
856
- // }
888
+ width: 100%;
857
889
 
858
890
  span.help {
859
- // TODO: remove this? // position: absolute;
860
- // right: 0;
891
+ display: grid;
892
+ place-items: center;
861
893
  cursor: help;
862
894
  pointer-events: auto;
863
895
  }
@@ -872,14 +904,28 @@ table.semanticForms.light {
872
904
  }
873
905
 
874
906
  label > span {
875
- // TODO: remove this? // position: absolute;
876
- // right: 0;
877
907
  margin-left: 5px;
878
908
  cursor: help;
879
909
  pointer-events: auto;
880
910
  color: red;
881
911
  }
912
+ }
913
+ }
914
+
915
+ // data-max-content CSS
916
+ &:has([data-max-content]) {
917
+ max-width: max-content;
918
+ min-width: 150px;
882
919
 
920
+ dd {
921
+ width: max-content;
922
+
923
+ input, select {
924
+ // this is not currently supported in FireFox or Safari, and is progressively enhanced with JS
925
+ field-sizing: content;
926
+ min-width: 150px;
927
+ max-width: max-content;
928
+ }
883
929
  }
884
930
  }
885
931
  }
@@ -1187,71 +1233,71 @@ table.semanticForms.light {
1187
1233
 
1188
1234
  // #region low flow form
1189
1235
  &.lowFlow {
1190
- gap: 5px;
1236
+ gap: 5px;
1191
1237
 
1192
- dl {
1193
- grid-auto-flow: dense;
1194
- }
1238
+ dl {
1239
+ grid-auto-flow: dense;
1240
+ }
1195
1241
 
1196
- // 1, 4, 7, ...
1197
- & > dt:nth-of-type(2n + 1),
1198
- & > dd:nth-of-type(2n + 1) {
1199
- grid-column: 1;
1200
- }
1242
+ // 1, 4, 7, ...
1243
+ & > dt:nth-of-type(2n + 1),
1244
+ & > dd:nth-of-type(2n + 1) {
1245
+ grid-column: 1;
1246
+ }
1201
1247
 
1202
- // 2, 5, 8, ...
1203
- & > dt:nth-of-type(2n + 2),
1204
- & > dd:nth-of-type(2n + 2) {
1205
- grid-column: 2;
1206
- }
1248
+ // 2, 5, 8, ...
1249
+ & > dt:nth-of-type(2n + 2),
1250
+ & > dd:nth-of-type(2n + 2) {
1251
+ grid-column: 2;
1252
+ }
1207
1253
 
1208
- dt {
1209
- min-width: var(--semanticFormsInputMinWidth) !important; /* this matches the max-width of js-enabled inputs */
1254
+ dt {
1255
+ min-width: var(--semanticFormsInputMinWidth) !important; /* this matches the max-width of js-enabled inputs */
1210
1256
 
1211
- // add required asterisk
1212
- &:has(+ dd input:required) {
1213
- label::after {
1214
- content: ' *';
1215
- color: red;
1216
- }
1257
+ // add required asterisk
1258
+ &:has(+ dd input:required) {
1259
+ label::after {
1260
+ content: ' *';
1261
+ color: red;
1217
1262
  }
1218
1263
  }
1264
+ }
1219
1265
 
1220
1266
 
1221
- dd {
1222
- margin-bottom: 10px;
1223
- min-width: var(--semanticFormsInputMinWidth) !important; /* this matches the max-width of js-enabled inputs */
1267
+ dd {
1268
+ margin-bottom: 10px;
1269
+ min-width: var(--semanticFormsInputMinWidth) !important; /* this matches the max-width of js-enabled inputs */
1224
1270
 
1225
- // nudge single checkboxes to match checkbox groups
1226
- &:not(.checkboxes) {
1227
- input[type=checkbox] {
1228
- margin-left: 10px;
1229
- }
1271
+ // nudge single checkboxes to match checkbox groups
1272
+ &:not(.checkboxes) {
1273
+ input[type=checkbox] {
1274
+ margin-left: 10px;
1230
1275
  }
1276
+ }
1231
1277
 
1232
- // remove "x" padding
1233
- input:not([type=submit], [type=reset], [type=image], [type=checkbox], [type=radio], [type=range]),
1234
- select,
1235
- textarea {
1236
- padding-right: 6px;
1237
- }
1278
+ // remove "x" padding
1279
+ input:not([type=submit], [type=reset], [type=image], [type=checkbox], [type=radio], [type=range]),
1280
+ select,
1281
+ textarea {
1282
+ padding-right: 6px;
1283
+ }
1238
1284
 
1239
- // subtext
1240
- label {
1241
- margin-top: -5px;
1242
- font-size: small;
1243
- color: var(--semanticFormsPlaceholderColor);
1244
- }
1285
+ // subtext
1286
+ label {
1287
+ margin-top: -5px;
1288
+ font-size: small;
1289
+ color: var(--semanticFormsPlaceholderColor);
1245
1290
  }
1246
1291
  }
1292
+ }
1247
1293
 
1248
- .checkboxes ul,
1249
- .radios ul {
1250
- margin-top: var(--semanticFormsInputTopMargin);
1251
- }
1294
+ .checkboxes ul,
1295
+ .radios ul {
1296
+ margin-top: var(--semanticFormsInputTopMargin);
1252
1297
  }
1253
- // #endregion
1254
1298
  }
1299
+ // #endregion
1300
+ }
1255
1301
 
1256
1302
  // #region tables
1257
1303
 
@@ -1301,9 +1347,8 @@ table.semanticForms {
1301
1347
  }
1302
1348
 
1303
1349
  // adjust styling of button menus in tables
1304
- menu:has(li > input, li > label, li > button, li > select, li > textarea) {
1350
+ menu:has(li > input, li > label, li > button, li > select, li > textarea, li > a) {
1305
1351
  width: max-content;
1306
1352
  }
1307
-
1308
1353
  }
1309
1354
  // #endregion