semantic-forms 5.3.3 → 5.3.5

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 CHANGED
@@ -1,3 +1,13 @@
1
+ ## 5.3.5
2
+
3
+ - Fixed visual issues that occurred on standalone and nested `<details>` elements.
4
+ - Updated various dependencies.
5
+
6
+ ## 5.3.4
7
+
8
+ - Reverted a change to single radio and checkbox inputs.
9
+ - Added sample forms to the demo page.
10
+
1
11
  ## 5.3.3
2
12
 
3
13
  - Fixed a bug where radio and checkbox inputs would be moved to the end of the parent `<dl>`.
@@ -1245,21 +1245,23 @@ form.semanticForms:not(.semanticFormsActive) dd input[type=button]:not(.clear, .
1245
1245
  padding: 10px 10px 20px 10px;
1246
1246
  margin-bottom: 15px;
1247
1247
  }
1248
- .semanticForms fieldset fieldset {
1248
+ .semanticForms fieldset fieldset, .semanticForms fieldset details {
1249
1249
  background-color: var(--semanticFormsNestedFieldsetBgColor);
1250
1250
  border: var(--semanticFormsNestedFieldsetBorder);
1251
1251
  margin: 0;
1252
1252
  }
1253
1253
  .semanticForms fieldset fieldset input:not([type=submit], [type=reset], [type=button], [type=image], [type=checkbox], [type=radio]),
1254
1254
  .semanticForms fieldset fieldset select,
1255
- .semanticForms fieldset fieldset textarea {
1255
+ .semanticForms fieldset fieldset textarea, .semanticForms fieldset details input:not([type=submit], [type=reset], [type=button], [type=image], [type=checkbox], [type=radio]),
1256
+ .semanticForms fieldset details select,
1257
+ .semanticForms fieldset details textarea {
1256
1258
  background-color: var(--semanticFormsNestedInputBgColor);
1257
1259
  }
1258
1260
  .semanticForms details {
1259
1261
  box-sizing: border-box;
1260
1262
  position: relative;
1261
- background-color: var(--semanticFormsNestedFieldsetBgColor);
1262
- border: var(--semanticFormsNestedFieldsetBorder);
1263
+ background-color: var(--semanticFormsFormSubBgColor);
1264
+ border: 1px var(--semanticFormsSubBorderColor) solid;
1263
1265
  border-radius: var(--semanticFormsBorderRadius);
1264
1266
  display: flex;
1265
1267
  flex-direction: column;
@@ -1329,6 +1331,18 @@ form.semanticForms:not(.semanticFormsActive) dd input[type=button]:not(.clear, .
1329
1331
  margin-top: 15px;
1330
1332
  margin-bottom: 15px;
1331
1333
  }
1334
+ .semanticForms details details,
1335
+ .semanticForms details fieldset {
1336
+ margin-top: 10px;
1337
+ background-color: var(--semanticFormsNestedFieldsetBgColor);
1338
+ border: var(--semanticFormsNestedFieldsetBorder);
1339
+ }
1340
+ .semanticForms details details[open] summary::before {
1341
+ transform: rotate(90deg);
1342
+ }
1343
+ .semanticForms details details:not([open]) summary::before {
1344
+ transform: rotate(0deg);
1345
+ }
1332
1346
  .semanticForms dl {
1333
1347
  display: grid;
1334
1348
  grid-template-columns: repeat(auto-fit, minmax(var(--semanticFormsInputMinWidth), 1fr));
@@ -1352,9 +1366,6 @@ form.semanticForms:not(.semanticFormsActive) dd input[type=button]:not(.clear, .
1352
1366
  min-width: 150px;
1353
1367
  max-width: max-content;
1354
1368
  }
1355
- .semanticForms dl div:not(:has(ul, ol)):has(dd input[type=radio]:only-of-type, dd input[type=checkbox]:only-of-type) {
1356
- padding-top: 22px;
1357
- }
1358
1369
  .semanticForms dl div:has(dd > button:only-child, dd > input[type=button]:only-child, dd > input[type=submit]:only-child, dd > input[type=reset]:only-child) dt label {
1359
1370
  display: none;
1360
1371
  }
@@ -1456,6 +1467,11 @@ form.semanticForms:not(.semanticFormsActive) dd input[type=button]:not(.clear, .
1456
1467
  gap: 10px;
1457
1468
  list-style-type: none;
1458
1469
  }
1470
+ .semanticForms menu:has(li > input, li > label, li > button, li > select, li > textarea) li,
1471
+ .semanticForms ul:has(li > input, li > label, li > button, li > select, li > textarea) li {
1472
+ display: flex;
1473
+ align-items: center;
1474
+ }
1459
1475
  .semanticForms div:has(.align-start) {
1460
1476
  display: flex;
1461
1477
  justify-content: start;
@@ -76,6 +76,7 @@
76
76
  <li><a href="#low-flow-p_tag_elements">P tag elements</a></li>
77
77
  </ul>
78
78
  </li>
79
+ <li><a href="#sample_forms">Sample forms</a></li>
79
80
  <li><a href="#non_form_related_elements">Non-form related HTML elements</a></li>
80
81
  </ul>
81
82
  </details>
@@ -942,7 +943,7 @@
942
943
  </details>
943
944
 
944
945
  <details>
945
- <summary>Another detail element with a nested fieldset</summary>
946
+ <summary>Another detail element with a nested fieldset and details element</summary>
946
947
  <dl>
947
948
  <div>
948
949
  <dt><label for="another-detail-input-1">Detail input</label></dt>
@@ -960,9 +961,30 @@
960
961
  </div>
961
962
  </dl>
962
963
  </fieldset>
964
+
965
+ <details>
966
+ <summary>Some details</summary>
967
+ <dl>
968
+ <div>
969
+ <dt><label for="another-detail-input-3">Nested detail input</label></dt>
970
+ <dd><input type="text" name="another-detail-input-3" id="another-detail-input-3"></dd>
971
+ </div>
972
+ </dl>
973
+ </details>
963
974
  </details>
964
975
  </fieldset>
965
976
 
977
+ <details>
978
+ <summary>Standalone details</summary>
979
+
980
+ <dl>
981
+ <div>
982
+ <dt><label for="another-detail-input-4">Nested detail input 2</label></dt>
983
+ <dd><input type="text" name="another-detail-input-4" id="another-detail-input-4"></dd>
984
+ </div>
985
+ </dl>
986
+ </details>
987
+
966
988
  <fieldset id="buttons">
967
989
  <legend>Buttons</legend>
968
990
  <dl>
@@ -2326,6 +2348,71 @@
2326
2348
  </fieldset>
2327
2349
  </form>
2328
2350
 
2351
+ <hr>
2352
+
2353
+ <h2 id="sample_forms">Sample forms</h2>
2354
+
2355
+ <section style="display: flex; flex-wrap: wrap; gap: 20px;">
2356
+ <article id="form1" style="width: 370px;">
2357
+ <form action="/somewhere" method="post" class="semanticForms">
2358
+ <fieldset>
2359
+ <legend>One column form</legend>
2360
+
2361
+ <dl>
2362
+ <div>
2363
+ <dt><label for="form1-name">Name</label></dt>
2364
+ <dd><input type="text" name="form1-name" id="form1-name"></dd>
2365
+ </div>
2366
+
2367
+ <div>
2368
+ <dt><label for="form1-email">Email</label></dt>
2369
+ <dd><input type="text" name="form1-email" id="form1-email"></dd>
2370
+ </div>
2371
+
2372
+ <div>
2373
+ <dt><label for="form1-agree">I agree to the Terms and Conditions</label></dt>
2374
+ <dd><input type="checkbox" name="form1-agree" id="form1-agree"></dd>
2375
+ </div>
2376
+
2377
+ <div>
2378
+ <dt><label for="form1-receive-emails">I want to sign up for the weekly newsletter</label></dt>
2379
+ <dd><input type="checkbox" name="form1-receive-emails" id="form1-receive-emails"></dd>
2380
+ </div>
2381
+ </dl>
2382
+ <menu>
2383
+ <li><button type="submit">Sign up</button></li>
2384
+ </menu>
2385
+ </fieldset>
2386
+ </form>
2387
+ </article>
2388
+
2389
+ <article id="form2" style="width: 550px;">
2390
+ <form action="/somewhere" method="post" class="semanticForms">
2391
+ <fieldset>
2392
+ <legend>Two column form</legend>
2393
+
2394
+ <dl class="colspan-2">
2395
+ <div>
2396
+ <dt><label for="form2-username">Username</label></dt>
2397
+ <dd><input type="text" name="form2-username" id="form2-username"></dd>
2398
+ </div>
2399
+
2400
+ <div>
2401
+ <dt><label for="form2-password">Password</label></dt>
2402
+ <dd><input type="password" name="form2-password" id="form2-password"></dd>
2403
+ </div>
2404
+ </dl>
2405
+ <menu>
2406
+ <li><button type="submit">Sign in</button></li>
2407
+ <li><a href="/somewhere">Forgot password?</a></li>
2408
+ </menu>
2409
+ </fieldset>
2410
+ </form>
2411
+ </article>
2412
+ </section>
2413
+
2414
+ <hr>
2415
+
2329
2416
  <h2 id="non_form_related_elements">Non-form related HTML elements</h2>
2330
2417
  <form action="/somewhere" method="post" class="semanticForms">
2331
2418
  <p>This is some regular HTML that should not be affected by any semantic forms styles</p>
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": "5.3.3",
11
+ "version": "5.3.5",
12
12
  "files": [
13
13
  "dist",
14
14
  "semanticForms.scss",
@@ -30,13 +30,13 @@
30
30
  "readmeFilename": "README.md",
31
31
  "devDependencies": {
32
32
  "@jsdevtools/coverage-istanbul-loader": "3.0.5",
33
- "@playwright/test": "1.57.0",
34
- "eslint": "9.39.1",
35
- "eslint-plugin-html": "8.1.3",
33
+ "@playwright/test": "1.58.2",
34
+ "eslint": "10.0.0",
35
+ "eslint-plugin-html": "8.1.4",
36
36
  "express": "5.2.1",
37
37
  "nodemon": "3.1.11",
38
38
  "nyc": "17.1.0",
39
- "sass": "1.96.0",
39
+ "sass": "1.97.3",
40
40
  "http-server": "14.1.1",
41
41
  "standard": "17.1.2",
42
42
  "webpack-cli": "6.0.1"
@@ -15,8 +15,8 @@
15
15
  padding: 10px 10px 20px 10px;
16
16
  margin-bottom: 15px;
17
17
 
18
- // nested fieldsets are darkened
19
- fieldset {
18
+ // nested fieldsets and details are darkened
19
+ fieldset, details {
20
20
  background-color: var(--semanticFormsNestedFieldsetBgColor);
21
21
  border: var(--semanticFormsNestedFieldsetBorder);
22
22
  margin: 0;
@@ -33,8 +33,8 @@
33
33
  details {
34
34
  box-sizing: border-box; // ensure sizings match across browsers
35
35
  position: relative;
36
- background-color: var(--semanticFormsNestedFieldsetBgColor);
37
- border: var(--semanticFormsNestedFieldsetBorder);
36
+ background-color: var(--semanticFormsFormSubBgColor);
37
+ border: 1px var(--semanticFormsSubBorderColor) solid;
38
38
  border-radius: var(--semanticFormsBorderRadius);
39
39
  display: flex;
40
40
  flex-direction: column;
@@ -118,6 +118,21 @@
118
118
  }
119
119
  }
120
120
 
121
+ details details,
122
+ details fieldset {
123
+ margin-top: 10px;
124
+ background-color: var(--semanticFormsNestedFieldsetBgColor);
125
+ border: var(--semanticFormsNestedFieldsetBorder);
126
+ }
127
+
128
+ details details[open] summary::before {
129
+ transform: rotate(90deg);
130
+ }
131
+
132
+ details details:not([open]) summary::before {
133
+ transform: rotate(0deg);
134
+ }
135
+
121
136
  dl {
122
137
  display: grid;
123
138
  grid-template-columns: repeat(auto-fit, minmax(var(--semanticFormsInputMinWidth), 1fr));
@@ -145,11 +160,6 @@
145
160
  }
146
161
  }
147
162
 
148
- &:not(:has(ul, ol)):has(dd input[type=radio]:only-of-type, dd input[type=checkbox]:only-of-type) {
149
- // place in line with other inputs w/ labels
150
- padding-top: 22px;
151
- }
152
-
153
163
  // hide labels for singular buttons
154
164
  &:has(dd > button:only-child, dd > input[type=button]:only-child, dd > input[type=submit]:only-child, dd > input[type=reset]:only-child) {
155
165
  dt label {
@@ -289,6 +299,11 @@
289
299
  flex-wrap: wrap;
290
300
  gap: 10px;
291
301
  list-style-type: none;
302
+
303
+ li {
304
+ display: flex;
305
+ align-items: center;
306
+ }
292
307
  }
293
308
 
294
309
  div:has(.align-start) {