semantic-forms 5.3.16 → 5.3.18
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 +29 -0
- package/dist/semantic-forms.cjs +59 -21
- package/dist/semantic-forms.cjs.map +1 -1
- package/dist/semantic-forms.css +597 -357
- package/dist/semantic-forms.css.map +1 -1
- package/dist/semantic-forms.js +59 -21
- package/dist/semantic-forms.js.map +1 -1
- package/dist/semantic-forms.min.js +1 -1
- package/dist/semantic-forms.min.js.map +1 -1
- package/dist/semantic-forms.min.mjs +1 -1
- package/dist/semantic-forms.min.mjs.map +1 -1
- package/dist/semantic-forms.mjs +59 -21
- package/dist/semantic-forms.mjs.map +1 -1
- package/docs/statics/css/semantic-forms-styles.scss +6 -2
- package/docs/statics/js/semantic-forms-demo.js +0 -4
- package/docs/statics/js/semantic-forms-main.js +13 -3
- package/docs/statics/pages/buttons.html +8 -0
- package/docs/statics/pages/fullDemo.html +89 -0
- package/docs/statics/pages/inputs.html +5 -3
- package/docs/statics/pages/layout.html +77 -8
- package/docs/statics/pages/layouts/main.html +2 -0
- package/docs/statics/pages/theming.html +17 -1
- package/docs/statics/pages/usage.html +19 -0
- package/package.json +7 -5
- package/semanticForms.js +18 -4
- package/semanticForms.scss +19 -0
- package/styles/colspan.scss +316 -0
- package/styles/globals.scss +202 -0
- package/styles/inputs.scss +473 -0
- package/styles/labels.scss +316 -0
- package/styles/layoutScope.scss +4 -0
- package/styles/lowFlow.scss +166 -0
- package/styles/tabs.scss +181 -0
|
@@ -512,7 +512,7 @@
|
|
|
512
512
|
<p>How loud clicks and alerts are.</p>
|
|
513
513
|
</dt>
|
|
514
514
|
<dd>
|
|
515
|
-
<input type="range" id="custom-ex-volume" name="custom-ex-volume" value="80">
|
|
515
|
+
<input type="range" id="custom-ex-volume" name="custom-ex-volume" value="80" data-display-value>
|
|
516
516
|
<output for="custom-ex-volume">80</output>
|
|
517
517
|
</dd>
|
|
518
518
|
</div>
|
|
@@ -620,12 +620,7 @@ form.settingsExample input[type=color] {
|
|
|
620
620
|
}
|
|
621
621
|
</escape></code></pre>
|
|
622
622
|
|
|
623
|
-
<p>
|
|
624
|
-
|
|
625
|
-
<pre><code class='language-javascript'><escape>
|
|
626
|
-
const volume = document.getElementById('custom-ex-volume')
|
|
627
|
-
volume.addEventListener('input', () => { volume.nextElementSibling.value = volume.value })
|
|
628
|
-
</escape></code></pre>
|
|
623
|
+
<p>A range with <code>data-display-value</code> keeps its <code><!--#<output for>--></code> up to date as it moves, since the label it would write into in other layouts is left alone here. Nothing is added if there's no <code><!--#<output>--></code> for it.</p>
|
|
629
624
|
|
|
630
625
|
<form class="semanticForms customLayout settingsExample">
|
|
631
626
|
<fieldset>
|
|
@@ -669,7 +664,7 @@ volume.addEventListener('input', () => { volume.nextElementSibling.value = volum
|
|
|
669
664
|
<p>How loud clicks and alerts are.</p>
|
|
670
665
|
</dt>
|
|
671
666
|
<dd>
|
|
672
|
-
<input type="range" id="custom-ex-volume" name="custom-ex-volume" value="80">
|
|
667
|
+
<input type="range" id="custom-ex-volume" name="custom-ex-volume" value="80" data-display-value>
|
|
673
668
|
<output for="custom-ex-volume">80</output>
|
|
674
669
|
</dd>
|
|
675
670
|
</div>
|
|
@@ -791,6 +786,80 @@ volume.addEventListener('input', () => { volume.nextElementSibling.value = volum
|
|
|
791
786
|
</escape></code></pre>
|
|
792
787
|
|
|
793
788
|
<p>The tab strip takes its colors from <code>--semanticFormsButtonGradientLight</code> and <code>--semanticFormsButtonGradientDark</code> for the unselected tabs, and <code>--semanticFormsFormSubBgColor</code> for the selected one, so it matches the buttons and fieldsets around it.</p>
|
|
789
|
+
|
|
790
|
+
<h3 id="verticaltabs">Vertical tabs</h3>
|
|
791
|
+
|
|
792
|
+
<p>Add the <code>vertical</code> class alongside <code>tabs</code> to put the tabs in a column down the side of the panels. The up and down arrow keys move between them in place of left and right, and the strip is marked with <code>aria-orientation="vertical"</code>. The strip is as wide as its longest tab up to 40% of the group, past which a tab's name is cut off with an ellipsis. Unselected vertical tabs are a flat fill halfway between <code>--semanticFormsButtonGradientLight</code> and <code>--semanticFormsButtonGradientDark</code> rather than a gradient.</p>
|
|
793
|
+
|
|
794
|
+
<pre><code class='language-html' lang='html'><escape>
|
|
795
|
+
<form class="semanticForms">
|
|
796
|
+
<div class="tabs vertical">
|
|
797
|
+
<fieldset>
|
|
798
|
+
<legend>General</legend>
|
|
799
|
+
<dl>
|
|
800
|
+
<div>
|
|
801
|
+
<dt><label for="vertical-tabs-ex-name">Name</label></dt>
|
|
802
|
+
<dd><input type="text" id="vertical-tabs-ex-name" name="vertical-tabs-ex-name"></dd>
|
|
803
|
+
</div>
|
|
804
|
+
</dl>
|
|
805
|
+
</fieldset>
|
|
806
|
+
|
|
807
|
+
<fieldset>
|
|
808
|
+
<legend>Playback</legend>
|
|
809
|
+
<dl>
|
|
810
|
+
<div>
|
|
811
|
+
<dt><label for="vertical-tabs-ex-crossfade">Crossfade</label></dt>
|
|
812
|
+
<dd><input type="checkbox" switch id="vertical-tabs-ex-crossfade" name="vertical-tabs-ex-crossfade"></dd>
|
|
813
|
+
</div>
|
|
814
|
+
</dl>
|
|
815
|
+
</fieldset>
|
|
816
|
+
|
|
817
|
+
<fieldset>
|
|
818
|
+
<legend>Appearance</legend>
|
|
819
|
+
<dl>
|
|
820
|
+
<div>
|
|
821
|
+
<dt><label for="vertical-tabs-ex-dark">Dark mode</label></dt>
|
|
822
|
+
<dd><input type="checkbox" switch id="vertical-tabs-ex-dark" name="vertical-tabs-ex-dark"></dd>
|
|
823
|
+
</div>
|
|
824
|
+
</dl>
|
|
825
|
+
</fieldset>
|
|
826
|
+
</div>
|
|
827
|
+
</form>
|
|
828
|
+
</escape></code></pre>
|
|
829
|
+
|
|
830
|
+
<form class="semanticForms">
|
|
831
|
+
<div class="tabs vertical">
|
|
832
|
+
<fieldset>
|
|
833
|
+
<legend>General</legend>
|
|
834
|
+
<dl>
|
|
835
|
+
<div>
|
|
836
|
+
<dt><label for="vertical-tabs-ex-name">Name</label></dt>
|
|
837
|
+
<dd><input type="text" id="vertical-tabs-ex-name" name="vertical-tabs-ex-name"></dd>
|
|
838
|
+
</div>
|
|
839
|
+
</dl>
|
|
840
|
+
</fieldset>
|
|
841
|
+
|
|
842
|
+
<fieldset>
|
|
843
|
+
<legend>Playback</legend>
|
|
844
|
+
<dl>
|
|
845
|
+
<div>
|
|
846
|
+
<dt><label for="vertical-tabs-ex-crossfade">Crossfade</label></dt>
|
|
847
|
+
<dd><input type="checkbox" switch id="vertical-tabs-ex-crossfade" name="vertical-tabs-ex-crossfade"></dd>
|
|
848
|
+
</div>
|
|
849
|
+
</dl>
|
|
850
|
+
</fieldset>
|
|
851
|
+
|
|
852
|
+
<fieldset>
|
|
853
|
+
<legend>Appearance</legend>
|
|
854
|
+
<dl>
|
|
855
|
+
<div>
|
|
856
|
+
<dt><label for="vertical-tabs-ex-dark">Dark mode</label></dt>
|
|
857
|
+
<dd><input type="checkbox" switch id="vertical-tabs-ex-dark" name="vertical-tabs-ex-dark"></dd>
|
|
858
|
+
</div>
|
|
859
|
+
</dl>
|
|
860
|
+
</fieldset>
|
|
861
|
+
</div>
|
|
862
|
+
</form>
|
|
794
863
|
</article>
|
|
795
864
|
</arg>
|
|
796
865
|
</include>
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
+
<!--! tells the browser the page has both modes, so it paints its own canvas, scrollbars and form controls to match before the stylesheets arrive. without it a visitor whose system is dark gets a white page first -->
|
|
7
|
+
<meta name="color-scheme" content="light dark">
|
|
6
8
|
<meta name="format-detection" content="telephone=no">
|
|
7
9
|
<title>Semantic Forms documentation</title>
|
|
8
10
|
<meta name="description" content="Describe your website here">
|
|
@@ -49,7 +49,23 @@ form.semanticForms {
|
|
|
49
49
|
}
|
|
50
50
|
</escape></code></pre>
|
|
51
51
|
|
|
52
|
-
<p>The variable is set on the
|
|
52
|
+
<p>The variable is set on the page's root element as well, following the page's light or dark mode, so the page can be painted with it too:</p>
|
|
53
|
+
|
|
54
|
+
<pre><code class='language-css' lang='css'><escape>
|
|
55
|
+
body {
|
|
56
|
+
background-color: var(--semanticFormsPageBgColor);
|
|
57
|
+
}
|
|
58
|
+
</escape></code></pre>
|
|
59
|
+
|
|
60
|
+
<h3 id="cursor">The pointer over controls</h3>
|
|
61
|
+
|
|
62
|
+
<p>The pointer turns into a hand over buttons, checkboxes, selects and the like, as it does over a link. A desktop app, whose own controls keep the ordinary arrow, can set <code>--semanticFormsCursor</code> to change it, such as <code>form.semanticForms { --semanticFormsCursor: default }</code>.</p>
|
|
63
|
+
|
|
64
|
+
<h3 id="autofill">Autofilled fields</h3>
|
|
65
|
+
|
|
66
|
+
<p>A browser paints a field it filled for the visitor in a color of its own, which no background you set can override. Semantic Forms covers that color so your theme survives, and marks the field itself instead, with a bar down its leading edge drawn in <code>--semanticFormsAutofillColor</code>. That defaults to the system accent color, so it reads as something the browser did rather than part of your form.</p>
|
|
67
|
+
|
|
68
|
+
<p>The bar is drawn as a shadow inside the field, so it takes up no space and nothing on the page moves when a field is filled.</p>
|
|
53
69
|
|
|
54
70
|
<h3 id="widthvariables">Controlling how wide fields get</h3>
|
|
55
71
|
|
|
@@ -36,6 +36,25 @@
|
|
|
36
36
|
|
|
37
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
38
|
|
|
39
|
+
<h3 id="sass">Including the styles from Sass</h3>
|
|
40
|
+
|
|
41
|
+
<p>If your own stylesheets are written in <a href="https://sass-lang.com">Sass</a>, you can pull Semantic Forms into them from its Sass source rather than including the compiled CSS file separately. With Sass's Node.js package importer enabled, which is <code>importers: [new sass.NodePackageImporter()]</code> in the JavaScript API or <code>--pkg-importer=node</code> on the command line:</p>
|
|
42
|
+
|
|
43
|
+
<pre><code class='language-scss'>@use "pkg:semantic-forms";</code></pre>
|
|
44
|
+
|
|
45
|
+
<p>Or, with your <code>node_modules</code> folder in Sass's load paths:</p>
|
|
46
|
+
|
|
47
|
+
<pre><code class='language-scss'>@use "semantic-forms/semanticForms";</code></pre>
|
|
48
|
+
|
|
49
|
+
<h3 id="setinvalid">Marking a field invalid from JavaScript</h3>
|
|
50
|
+
|
|
51
|
+
<p>A check the browser can't do itself, such as whether a name is already taken, can mark a field invalid the same way the browser's own validation does, with a message saying why:</p>
|
|
52
|
+
|
|
53
|
+
<pre><code class='language-javascript'>semanticForms.setInvalid(field, 'That name is already taken.')
|
|
54
|
+
semanticForms.clearInvalid(field)</code></pre>
|
|
55
|
+
|
|
56
|
+
<p><code>setInvalid</code> gives the field the <code>invalid</code> class, which outlines it, sets <code>aria-invalid</code>, and puts the message after the field, adding it to the field's <code>aria-describedby</code> so screen readers read it along with the field. Calling it again replaces the message. In a <code>customLayout</code> element, or anywhere the message belongs somewhere other than after the field, say where: <code>semanticForms.setInvalid(field, message, { messageIn: element })</code>. <code>clearInvalid</code> undoes all of it.</p>
|
|
57
|
+
|
|
39
58
|
<h3 id="shadowdom">Forms inside a shadow root</h3>
|
|
40
59
|
|
|
41
60
|
<p>A shadow root is a separate tree, so <code>semanticForms()</code> cannot see into one by default. Pass the root to enhance the forms inside it:</p>
|
package/package.json
CHANGED
|
@@ -8,15 +8,17 @@
|
|
|
8
8
|
"url": "https://github.com/rooseveltframework/semantic-forms/graphs/contributors"
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
|
-
"version": "5.3.
|
|
11
|
+
"version": "5.3.18",
|
|
12
12
|
"files": [
|
|
13
13
|
"dist",
|
|
14
14
|
"semanticForms.scss",
|
|
15
|
+
"styles",
|
|
15
16
|
"docs/statics",
|
|
16
17
|
"*.md"
|
|
17
18
|
],
|
|
18
19
|
"exports": {
|
|
19
20
|
".": {
|
|
21
|
+
"sass": "./semanticForms.scss",
|
|
20
22
|
"import": "./dist/semantic-forms.mjs",
|
|
21
23
|
"require": "./dist/semantic-forms.cjs"
|
|
22
24
|
},
|
|
@@ -33,14 +35,14 @@
|
|
|
33
35
|
"readmeFilename": "README.md",
|
|
34
36
|
"devDependencies": {
|
|
35
37
|
"@jsdevtools/coverage-istanbul-loader": "3.0.5",
|
|
36
|
-
"@playwright/test": "1.
|
|
38
|
+
"@playwright/test": "1.65.1",
|
|
37
39
|
"eslint-plugin-html": "8.2.1",
|
|
38
40
|
"nyc": "18.0.0",
|
|
39
|
-
"sass": "1.
|
|
41
|
+
"sass": "1.108.2",
|
|
40
42
|
"standard": "17.1.2",
|
|
41
43
|
"terser-webpack-plugin": "5.6.1",
|
|
42
|
-
"webpack": "5.
|
|
43
|
-
"webpack-cli": "7.
|
|
44
|
+
"webpack": "5.113.0",
|
|
45
|
+
"webpack-cli": "7.3.1"
|
|
44
46
|
},
|
|
45
47
|
"scripts": {
|
|
46
48
|
"prepare": "npm run build",
|
package/semanticForms.js
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
const { createKeyboardShortcut, shortcutListener } = require('./lib/keyboardShortcuts.js')
|
|
2
|
-
const { enhanceInput, handleUndoRedo } = require('./lib/inputEnhancements.js')
|
|
2
|
+
const { enhanceInput, handleUndoRedo, setInvalid, clearInvalid } = require('./lib/inputEnhancements.js')
|
|
3
3
|
const { enhanceTabs } = require('./lib/tabs.js')
|
|
4
4
|
const { setInkOffset } = require('./lib/helpers.js')
|
|
5
5
|
|
|
6
6
|
// one observer per tree that has been handed to semanticForms, so that a shadow root gets its own without replacing the document's
|
|
7
7
|
const observers = new WeakMap()
|
|
8
8
|
|
|
9
|
+
// the keyboard shortcuts every form has asked for, kept in one list with one listener for them all, since semanticForms runs again for every form added to the page. a shortcut whose field has left the page is dropped
|
|
10
|
+
const keyboardShortcuts = []
|
|
11
|
+
let listeningForShortcuts = false
|
|
12
|
+
const pruneShortcuts = () => {
|
|
13
|
+
for (let i = keyboardShortcuts.length - 1; i >= 0; i--) if (!keyboardShortcuts[i].input.isConnected) keyboardShortcuts.splice(i, 1)
|
|
14
|
+
}
|
|
15
|
+
|
|
9
16
|
// progressively enhances every semanticForms form in a tree
|
|
10
17
|
//
|
|
11
18
|
// root: document or shadow root to search; defaults to the main document
|
|
@@ -17,8 +24,11 @@ const semanticForms = (root = document) => {
|
|
|
17
24
|
}
|
|
18
25
|
|
|
19
26
|
// custom keyboard shortcut listener
|
|
20
|
-
|
|
21
|
-
|
|
27
|
+
if (!listeningForShortcuts) {
|
|
28
|
+
document.addEventListener('keydown', (e) => shortcutListener(e, keyboardShortcuts))
|
|
29
|
+
listeningForShortcuts = true
|
|
30
|
+
}
|
|
31
|
+
pruneShortcuts()
|
|
22
32
|
|
|
23
33
|
// progressively enhance form elements that have the semanticForms class
|
|
24
34
|
const forms = root.querySelectorAll('form.semanticForms:not(.semanticFormsActive), table.semanticForms:not(.semanticFormsActive)')
|
|
@@ -36,7 +46,7 @@ const semanticForms = (root = document) => {
|
|
|
36
46
|
enhanceInput(input, form)
|
|
37
47
|
|
|
38
48
|
// handle keyboard shortcuts
|
|
39
|
-
if (input.getAttribute('data-focus-key') !== null) {
|
|
49
|
+
if (input.getAttribute('data-focus-key') !== null && !keyboardShortcuts.some(shortcut => shortcut.input === input)) {
|
|
40
50
|
const shortcut = createKeyboardShortcut(input, keyboardShortcuts)
|
|
41
51
|
keyboardShortcuts.push(shortcut)
|
|
42
52
|
}
|
|
@@ -84,4 +94,8 @@ const semanticForms = (root = document) => {
|
|
|
84
94
|
}
|
|
85
95
|
}
|
|
86
96
|
|
|
97
|
+
// marks a field invalid with a message saying why, or clears that: see the docs for setInvalid
|
|
98
|
+
semanticForms.setInvalid = setInvalid
|
|
99
|
+
semanticForms.clearInvalid = clearInvalid
|
|
100
|
+
|
|
87
101
|
module.exports = semanticForms
|
package/semanticForms.scss
CHANGED
|
@@ -126,6 +126,25 @@
|
|
|
126
126
|
margin-bottom: 15px;
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
+
|
|
130
|
+
// opening and closing the panel changes its height, and the marker beside the summary turns: both are motion, and both are dropped for a visitor who asked for less of it. the fade is a colour change rather than movement, so it is left running
|
|
131
|
+
@media (prefers-reduced-motion: reduce) {
|
|
132
|
+
@supports (interpolate-size: allow-keywords) {
|
|
133
|
+
transition: opacity 250ms ease-in, visibility 0ms ease-in 250ms;
|
|
134
|
+
|
|
135
|
+
&::details-content {
|
|
136
|
+
transition: none;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
summary {
|
|
141
|
+
transition: none;
|
|
142
|
+
|
|
143
|
+
&::before {
|
|
144
|
+
transition: none;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
129
148
|
}
|
|
130
149
|
|
|
131
150
|
details details,
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
@use 'layoutScope.scss' as *;
|
|
2
|
+
|
|
3
|
+
// the column classes size and place fields in the grid layout, so like the grid itself they do not apply inside a customLayout element: see layoutScope.scss
|
|
4
|
+
.semanticForms {
|
|
5
|
+
div#{$notCustomLayout} {
|
|
6
|
+
&[class*=colspan-] {
|
|
7
|
+
max-width: 100% !important;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
&.colspan-full {
|
|
11
|
+
grid-column: 1 / -1;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&.colspan-5 {
|
|
15
|
+
grid-column-end: span 5;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&.colspan-4 {
|
|
19
|
+
grid-column-end: span 4;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&.colspan-3 {
|
|
23
|
+
grid-column-end: span 3;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&.colspan-2 {
|
|
27
|
+
grid-column-end: span 2;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&.colspan-1 {
|
|
31
|
+
grid-column-end: span 1;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// col-# places a field in a particular column. the colspan rules above put their span on grid-column-end rather than the shorthand, so setting the start here does not undo it: colspan decides how wide the field is and col decides which column it starts in
|
|
35
|
+
&.col-5 {
|
|
36
|
+
grid-column-start: 5;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&.col-4 {
|
|
40
|
+
grid-column-start: 4;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&.col-3 {
|
|
44
|
+
grid-column-start: 3;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&.col-2 {
|
|
48
|
+
grid-column-start: 2;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&.col-1 {
|
|
52
|
+
grid-column-start: 1;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
fieldset[class*=colspan-] dl#{$notCustomLayout},
|
|
57
|
+
dl[class*='colspan-']#{$notCustomLayout} {
|
|
58
|
+
div {
|
|
59
|
+
max-width: 100% !important;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
fieldset.colspan-full dl#{$notCustomLayout},
|
|
64
|
+
dl.colspan-full#{$notCustomLayout} {
|
|
65
|
+
grid-template-columns: repeat(auto-fit, minmax(var(--semanticFormsInputMinWidth), var(--semanticFormsInputColumnMaxWidth)));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
fieldset.colspan-5 dl#{$notCustomLayout},
|
|
69
|
+
dl.colspan-5#{$notCustomLayout} {
|
|
70
|
+
grid-template-columns: repeat(5, minmax(var(--semanticFormsInputMinWidth), var(--semanticFormsInputColumnMaxWidth)));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
fieldset.colspan-4 dl#{$notCustomLayout},
|
|
74
|
+
dl.colspan-4#{$notCustomLayout} {
|
|
75
|
+
grid-template-columns: repeat(4, minmax(var(--semanticFormsInputMinWidth), var(--semanticFormsInputColumnMaxWidth)));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
fieldset.colspan-3 dl#{$notCustomLayout},
|
|
79
|
+
dl.colspan-3#{$notCustomLayout} {
|
|
80
|
+
grid-template-columns: repeat(3, minmax(var(--semanticFormsInputMinWidth), var(--semanticFormsInputColumnMaxWidth)));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
fieldset.colspan-2 dl#{$notCustomLayout},
|
|
84
|
+
dl.colspan-2#{$notCustomLayout} {
|
|
85
|
+
grid-template-columns: repeat(2, minmax(var(--semanticFormsInputMinWidth), var(--semanticFormsInputColumnMaxWidth)));
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
fieldset.colspan-1 dl#{$notCustomLayout},
|
|
89
|
+
dl.colspan-1#{$notCustomLayout} {
|
|
90
|
+
grid-template-columns: repeat(1, minmax(var(--semanticFormsInputMinWidth), var(--semanticFormsInputColumnMaxWidth)));
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
fieldset.colspan-1 dl#{$notCustomLayout},
|
|
94
|
+
dl.colspan-1#{$notCustomLayout} {
|
|
95
|
+
dt:nth-of-type(n + 1),
|
|
96
|
+
dd:nth-of-type(n + 1) {
|
|
97
|
+
grid-column: 1;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
fieldset.colspan-2 dl#{$notCustomLayout},
|
|
102
|
+
dl.colspan-2#{$notCustomLayout} {
|
|
103
|
+
dt:nth-of-type(2n + 1),
|
|
104
|
+
dd:nth-of-type(2n + 1) {
|
|
105
|
+
grid-column: 1;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
dt:nth-of-type(2n + 2),
|
|
109
|
+
dd:nth-of-type(2n + 2) {
|
|
110
|
+
grid-column: 2;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
fieldset.colspan-3 dl#{$notCustomLayout},
|
|
115
|
+
dl.colspan-3#{$notCustomLayout} {
|
|
116
|
+
dt:nth-of-type(3n + 1),
|
|
117
|
+
dd:nth-of-type(3n + 1) {
|
|
118
|
+
grid-column: 1;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
dt:nth-of-type(3n + 2),
|
|
122
|
+
dd:nth-of-type(3n + 2) {
|
|
123
|
+
grid-column: 2;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
dt:nth-of-type(3n + 3),
|
|
127
|
+
dd:nth-of-type(3n + 3) {
|
|
128
|
+
grid-column: 3;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
fieldset.colspan-4 dl#{$notCustomLayout},
|
|
133
|
+
dl.colspan-4#{$notCustomLayout} {
|
|
134
|
+
dt:nth-of-type(4n + 1),
|
|
135
|
+
dd:nth-of-type(4n + 1) {
|
|
136
|
+
grid-column: 1;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
dt:nth-of-type(4n + 2),
|
|
140
|
+
dd:nth-of-type(4n + 2) {
|
|
141
|
+
grid-column: 2;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
dt:nth-of-type(4n + 3),
|
|
145
|
+
dd:nth-of-type(4n + 3) {
|
|
146
|
+
grid-column: 3;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
dt:nth-of-type(4n + 4),
|
|
150
|
+
dd:nth-of-type(4n + 4) {
|
|
151
|
+
grid-column: 4;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
fieldset.colspan-5 dl#{$notCustomLayout},
|
|
156
|
+
dl.colspan-5#{$notCustomLayout} {
|
|
157
|
+
dt:nth-of-type(5n + 1),
|
|
158
|
+
dd:nth-of-type(5n + 1) {
|
|
159
|
+
grid-column: 1;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
dt:nth-of-type(5n + 2),
|
|
163
|
+
dd:nth-of-type(5n + 2) {
|
|
164
|
+
grid-column: 2;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
dt:nth-of-type(5n + 3),
|
|
168
|
+
dd:nth-of-type(5n + 3) {
|
|
169
|
+
grid-column: 3;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
dt:nth-of-type(5n + 4),
|
|
173
|
+
dd:nth-of-type(5n + 4) {
|
|
174
|
+
grid-column: 4;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
dt:nth-of-type(5n + 5),
|
|
178
|
+
dd:nth-of-type(5n + 5) {
|
|
179
|
+
grid-column: 5;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// scoped to the library's own forms: a bare `fieldset` here would give every fieldset on the host page a container context, and the queries below would then lay out its <dl> children too
|
|
185
|
+
//
|
|
186
|
+
// only a form or fieldset holding a grid of fields is made a container, since it's the grid the queries lay out. a container is measured as though it were empty, so one sized by its contents, such as a form holding only a button, would otherwise shrink to nothing
|
|
187
|
+
form.semanticForms:has(dl#{$notCustomLayout}),
|
|
188
|
+
form.semanticForms fieldset:has(dl#{$notCustomLayout}) {
|
|
189
|
+
container: semanticForm / inline-size;
|
|
190
|
+
|
|
191
|
+
// max 7 columns
|
|
192
|
+
@container semanticForm (width >= 1810px) {
|
|
193
|
+
& fieldset dl#{$notCustomLayout},
|
|
194
|
+
& dl#{$notCustomLayout} {
|
|
195
|
+
grid-template-columns: repeat(7, minmax(var(--semanticFormsInputMinWidth), var(--semanticFormsInputColumnMaxWidth)));
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// max 6 columns
|
|
200
|
+
@container semanticForm (width >= 1550px) and (width < 1810px) {
|
|
201
|
+
& fieldset dl#{$notCustomLayout},
|
|
202
|
+
& dl#{$notCustomLayout} {
|
|
203
|
+
grid-template-columns: repeat(6, minmax(var(--semanticFormsInputMinWidth), var(--semanticFormsInputColumnMaxWidth)));
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// max 5 columns
|
|
208
|
+
@container semanticForm (width >= 1290px) and (width < 1550px) {
|
|
209
|
+
& fieldset dl#{$notCustomLayout},
|
|
210
|
+
& dl#{$notCustomLayout} {
|
|
211
|
+
grid-template-columns: repeat(5, minmax(var(--semanticFormsInputMinWidth), var(--semanticFormsInputColumnMaxWidth)));
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// max 4 columns
|
|
216
|
+
@container semanticForm (width >= 1030px) and (width < 1290px) {
|
|
217
|
+
& fieldset dl#{$notCustomLayout},
|
|
218
|
+
& fieldset.colspan-5 dl#{$notCustomLayout},
|
|
219
|
+
& dl#{$notCustomLayout},
|
|
220
|
+
& dl.colspan-5#{$notCustomLayout} {
|
|
221
|
+
grid-template-columns: repeat(4, minmax(var(--semanticFormsInputMinWidth), var(--semanticFormsInputColumnMaxWidth)));
|
|
222
|
+
|
|
223
|
+
div.colspan-5 {
|
|
224
|
+
grid-column-end: span 4;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
div.col-5 {
|
|
228
|
+
grid-column-start: auto;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// max 3 columns
|
|
234
|
+
@container semanticForm (width >= 850px) and (width < 1030px) {
|
|
235
|
+
& fieldset dl#{$notCustomLayout},
|
|
236
|
+
& fieldset.colspan-4 dl#{$notCustomLayout},
|
|
237
|
+
& fieldset.colspan-5 dl#{$notCustomLayout},
|
|
238
|
+
& dl#{$notCustomLayout},
|
|
239
|
+
& dl.colspan-4#{$notCustomLayout},
|
|
240
|
+
& dl.colspan-5#{$notCustomLayout} {
|
|
241
|
+
grid-template-columns: repeat(3, minmax(var(--semanticFormsInputMinWidth), var(--semanticFormsInputColumnMaxWidth)));
|
|
242
|
+
|
|
243
|
+
div.colspan-4,
|
|
244
|
+
div.colspan-5 {
|
|
245
|
+
grid-column-end: span 3;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
div.col-4,
|
|
249
|
+
div.col-5 {
|
|
250
|
+
grid-column-start: auto;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// max 2 columns
|
|
256
|
+
@container semanticForm (width >= 510px) and (width < 850px) {
|
|
257
|
+
& fieldset dl#{$notCustomLayout},
|
|
258
|
+
& fieldset.colspan-3 dl#{$notCustomLayout},
|
|
259
|
+
& fieldset.colspan-4 dl#{$notCustomLayout},
|
|
260
|
+
& fieldset.colspan-5 dl#{$notCustomLayout},
|
|
261
|
+
& dl#{$notCustomLayout},
|
|
262
|
+
& dl.colspan-3#{$notCustomLayout},
|
|
263
|
+
& dl.colspan-4#{$notCustomLayout},
|
|
264
|
+
& dl.colspan-5#{$notCustomLayout} {
|
|
265
|
+
grid-template-columns: repeat(2, minmax(var(--semanticFormsInputMinWidth), var(--semanticFormsInputColumnMaxWidth)));
|
|
266
|
+
|
|
267
|
+
div.colspan-3,
|
|
268
|
+
div.colspan-4,
|
|
269
|
+
div.colspan-5 {
|
|
270
|
+
grid-column-end: span 2;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
div.col-3,
|
|
274
|
+
div.col-4,
|
|
275
|
+
div.col-5 {
|
|
276
|
+
grid-column-start: auto;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// max 1 column
|
|
282
|
+
@container semanticForm (width < 510px) {
|
|
283
|
+
& fieldset dl#{$notCustomLayout},
|
|
284
|
+
& fieldset.colspan-2 dl#{$notCustomLayout},
|
|
285
|
+
& fieldset.colspan-3 dl#{$notCustomLayout},
|
|
286
|
+
& fieldset.colspan-4 dl#{$notCustomLayout},
|
|
287
|
+
& fieldset.colspan-5 dl#{$notCustomLayout},
|
|
288
|
+
& dl#{$notCustomLayout},
|
|
289
|
+
& dl.colspan-2#{$notCustomLayout},
|
|
290
|
+
& dl.colspan-3#{$notCustomLayout},
|
|
291
|
+
& dl.colspan-4#{$notCustomLayout},
|
|
292
|
+
& dl.colspan-5#{$notCustomLayout} {
|
|
293
|
+
grid-template-columns: 1fr;
|
|
294
|
+
|
|
295
|
+
div.colspan-2,
|
|
296
|
+
div.colspan-3,
|
|
297
|
+
div.colspan-4,
|
|
298
|
+
div.colspan-5 {
|
|
299
|
+
grid-column-end: span 1;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
div.col-2,
|
|
303
|
+
div.col-3,
|
|
304
|
+
div.col-4,
|
|
305
|
+
div.col-5 {
|
|
306
|
+
grid-column-start: auto;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// a dialog or popover is sized by its contents, so a form in one is not made a container, which would shrink the dialog to nothing. its grid of fields lays itself out by the width it's given, as the base grid does
|
|
313
|
+
:is(dialog, [popover]) form.semanticForms:has(dl#{$notCustomLayout}),
|
|
314
|
+
:is(dialog, [popover]) form.semanticForms fieldset:has(dl#{$notCustomLayout}) {
|
|
315
|
+
container-type: normal;
|
|
316
|
+
}
|