@skirbi/pinta 0.0.30 → 0.0.31

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.
@@ -665,6 +665,10 @@
665
665
  }
666
666
 
667
667
 
668
+ /* Diptych layout */
669
+ --skirbi-diptych-aside: 16rem;
670
+ --skirbi-diptych-gap: clamp(1rem, 2vw, 2rem);
671
+
668
672
  /* Triptych layout */
669
673
  --skirbi-triptych-content: 110ch;
670
674
  --skirbi-triptych-aside: 16rem;
@@ -961,7 +965,7 @@
961
965
  color: var(--skirbi-page-fg, var(--skirbi-on-light, #0f172a));
962
966
 
963
967
  /* Typography application */
964
- font-family: var(--skirbi-font-defaults);
968
+ font-family: var(--skirbi-font-sans);
965
969
 
966
970
  font-size: calc(16px * var(--skirbi-font-scale, 1));
967
971
  line-height: var(--skirbi-line-height, 1.55);
@@ -1067,21 +1071,20 @@
1067
1071
 
1068
1072
  @layer skirbi-components {
1069
1073
 
1070
- /**
1071
- * @styles pinta.semtic-panel-tile Semtic panel and tile
1072
- * @description
1073
- *
1074
- * Light surface recipes for `<semtic-panel>` and `<semtic-tile>`.
1075
- *
1076
- * They use final surface tokens and remain easy to override:
1077
- *
1078
- * ```css
1079
- * semtic-panel[login-card] {
1080
- * max-width: 28rem;
1081
- * }
1082
- * ```
1083
- */
1084
-
1074
+ /**
1075
+ * @styles pinta.semtic-panel-tile Semtic panel and tile
1076
+ * @description
1077
+ *
1078
+ * Light surface recipes for `<semtic-panel>` and `<semtic-tile>`.
1079
+ *
1080
+ * They use final surface tokens and remain easy to override:
1081
+ *
1082
+ * ```css
1083
+ * semtic-panel[login-card] {
1084
+ * max-width: 28rem;
1085
+ * }
1086
+ * ```
1087
+ */
1085
1088
  /* semtic-panel / semtic-tile */
1086
1089
  [skirbi-theme] {
1087
1090
  :is(semtic-panel, semtic-tile) {
@@ -1631,36 +1634,95 @@
1631
1634
  color: var(--skirbi-primary-main);
1632
1635
  }
1633
1636
 
1634
- /* Toolbar (search) */
1637
+ /* Toolbar: search on the left, per-page on the right. Both decide what
1638
+ * the query returns, which is why they sit together above the table
1639
+ * rather than with the pager, which only moves through the result. */
1640
+ /* Both the panel and the section it renders: the controls are children
1641
+ * of the section, so that is what has to be the flex container, and the
1642
+ * panel is laid out the same way for the moment before it renders. */
1643
+ [semtic-table-toolbar],
1644
+ [semtic-table-toolbar] > section {
1645
+ margin-bottom: 0;
1646
+ display: flex;
1647
+ flex-wrap: wrap;
1648
+ align-items: center;
1649
+ gap: 0.75rem;
1650
+
1651
+ /* The search box takes the slack, so the two selectors stay together
1652
+ * on the right instead of drifting with its width. */
1653
+ > [semtic-table-search] {
1654
+ margin-inline-end: auto;
1655
+ }
1656
+ }
1657
+
1635
1658
  [semtic-table-toolbar] {
1636
1659
  margin-bottom: 0.75rem;
1637
1660
  }
1638
1661
 
1639
- [semtic-table-search] {
1640
- width: 100%;
1641
- padding: 0.5rem 0.75rem;
1642
- border: 1px solid var(--skirbi-surface-border-final);
1643
- border-radius: 0.375rem;
1644
- background: var(--skirbi-surface-bg-final);
1645
- color: inherit;
1646
- font-size: inherit;
1662
+ /* Size to their own content rather than sharing the row equally: a
1663
+ * per-page list of two-digit numbers does not need the same width as a
1664
+ * page list running into the hundreds. */
1665
+ :is([semtic-table-page-jump], [semtic-table-page-size]) {
1666
+ flex: 0 0 auto;
1667
+ }
1668
+
1669
+ /* A form control always renders its error span, empty or not, so that
1670
+ * label-error-position has something to place. In a form that costs
1671
+ * nothing -- the row is empty and every field pays it equally. Here the
1672
+ * control is sitting next to buttons that have no such row, so the grid
1673
+ * gap under it pushed the visible box up off their centre line by half
1674
+ * a gap. Dropping the empty row is safe for placement: these two are
1675
+ * never going to show a validation error.
1676
+ */
1677
+ :is([semtic-table-page-jump], [semtic-table-page-size]) [semtic-error]:empty {
1678
+ display: none;
1647
1679
  }
1648
1680
 
1649
- /* Pagination */
1681
+ /* Pagination
1682
+ *
1683
+ * Three parts, in reading order: what you are looking at, how much of
1684
+ * it to show, and how to move. The summary takes the slack so the
1685
+ * controls stay together on the right and do not shift as the numbers
1686
+ * in it change width. Wraps rather than overflows on a narrow table.
1687
+ */
1650
1688
  tfoot td {
1651
1689
  padding-top: 0.75rem;
1652
1690
  display: flex;
1691
+ flex-wrap: wrap;
1653
1692
  align-items: center;
1654
1693
  gap: 0.75rem;
1655
1694
  }
1656
1695
 
1657
- [semtic-table-page-info] {
1696
+ /* Prose about the table, so it takes the quieter, smaller treatment --
1697
+ * and the slack, so the pager stays right as the numbers in it change
1698
+ * width. The two selectors are controls, not prose, and keep the size
1699
+ * every other control has: shrinking them made them visibly shorter
1700
+ * than the search box they share a row with. */
1701
+ [semtic-table-summary] {
1702
+ margin-inline-end: auto;
1658
1703
  font-size: 0.875rem;
1659
1704
  color: var(--skirbi-text-muted-final);
1660
1705
  }
1661
1706
 
1662
- /* Loading state */
1663
- [semtic-table-root][semtic-loading] {
1707
+ /* The step buttons and the page selector are different heights -- a
1708
+ * button is padded text, the selector is a full form control with a
1709
+ * label beside it -- so they are centred against each other rather than
1710
+ * sharing a top or a baseline. align-self on the children as well as
1711
+ * align-items on the box, because a stretch coming from anywhere else
1712
+ * would otherwise decide this instead. */
1713
+ [semtic-table-pager] {
1714
+ display: flex;
1715
+ align-items: center;
1716
+ gap: 0.75rem;
1717
+
1718
+ > * {
1719
+ align-self: center;
1720
+ }
1721
+ }
1722
+
1723
+ /* Loading state. On the host now -- there used to be a wrapper div
1724
+ * inside semtic-table whose only job was to carry this attribute. */
1725
+ &[semtic-loading] {
1664
1726
  opacity: 0.6;
1665
1727
  pointer-events: none;
1666
1728
  }
@@ -1840,26 +1902,60 @@
1840
1902
  }
1841
1903
  }
1842
1904
 
1843
- /* semtic-nav-item */
1905
+ /* semtic-nav-item / semtic-nav-item-group */
1844
1906
  [skirbi-theme] {
1845
1907
  semtic-nav-item > li {
1846
1908
  list-style: none;
1847
1909
  display: inline-flex;
1848
1910
  }
1849
1911
 
1850
- semtic-nav-item [semtic-nav-link] {
1912
+ /* Group <li> holds the header link AND the children <ul> — those must
1913
+ stack vertically, not sit side-by-side as inline-flex row items. */
1914
+ semtic-nav-item-group > li {
1915
+ list-style: none;
1851
1916
  display: flex;
1852
- align-items: center;
1917
+ flex-direction: column;
1918
+ align-items: stretch;
1919
+ }
1920
+
1921
+ :is(semtic-nav-item, semtic-nav-item-group) [semtic-nav-link] {
1922
+ display: flex;
1923
+
1924
+ /* Start, not center: a label that wraps to two lines would otherwise
1925
+ * center the marker against the whole block, leaving it floating
1926
+ * between the lines instead of sitting with the first one. */
1927
+ align-items: flex-start;
1928
+
1929
+ /* The button recipe sets nowrap and clips the overflow, so a group
1930
+ * header longer than the sidenav was cut off rather than wrapped.
1931
+ * break-word covers the case a single token is wider than the column,
1932
+ * which nothing else can rescue. */
1933
+ white-space: normal;
1934
+ overflow-wrap: break-word;
1935
+ overflow: visible;
1936
+
1937
+ /* A group header with no href renders as a <button>, so it picks up the
1938
+ * button recipe -- which centers its content. Combined with the
1939
+ * width: 100% below, that centered a group's label in the row instead
1940
+ * of starting it where every other label starts. The rest of that
1941
+ * recipe is already undone further down (text-transform, letter-spacing,
1942
+ * background, border, font); this is the piece that was missed. */
1943
+ justify-content: flex-start;
1944
+
1853
1945
  gap: 0.375rem;
1854
1946
  padding: 0.375rem 0.75rem;
1855
1947
  border-radius: 0.375rem;
1856
1948
  text-decoration: none;
1949
+ text-transform: none;
1950
+ letter-spacing: normal;
1857
1951
  color: inherit;
1858
1952
  background: transparent;
1859
1953
  border: none;
1860
1954
  cursor: pointer;
1861
1955
  font: inherit;
1862
1956
  font-size: 0.9rem;
1957
+ width: 100%;
1958
+ text-align: left;
1863
1959
  transition:
1864
1960
  background var(--skirbi-transition-duration, 160ms)
1865
1961
  var(--skirbi-transition-ease, ease),
@@ -1867,14 +1963,23 @@
1867
1963
  var(--skirbi-transition-ease, ease);
1868
1964
  }
1869
1965
 
1870
- semtic-nav-item [semtic-nav-link]:hover {
1966
+ /* A group header with no href and no action names the items under it
1967
+ * rather than doing anything, so it should not offer the affordances of
1968
+ * one that does: no pointer, no hover response. */
1969
+ :is(semtic-nav-item, semtic-nav-item-group)
1970
+ [semtic-nav-link][semtic-nav-heading] {
1971
+ cursor: default;
1972
+ }
1973
+
1974
+ :is(semtic-nav-item, semtic-nav-item-group)
1975
+ [semtic-nav-link]:not([semtic-nav-heading]):hover {
1871
1976
  background: color-mix(
1872
1977
  in srgb, var(--skirbi-primary-main) 8%, transparent
1873
1978
  );
1874
1979
  color: var(--skirbi-primary-main);
1875
1980
  }
1876
1981
 
1877
- semtic-nav-item :is(
1982
+ :is(semtic-nav-item, semtic-nav-item-group) :is(
1878
1983
  li[aria-current="page"] > [semtic-nav-link],
1879
1984
  [semtic-nav-link][aria-current="page"]
1880
1985
  ) {
@@ -1885,14 +1990,17 @@
1885
1990
  font-weight: 600;
1886
1991
  }
1887
1992
 
1888
- semtic-nav-item [semtic-nav-children] semtic-nav-item [semtic-nav-link]
1889
- ::before {
1993
+ /* The newline before ::before used to be a descendant combinator, so this
1994
+ * marked every element inside the link instead of the link itself -- and
1995
+ * a link holds only text, so nothing was ever marked. */
1996
+ :is(semtic-nav-item, semtic-nav-item-group)
1997
+ [semtic-nav-children] semtic-nav-item [semtic-nav-link]::before {
1890
1998
  content: '›';
1891
1999
  opacity: 0.5;
1892
2000
  font-size: 1em;
1893
2001
  }
1894
2002
 
1895
- semtic-nav-item [semtic-nav-children] {
2003
+ :is(semtic-nav-item, semtic-nav-item-group) [semtic-nav-children] {
1896
2004
  list-style: none;
1897
2005
  margin: 0;
1898
2006
  padding: 0 0 0 1rem;
@@ -1915,6 +2023,22 @@
1915
2023
  color: var(--skirbi-text-muted-final);
1916
2024
  }
1917
2025
 
2026
+ /* A linked section title. It inherits the label's own treatment -- size,
2027
+ * weight, letter-spacing, muted colour -- and only drops the underline,
2028
+ * so linking a section does not turn it into something that reads like an
2029
+ * item. */
2030
+ semtic-nav-section [semtic-nav-section-link] {
2031
+ color: inherit;
2032
+ font: inherit;
2033
+ letter-spacing: inherit;
2034
+ text-transform: inherit;
2035
+ text-decoration: none;
2036
+ }
2037
+
2038
+ semtic-nav-section [semtic-nav-section-link]:hover {
2039
+ text-decoration: underline;
2040
+ }
2041
+
1918
2042
  semtic-nav-section [semtic-nav-section-body] {
1919
2043
  list-style: none;
1920
2044
  margin: 0;
@@ -1985,6 +2109,10 @@
1985
2109
  left: 0;
1986
2110
  top: 0;
1987
2111
  bottom: 0;
2112
+
2113
+ /* Pinned top to bottom, same problem as the desktop rule below. */
2114
+ overflow-y: auto;
2115
+
1988
2116
  transform: translateX(-100%);
1989
2117
  transition: transform var(--skirbi-transition-duration, 160ms)
1990
2118
  var(--skirbi-transition-ease, ease);
@@ -2012,6 +2140,63 @@
2012
2140
  position: sticky;
2013
2141
  top: 0;
2014
2142
  height: 100vh;
2143
+
2144
+ /* Pinned to the viewport height, so a menu taller than the screen has
2145
+ * nowhere to go without this: the items past the fold were simply
2146
+ * unreachable. */
2147
+ overflow-y: auto;
2148
+ }
2149
+ }
2150
+ }
2151
+
2152
+ /**
2153
+ * @styles pinta.semtic-sidenav-indent Semtic sidenav, indented
2154
+ *
2155
+ * Opt-in variant: `<semtic-sidenav indent>`.
2156
+ *
2157
+ * Shows depth as indentation against a shared left edge, rather than as
2158
+ * nested boxes. Every item is prefixed with a marker, and a group's
2159
+ * children start where the group's own label starts, so the markers form a
2160
+ * column per level and the menu reads as an outline. Suits a menu several
2161
+ * levels deep; the default recipe suits a flat one.
2162
+ *
2163
+ * EVENT 2026
2164
+ * > Access
2165
+ * > Divisions
2166
+ * > Mixed
2167
+ * > Teams
2168
+ *
2169
+ * That alignment is why the marker is given an explicit inline-size. As a
2170
+ * bare glyph it is whatever width the font makes it, and the indent below
2171
+ * would have to guess that width to line anything up -- it would drift with
2172
+ * the font and land differently for a different marker. Sized here, one
2173
+ * step is exactly marker + the link's own gap, and the column is
2174
+ * arithmetic rather than a value that looked about right.
2175
+ */
2176
+ [skirbi-theme] {
2177
+ semtic-sidenav[indent] {
2178
+ --skirbi-sidenav-marker-size: 0.75rem;
2179
+
2180
+ /* The gap the link already puts between the marker and its text, so
2181
+ * one step lands the child's marker under the parent's text. */
2182
+ --skirbi-sidenav-marker-gap: 0.375rem;
2183
+
2184
+ [semtic-nav-section-body] {
2185
+ padding-inline-start: var(--skirbi-sidenav-indent, 0.75rem);
2186
+ }
2187
+
2188
+ [semtic-nav-children] {
2189
+ padding-inline-start: calc(
2190
+ var(--skirbi-sidenav-marker-size) + var(--skirbi-sidenav-marker-gap)
2191
+ );
2192
+ }
2193
+
2194
+ [semtic-nav-section-body] [semtic-nav-link]::before {
2195
+ content: '›';
2196
+ inline-size: var(--skirbi-sidenav-marker-size);
2197
+ flex: 0 0 auto;
2198
+ text-align: center;
2199
+ opacity: 0.5;
2015
2200
  }
2016
2201
  }
2017
2202
  }
@@ -2149,8 +2334,6 @@
2149
2334
  --skirbi-toggle-track-height: 1.35rem;
2150
2335
  --skirbi-toggle-thumb-size: 1rem;
2151
2336
  --skirbi-toggle-thumb-offset: 0.175rem;
2152
- --skirbi-toggle-pill-padding-block: 0.3rem;
2153
- --skirbi-toggle-pill-padding-inline: 0.75rem;
2154
2337
  --skirbi-toggle-bg-off: var(--skirbi-surface-border-final);
2155
2338
  --skirbi-toggle-bg-on: var(--skirbi-primary-main);
2156
2339
  --skirbi-toggle-fg-on: var(--skirbi-primary-contrast);
@@ -2211,12 +2394,12 @@
2211
2394
  justify-items: start;
2212
2395
  }
2213
2396
 
2214
- &:not([type="pill"])[label-position="inside"]
2397
+ &[label-position="inside"]
2215
2398
  [semtic-toggle-visual] {
2216
2399
  grid-template-areas: "label thumb";
2217
2400
  }
2218
2401
 
2219
- &:not([type="pill"]) [semtic-toggle-thumb],
2402
+ & [semtic-toggle-thumb],
2220
2403
  &[type="switch"] [semtic-toggle-thumb] {
2221
2404
  position: relative;
2222
2405
  display: inline-block;
@@ -2248,14 +2431,14 @@
2248
2431
  }
2249
2432
  }
2250
2433
 
2251
- &:not([type="pill"]) input[wc-control]:checked
2434
+ & input[wc-control]:checked
2252
2435
  + [semtic-toggle-visual] [semtic-toggle-thumb],
2253
2436
  &[type="switch"] input[wc-control]:checked
2254
2437
  + [semtic-toggle-visual] [semtic-toggle-thumb] {
2255
2438
  background: var(--skirbi-toggle-bg-on);
2256
2439
  }
2257
2440
 
2258
- &:not([type="pill"]) input[wc-control]:checked
2441
+ & input[wc-control]:checked
2259
2442
  + [semtic-toggle-visual] [semtic-toggle-thumb]::before,
2260
2443
  &[type="switch"] input[wc-control]:checked
2261
2444
  + [semtic-toggle-visual] [semtic-toggle-thumb]::before {
@@ -2268,106 +2451,6 @@
2268
2451
  );
2269
2452
  }
2270
2453
 
2271
- &[type="pill"] [semtic-toggle-visual] {
2272
- display: inline-flex;
2273
- align-items: center;
2274
- justify-content: center;
2275
- width: fit-content;
2276
- min-inline-size: 0;
2277
- padding:
2278
- var(--skirbi-toggle-pill-padding-block)
2279
- var(--skirbi-toggle-pill-padding-inline);
2280
- border: 1px solid var(--skirbi-toggle-border);
2281
- border-radius: 999px;
2282
- background: transparent;
2283
- color: inherit;
2284
- line-height: 1.1;
2285
- white-space: nowrap;
2286
- transition:
2287
- background var(--skirbi-transition-duration, 180ms)
2288
- var(--skirbi-transition-ease, ease),
2289
- border-color var(--skirbi-transition-duration, 180ms)
2290
- var(--skirbi-transition-ease, ease),
2291
- color var(--skirbi-transition-duration, 180ms)
2292
- var(--skirbi-transition-ease, ease),
2293
- box-shadow var(--skirbi-transition-duration, 180ms)
2294
- var(--skirbi-transition-ease, ease);
2295
- }
2296
-
2297
- &[type="pill"] [semtic-toggle-thumb] {
2298
- display: none;
2299
- }
2300
-
2301
- &[type="pill"] input[wc-control]:checked
2302
- + [semtic-toggle-visual] {
2303
- background: var(--skirbi-toggle-bg-on);
2304
- border-color: var(--skirbi-toggle-bg-on);
2305
- color: var(--skirbi-toggle-fg-on);
2306
- }
2307
-
2308
- &[type="pill"][label-position="left"] [semtic-toggle-visual],
2309
- &[type="pill"][label-position="right"] [semtic-toggle-visual],
2310
- &[type="pill"][label-position="top"] [semtic-toggle-visual],
2311
- &[type="pill"][label-position="bottom"] [semtic-toggle-visual] {
2312
- display: inline-grid;
2313
- padding: 0;
2314
- border: 0;
2315
- border-radius: 0;
2316
- background: transparent;
2317
- color: inherit;
2318
- }
2319
-
2320
- &[type="pill"][label-position="left"] [semtic-toggle-visual] {
2321
- grid-template-areas: "label thumb";
2322
- }
2323
-
2324
- &[type="pill"][label-position="right"] [semtic-toggle-visual] {
2325
- grid-template-areas: "thumb label";
2326
- }
2327
-
2328
- &[type="pill"][label-position="top"] [semtic-toggle-visual] {
2329
- grid-template-areas:
2330
- "label"
2331
- "thumb";
2332
- justify-items: start;
2333
- }
2334
-
2335
- &[type="pill"][label-position="bottom"] [semtic-toggle-visual] {
2336
- grid-template-areas:
2337
- "thumb"
2338
- "label";
2339
- justify-items: start;
2340
- }
2341
-
2342
- &[type="pill"][label-position="left"] [semtic-toggle-thumb],
2343
- &[type="pill"][label-position="right"] [semtic-toggle-thumb],
2344
- &[type="pill"][label-position="top"] [semtic-toggle-thumb],
2345
- &[type="pill"][label-position="bottom"] [semtic-toggle-thumb] {
2346
- display: inline-flex;
2347
- grid-area: thumb;
2348
- align-items: center;
2349
- justify-content: center;
2350
- min-inline-size: 2rem;
2351
- padding:
2352
- var(--skirbi-toggle-pill-padding-block)
2353
- var(--skirbi-toggle-pill-padding-inline);
2354
- border: 1px solid var(--skirbi-toggle-border);
2355
- border-radius: 999px;
2356
- background: transparent;
2357
- }
2358
-
2359
- &[type="pill"][label-position="left"] input[wc-control]:checked
2360
- + [semtic-toggle-visual] [semtic-toggle-thumb],
2361
- &[type="pill"][label-position="right"] input[wc-control]:checked
2362
- + [semtic-toggle-visual] [semtic-toggle-thumb],
2363
- &[type="pill"][label-position="top"] input[wc-control]:checked
2364
- + [semtic-toggle-visual] [semtic-toggle-thumb],
2365
- &[type="pill"][label-position="bottom"] input[wc-control]:checked
2366
- + [semtic-toggle-visual] [semtic-toggle-thumb] {
2367
- background: var(--skirbi-toggle-bg-on);
2368
- border-color: var(--skirbi-toggle-bg-on);
2369
- }
2370
-
2371
2454
  input[wc-control]:focus-visible + [semtic-toggle-visual],
2372
2455
  input[wc-control]:focus-visible
2373
2456
  + [semtic-toggle-visual] [semtic-toggle-thumb] {
@@ -2379,43 +2462,6 @@
2379
2462
  cursor: not-allowed;
2380
2463
  opacity: 0.55;
2381
2464
  }
2382
-
2383
- &[type="pill"] {
2384
- display: inline-block;
2385
- width: fit-content;
2386
- }
2387
-
2388
- &[type="pill"] > label[semtic-toggle] {
2389
- display: inline-block;
2390
- width: fit-content;
2391
- }
2392
-
2393
- &[type="pill"] > label[semtic-toggle]
2394
- > input[wc-control] + [semtic-toggle-visual] {
2395
- display: inline-flex;
2396
- align-items: center;
2397
- justify-content: center;
2398
- width: fit-content;
2399
- min-width: 0;
2400
- padding: 0.3rem 0.75rem;
2401
- border: 1px solid var(--skirbi-surface-border-final);
2402
- border-radius: 999px;
2403
- background: transparent;
2404
- color: inherit;
2405
- line-height: 1.1;
2406
- white-space: nowrap;
2407
- }
2408
-
2409
- &[type="pill"] [semtic-toggle-thumb] {
2410
- display: none;
2411
- }
2412
-
2413
- &[type="pill"] > label[semtic-toggle]
2414
- > input[wc-control]:checked + [semtic-toggle-visual] {
2415
- background: var(--skirbi-primary-main);
2416
- border-color: var(--skirbi-primary-main);
2417
- color: var(--skirbi-primary-contrast);
2418
- }
2419
2465
  }
2420
2466
  }
2421
2467
 
@@ -2432,17 +2478,44 @@
2432
2478
 
2433
2479
  /* Form controls (label-position) */
2434
2480
  [skirbi-theme] {
2481
+ /* Form controls are two nested grids, not one flex box.
2482
+ *
2483
+ * The host places the definition against the error, per
2484
+ * label-error-position. The definition places the label against the
2485
+ * control, per label-position. Neither knows about the other, so the two
2486
+ * attributes stop multiplying -- as flex they had to be resolved
2487
+ * together, which is how label-position="top" ended up needing its own
2488
+ * bespoke grid while the rest stayed on flex-direction.
2489
+ *
2490
+ * Everything is placed by named area, so nothing depends on source order
2491
+ * and there is no reversed axis: row-reverse used to put the control on
2492
+ * the far side of its own label, which is why anything positioned
2493
+ * against the control landed on the wrong side under
2494
+ * label-position="right".
2495
+ */
2435
2496
  semtic-input,
2436
2497
  semtic-select,
2437
2498
  semtic-textarea,
2438
2499
  semtic-checkbox,
2439
2500
  semtic-radio {
2440
- display: flex;
2441
- flex-direction: row;
2501
+ display: grid;
2502
+ gap: 0.5rem;
2442
2503
  align-items: center;
2504
+ grid-template-areas: "definition" "error";
2505
+ }
2506
+
2507
+ [semtic-input-definition] {
2508
+ display: grid;
2443
2509
  gap: 0.5rem;
2510
+ align-items: center;
2511
+ min-inline-size: 0;
2512
+ grid-area: definition;
2444
2513
  }
2445
2514
 
2515
+ [semtic-label] { grid-area: label; }
2516
+ [semtic-input-container] { grid-area: control; min-inline-size: 0; }
2517
+ [semtic-error] { grid-area: error; }
2518
+
2446
2519
  input[wc-control],
2447
2520
  select[wc-control],
2448
2521
  textarea[wc-control] {
@@ -2450,74 +2523,52 @@
2450
2523
  -webkit-appearance: none;
2451
2524
  }
2452
2525
 
2453
- semtic-input[label-position="left"],
2454
- semtic-select[label-position="left"],
2455
- semtic-textarea[label-position="left"],
2456
- semtic-checkbox[label-position="left"],
2457
- semtic-radio[label-position="left"] {
2458
- flex-direction: row;
2459
- align-items: center;
2460
- }
2461
-
2462
- semtic-input[label-position="right"],
2463
- semtic-select[label-position="right"],
2464
- semtic-textarea[label-position="right"],
2465
- semtic-checkbox[label-position="right"],
2466
- semtic-radio[label-position="right"] {
2467
- flex-direction: row-reverse;
2468
- align-items: center;
2469
- }
2470
-
2471
- semtic-input[label-position="top"],
2472
- semtic-select[label-position="top"],
2473
- semtic-textarea[label-position="top"],
2474
- semtic-checkbox[label-position="top"],
2475
- semtic-radio[label-position="top"] {
2476
- flex-direction: column;
2477
- align-items: flex-start;
2478
- }
2479
-
2480
- semtic-input[label-position="bottom"],
2481
- semtic-select[label-position="bottom"],
2482
- semtic-textarea[label-position="bottom"],
2483
- semtic-checkbox[label-position="bottom"],
2484
- semtic-radio[label-position="bottom"] {
2485
- flex-direction: column-reverse;
2486
- align-items: flex-start;
2487
- }
2488
-
2489
- semtic-input[label-position="top"] input[wc-control],
2490
- semtic-input[label-position="bottom"] input[wc-control],
2491
- semtic-select[label-position="top"] select[wc-control],
2492
- semtic-select[label-position="bottom"] select[wc-control],
2493
- semtic-textarea[label-position="top"] textarea[wc-control],
2494
- semtic-textarea[label-position="bottom"] textarea[wc-control] {
2526
+ /* label-position: label against control, inside the definition. */
2527
+ semtic-input[label-position="top"] [semtic-input-definition],
2528
+ semtic-select[label-position="top"] [semtic-input-definition],
2529
+ semtic-textarea[label-position="top"] [semtic-input-definition],
2530
+ semtic-checkbox[label-position="top"] [semtic-input-definition],
2531
+ semtic-radio[label-position="top"] [semtic-input-definition] {
2532
+ grid-template-areas: "label" "control";
2533
+ grid-template-columns: minmax(0, 1fr);
2534
+ }
2535
+
2536
+ semtic-input[label-position="bottom"] [semtic-input-definition],
2537
+ semtic-select[label-position="bottom"] [semtic-input-definition],
2538
+ semtic-textarea[label-position="bottom"] [semtic-input-definition],
2539
+ semtic-checkbox[label-position="bottom"] [semtic-input-definition],
2540
+ semtic-radio[label-position="bottom"] [semtic-input-definition] {
2541
+ grid-template-areas: "control" "label";
2542
+ grid-template-columns: minmax(0, 1fr);
2543
+ }
2544
+
2545
+ semtic-input[label-position="left"] [semtic-input-definition],
2546
+ semtic-select[label-position="left"] [semtic-input-definition],
2547
+ semtic-textarea[label-position="left"] [semtic-input-definition],
2548
+ semtic-checkbox[label-position="left"] [semtic-input-definition],
2549
+ semtic-radio[label-position="left"] [semtic-input-definition] {
2550
+ grid-template-areas: "label control";
2551
+ grid-template-columns: auto minmax(0, 1fr);
2552
+ }
2553
+
2554
+ semtic-input[label-position="right"] [semtic-input-definition],
2555
+ semtic-select[label-position="right"] [semtic-input-definition],
2556
+ semtic-textarea[label-position="right"] [semtic-input-definition],
2557
+ semtic-checkbox[label-position="right"] [semtic-input-definition],
2558
+ semtic-radio[label-position="right"] [semtic-input-definition] {
2559
+ grid-template-areas: "control label";
2560
+ grid-template-columns: minmax(0, 1fr) auto;
2561
+ }
2562
+
2563
+ /* The control fills its cell in every direction; the cell decides how
2564
+ * wide that is, so this no longer needs to be per label-position. */
2565
+ [semtic-input-container] > input[wc-control],
2566
+ [semtic-input-container] > select[wc-control],
2567
+ [semtic-input-container] > textarea[wc-control] {
2495
2568
  width: 100%;
2496
2569
  box-sizing: border-box;
2497
2570
  }
2498
2571
 
2499
- semtic-toggle[type="pill"][label-position="inside"]
2500
- [semtic-toggle-label] {
2501
- position: absolute;
2502
- top: 0;
2503
- right: 0;
2504
- bottom: 0;
2505
- left: 0;
2506
- display: flex;
2507
- align-items: center;
2508
- justify-content: center;
2509
- pointer-events: none;
2510
- }
2511
-
2512
- semtic-input[label-position="top"],
2513
- semtic-input[label-position="bottom"],
2514
- semtic-select[label-position="top"],
2515
- semtic-select[label-position="bottom"],
2516
- semtic-textarea[label-position="top"],
2517
- semtic-textarea[label-position="bottom"] {
2518
- width: 100%;
2519
- }
2520
-
2521
2572
  semtic-select[label-position="top"] [skirbi-select],
2522
2573
  semtic-select[label-position="bottom"] [skirbi-select] {
2523
2574
  width: 100%;
@@ -2534,6 +2585,14 @@
2534
2585
  color: var(--skirbi-error-base, #b91c1c);
2535
2586
  }
2536
2587
 
2588
+ /* The gap before a required marker is spacing, so it belongs here rather
2589
+ * than in a whitespace text node. A text node separator cannot survive a
2590
+ * morph: rendering appends it as its own node, parsing merges it into the
2591
+ * label text, and the two shapes never match. */
2592
+ [data-required-marker] {
2593
+ margin-inline-start: 0.25em;
2594
+ }
2595
+
2537
2596
  semtic-input:has([semtic-error]:not(:empty)),
2538
2597
  semtic-select:has([semtic-error]:not(:empty)),
2539
2598
  semtic-textarea:has([semtic-error]:not(:empty)) {
@@ -2544,6 +2603,28 @@
2544
2603
  padding: 0.5rem 0.5rem 0.75rem;
2545
2604
  }
2546
2605
 
2606
+ /* A textarea is the one control that is meaningfully taller than its
2607
+ * label, so the shared `align-items: center` reads wrong on it: with the
2608
+ * label beside the control it would float halfway down. Align to the
2609
+ * start instead, on both levels. */
2610
+ semtic-textarea,
2611
+ semtic-textarea [semtic-input-definition] {
2612
+ align-items: start;
2613
+ }
2614
+
2615
+ /* Resizing along the inline axis would take the control out of its grid
2616
+ * column, so keep it to the block axis. */
2617
+ textarea[wc-control] {
2618
+ resize: vertical;
2619
+
2620
+ /* More room below the text than the shared recipe gives. An input is
2621
+ * a single line sitting in the middle of its box, so equal padding
2622
+ * reads as centred; a textarea fills from the top, which leaves the
2623
+ * last line hard against the bottom edge -- and against the resize
2624
+ * handle sitting in that corner. */
2625
+ padding-block-end: var(--skirbi-textarea-padding-block-end, 1.1rem);
2626
+ }
2627
+
2547
2628
  input[wc-control],
2548
2629
  select[wc-control],
2549
2630
  textarea[wc-control] {
@@ -2554,6 +2635,106 @@
2554
2635
  color: var(--skirbi-secondary-dark);
2555
2636
  font: inherit;
2556
2637
  box-sizing: border-box;
2638
+
2639
+ /* Stated, not inherited. `font: inherit` above also hands over the
2640
+ * page's line-height, and a <select> ignores line-height -- it lays its
2641
+ * inner box out at the font's normal whatever we say. So an input next
2642
+ * to a select grew with the page's line-height while the select stayed
2643
+ * put, and the two ended up different heights for no visible reason.
2644
+ * Naming a value close to normal makes them agree, because the one that
2645
+ * ignores it was going to land here anyway.
2646
+ *
2647
+ * Unverified. This was added for a select that looked shorter than the
2648
+ * input beside it, but the cause turned out to be a font-size of
2649
+ * 0.875rem landing on that control and not its neighbour, which is
2650
+ * fixed separately. The reasoning above is sound on its own terms and
2651
+ * the value is close enough to normal to be harmless, but nothing here
2652
+ * has been shown to change a rendered height. Treat it as removable if
2653
+ * it ever gets in the way rather than as load-bearing. */
2654
+ line-height: var(--skirbi-control-line-height, 1.25);
2655
+ }
2656
+
2657
+ /* Except the textarea, which is real running text: 1.25 is tight for
2658
+ * something that wraps. */
2659
+ textarea[wc-control] {
2660
+ line-height: var(--skirbi-textarea-line-height, 1.5);
2661
+ }
2662
+
2663
+ /* Clearable input
2664
+ *
2665
+ * semtic-input renders the control and its clear button inside
2666
+ * [semtic-input-container]. That box is exactly the size of
2667
+ * the control, which is the whole point: the host is not, because it
2668
+ * holds the label and the error as well, and where the control sits
2669
+ * inside it changes with label-position.
2670
+ *
2671
+ * With a box of the right size to position against, one rule covers
2672
+ * every label position -- no per-direction arithmetic, no layout that
2673
+ * depends on whether the button happens to be visible.
2674
+ *
2675
+ * :not([hidden]) stays on the button's own rules: these selectors
2676
+ * outrank the [hidden] guard further down this file, so without it a
2677
+ * clear button could never hide again.
2678
+ */
2679
+ [semtic-input-container] {
2680
+ position: relative;
2681
+ display: flex;
2682
+ align-items: center;
2683
+ min-inline-size: 0;
2684
+ }
2685
+
2686
+ [semtic-input-container] input[wc-control] {
2687
+ inline-size: 100%;
2688
+ padding-inline-end: var(--skirbi-clear-size, 2.25rem);
2689
+ }
2690
+
2691
+ /* type="search" comes with a clear button of its own in WebKit and
2692
+ * Chromium, which [semtic-clear] would otherwise sit next to: two
2693
+ * crosses, one themed and one not, only one of which fires the events
2694
+ * the component dispatches. `appearance: none` on the input does not
2695
+ * reach these -- they are separate shadow pseudo-elements and have to be
2696
+ * turned off by name. */
2697
+ input[wc-control][type="search"]::-webkit-search-cancel-button,
2698
+ input[wc-control][type="search"]::-webkit-search-decoration,
2699
+ input[wc-control][type="search"]::-webkit-search-results-button,
2700
+ input[wc-control][type="search"]::-webkit-search-results-decoration {
2701
+ -webkit-appearance: none;
2702
+ appearance: none;
2703
+ }
2704
+
2705
+ [semtic-clear]:not([hidden]) {
2706
+ position: absolute;
2707
+ inset-inline-end: 0.35rem;
2708
+ inset-block-start: 50%;
2709
+ transform: translateY(-50%);
2710
+ display: inline-flex;
2711
+ align-items: center;
2712
+ justify-content: center;
2713
+ inline-size: var(--skirbi-clear-size, 2.25rem);
2714
+ block-size: var(--skirbi-clear-size, 2.25rem);
2715
+ padding: 0;
2716
+ border: 0;
2717
+ border-radius: 999px;
2718
+ background: none;
2719
+ color: var(--skirbi-secondary-dark);
2720
+ font: inherit;
2721
+ line-height: 1;
2722
+ cursor: pointer;
2723
+ opacity: 0.55;
2724
+ }
2725
+
2726
+ [semtic-clear]:not([hidden]):hover,
2727
+ [semtic-clear]:not([hidden]):focus-visible {
2728
+ opacity: 1;
2729
+ }
2730
+
2731
+ input[wc-control]::placeholder,
2732
+ textarea[wc-control]::placeholder {
2733
+ color: color-mix(
2734
+ in srgb,
2735
+ var(--skirbi-secondary-dark) 65%,
2736
+ var(--skirbi-secondary-light)
2737
+ );
2557
2738
  }
2558
2739
 
2559
2740
  input[wc-control]:focus,
@@ -2566,6 +2747,62 @@
2566
2747
  );
2567
2748
  }
2568
2749
 
2750
+ /* Number inputs — drop the native up/down stepper, keep our own
2751
+ * border/background recipe instead of the browser's inset widget.
2752
+ */
2753
+ :is(
2754
+ semtic-input[type="number"],
2755
+ semtic-input-number
2756
+ ) input[wc-control][type="number"] {
2757
+ appearance: textfield;
2758
+ -moz-appearance: textfield;
2759
+ }
2760
+
2761
+ :is(
2762
+ semtic-input[type="number"],
2763
+ semtic-input-number
2764
+ ) input[wc-control][type="number"]::-webkit-outer-spin-button,
2765
+ :is(
2766
+ semtic-input[type="number"],
2767
+ semtic-input-number
2768
+ ) input[wc-control][type="number"]::-webkit-inner-spin-button {
2769
+ appearance: none;
2770
+ -webkit-appearance: none;
2771
+ margin: 0;
2772
+ }
2773
+
2774
+ /* Select — swap the native chrome for a custom caret so it matches
2775
+ * the rest of the input recipe instead of the OS-drawn widget.
2776
+ */
2777
+ [skirbi-select] {
2778
+ position: relative;
2779
+ display: inline-block;
2780
+ }
2781
+
2782
+ [skirbi-select] select[wc-control] {
2783
+ appearance: none;
2784
+ -webkit-appearance: none;
2785
+ -moz-appearance: none;
2786
+ padding-inline-end: 2.25rem;
2787
+ }
2788
+
2789
+ [skirbi-select]::after {
2790
+ content: "";
2791
+ position: absolute;
2792
+ top: 50%;
2793
+ right: 0.9rem;
2794
+ inline-size: 0.45rem;
2795
+ block-size: 0.45rem;
2796
+ border-right: 2px solid var(--skirbi-secondary-dark);
2797
+ border-bottom: 2px solid var(--skirbi-secondary-dark);
2798
+ transform: translateY(-65%) rotate(45deg);
2799
+ pointer-events: none;
2800
+ }
2801
+
2802
+ [skirbi-select]:has(select[wc-control]:disabled)::after {
2803
+ opacity: 0.55;
2804
+ }
2805
+
2569
2806
  /* Checkbox / radio controls
2570
2807
  *
2571
2808
  * Keep label-position/layout rules above in charge. These styles only
@@ -2577,26 +2814,40 @@
2577
2814
  semtic-input[type="radio"],
2578
2815
  semtic-checkbox,
2579
2816
  semtic-radio
2580
- ) > input[wc-control]:is([type="checkbox"], [type="radio"]) {
2817
+ ) input[wc-control]:is([type="checkbox"], [type="radio"]) {
2581
2818
  appearance: none;
2582
2819
  -webkit-appearance: none;
2583
2820
 
2584
- inline-size: var(--skirbi-choice-size, 0.75rem);
2585
- block-size: var(--skirbi-choice-size, 0.75rem);
2586
- min-inline-size: var(--skirbi-choice-size, 0.75rem);
2587
- min-block-size: var(--skirbi-choice-size, 0.75rem);
2821
+ inline-size: var(--skirbi-choice-size, calc((1.325rem + 1em) * 6 / 7));
2822
+ block-size: var(--skirbi-choice-size, calc((1.325rem + 1em) * 6 / 7));
2823
+ min-inline-size: var(--skirbi-choice-size, calc((1.325rem + 1em) * 6 / 7));
2824
+ min-block-size: var(--skirbi-choice-size, calc((1.325rem + 1em) * 6 / 7));
2588
2825
 
2589
2826
  margin: 0;
2590
2827
  padding: 0;
2828
+ box-sizing: border-box;
2591
2829
 
2592
- border: 1px solid var(--skirbi-choice-border, var(--skirbi-surface-border-final));
2593
- background: var(--skirbi-choice-bg, var(--skirbi-surface-bg-final));
2594
- color: var(--skirbi-choice-accent, var(--skirbi-primary-main));
2830
+ border: 1px solid var(--skirbi-surface-border-final);
2831
+ background: var(--skirbi-choice-background, var(--skirbi-secondary-light));
2832
+
2833
+ /* The contrast colour for the background above, exactly as the text
2834
+ * controls pair secondary-light with secondary-dark. A choice control
2835
+ * is a filled box that has to read against its own fill, so it takes
2836
+ * the same pairing rather than an accent that only happens to be
2837
+ * legible on the default surface.
2838
+ *
2839
+ * This is also the single seam for retinting one: tick, dot, checked
2840
+ * border, checked background tint and hover border are all currentColor
2841
+ * further down, so this one declaration carries the whole control and
2842
+ * an app changing it does not have to restate the recipe. */
2843
+ color: var(--skirbi-choice-color, var(--skirbi-secondary-dark));
2595
2844
 
2596
2845
  display: inline-grid;
2597
2846
  place-content: center;
2598
2847
  flex: 0 0 auto;
2599
2848
  cursor: pointer;
2849
+ user-select: none;
2850
+ caret-color: transparent;
2600
2851
 
2601
2852
  transition:
2602
2853
  border-color var(--skirbi-transition-duration, 180ms)
@@ -2607,25 +2858,48 @@
2607
2858
  var(--skirbi-transition-ease, ease);
2608
2859
  }
2609
2860
 
2861
+ :is(
2862
+ semtic-input[type="checkbox"],
2863
+ semtic-input[type="radio"],
2864
+ semtic-checkbox,
2865
+ semtic-radio
2866
+ ) [semtic-label] {
2867
+ cursor: pointer;
2868
+ user-select: none;
2869
+ }
2870
+
2610
2871
  /* Checkbox shape */
2611
2872
  :is(
2612
2873
  semtic-input[type="checkbox"],
2613
2874
  semtic-checkbox
2614
- ) > input[wc-control][type="checkbox"] {
2615
- border-radius: 0.2rem;
2875
+ ) input[wc-control][type="checkbox"] {
2876
+ border-radius: var(
2877
+ --skirbi-choice-radius,
2878
+ calc(var(--skirbi-choice-size, calc((1.325rem + 1em) * 6 / 7)) * 0.267)
2879
+ );
2616
2880
  }
2617
2881
 
2618
- /* Checkbox tick */
2882
+ /* Checkbox tick — sized proportionally to --skirbi-choice-size so
2883
+ * overriding the box size (e.g. to a larger tap target) keeps the
2884
+ * tick centered and legible instead of shrinking into a corner.
2885
+ *
2886
+ * To change how much of the box the mark fills without touching the box,
2887
+ * set --skirbi-choice-mark-scale (1 = the proportions above). It rides
2888
+ * the reveal transform rather than the dimensions, so the stroke thins
2889
+ * with the mark instead of staying heavy on a smaller tick, and it stays
2890
+ * centered on transform-origin for free.
2891
+ */
2619
2892
  :is(
2620
2893
  semtic-input[type="checkbox"],
2621
2894
  semtic-checkbox
2622
- ) > input[wc-control][type="checkbox"]::before {
2895
+ ) input[wc-control][type="checkbox"]::before {
2623
2896
  content: "";
2624
- inline-size: 0.28rem;
2625
- block-size: 0.52rem;
2897
+ inline-size: calc(var(--skirbi-choice-size, calc((1.325rem + 1em) * 6 / 7)) * 0.373);
2898
+ block-size: calc(var(--skirbi-choice-size, calc((1.325rem + 1em) * 6 / 7)) * 0.693);
2626
2899
 
2627
2900
  border: solid currentColor;
2628
- border-width: 0 0.11rem 0.11rem 0;
2901
+ border-width: 0 calc(var(--skirbi-choice-size, calc((1.325rem + 1em) * 6 / 7)) * 0.147)
2902
+ calc(var(--skirbi-choice-size, calc((1.325rem + 1em) * 6 / 7)) * 0.147) 0;
2629
2903
 
2630
2904
  transform: rotate(45deg) scale(0);
2631
2905
  transform-origin: center;
@@ -2637,18 +2911,18 @@
2637
2911
  :is(
2638
2912
  semtic-input[type="radio"],
2639
2913
  semtic-radio
2640
- ) > input[wc-control][type="radio"] {
2914
+ ) input[wc-control][type="radio"] {
2641
2915
  border-radius: 50%;
2642
2916
  }
2643
2917
 
2644
- /* Radio dot */
2918
+ /* Radio dot — proportional for the same reason as the checkbox tick. */
2645
2919
  :is(
2646
2920
  semtic-input[type="radio"],
2647
2921
  semtic-radio
2648
- ) > input[wc-control][type="radio"]::before {
2922
+ ) input[wc-control][type="radio"]::before {
2649
2923
  content: "";
2650
- inline-size: 0.42rem;
2651
- block-size: 0.42rem;
2924
+ inline-size: calc(var(--skirbi-choice-size, calc((1.325rem + 1em) * 6 / 7)) * 0.56);
2925
+ block-size: calc(var(--skirbi-choice-size, calc((1.325rem + 1em) * 6 / 7)) * 0.56);
2652
2926
  border-radius: 50%;
2653
2927
  background: currentColor;
2654
2928
 
@@ -2663,27 +2937,27 @@
2663
2937
  semtic-input[type="radio"],
2664
2938
  semtic-checkbox,
2665
2939
  semtic-radio
2666
- ) > input[wc-control]:is([type="checkbox"], [type="radio"]):checked {
2940
+ ) input[wc-control]:is([type="checkbox"], [type="radio"]):checked {
2667
2941
  border-color: currentColor;
2668
2942
  background: color-mix(
2669
2943
  in srgb,
2670
2944
  currentColor 7%,
2671
- var(--skirbi-surface-bg-final)
2945
+ var(--skirbi-secondary-light)
2672
2946
  );
2673
2947
  }
2674
2948
 
2675
2949
  :is(
2676
2950
  semtic-input[type="checkbox"],
2677
2951
  semtic-checkbox
2678
- ) > input[wc-control][type="checkbox"]:checked::before {
2679
- transform: rotate(45deg) scale(1);
2952
+ ) input[wc-control][type="checkbox"]:checked::before {
2953
+ transform: rotate(45deg) scale(var(--skirbi-choice-mark-scale, 1));
2680
2954
  }
2681
2955
 
2682
2956
  :is(
2683
2957
  semtic-input[type="radio"],
2684
2958
  semtic-radio
2685
- ) > input[wc-control][type="radio"]:checked::before {
2686
- transform: scale(1);
2959
+ ) input[wc-control][type="radio"]:checked::before {
2960
+ transform: scale(var(--skirbi-choice-mark-scale, 1));
2687
2961
  }
2688
2962
 
2689
2963
  /* Hover/focus */
@@ -2692,7 +2966,7 @@
2692
2966
  semtic-input[type="radio"],
2693
2967
  semtic-checkbox,
2694
2968
  semtic-radio
2695
- ) > input[wc-control]:is([type="checkbox"], [type="radio"]):hover {
2969
+ ) input[wc-control]:is([type="checkbox"], [type="radio"]):hover {
2696
2970
  border-color: currentColor;
2697
2971
  }
2698
2972
 
@@ -2701,7 +2975,7 @@
2701
2975
  semtic-input[type="radio"],
2702
2976
  semtic-checkbox,
2703
2977
  semtic-radio
2704
- ) > input[wc-control]:is([type="checkbox"], [type="radio"]):focus-visible {
2978
+ ) input[wc-control]:is([type="checkbox"], [type="radio"]):focus-visible {
2705
2979
  outline: none;
2706
2980
  box-shadow: 0 0 0 2px color-mix(
2707
2981
  in srgb,
@@ -2716,7 +2990,7 @@
2716
2990
  semtic-input[type="radio"],
2717
2991
  semtic-checkbox,
2718
2992
  semtic-radio
2719
- ) > input[wc-control]:is([type="checkbox"], [type="radio"]):disabled {
2993
+ ) input[wc-control]:is([type="checkbox"], [type="radio"]):disabled {
2720
2994
  opacity: 0.55;
2721
2995
  cursor: not-allowed;
2722
2996
  }
@@ -2750,126 +3024,78 @@
2750
3024
 
2751
3025
  /* Form controls (label-error-position) */
2752
3026
  [skirbi-theme] {
2753
- semtic-input[label-error-position="inline"][label-position="top"],
2754
- semtic-select[label-error-position="inline"][label-position="top"],
2755
- semtic-textarea[label-error-position="inline"][label-position="top"] {
2756
- display: grid;
2757
- grid-template-areas:
2758
- "label error"
2759
- "input input";
2760
- grid-template-columns: auto 1fr;
2761
- align-items: baseline;
2762
- }
2763
-
2764
- semtic-input[label-error-position="inline"] [semtic-label],
2765
- semtic-select[label-error-position="inline"] [semtic-label],
2766
- semtic-textarea[label-error-position="inline"] [semtic-label] {
2767
- grid-area: label;
2768
- }
2769
-
2770
- semtic-input[label-error-position="inline"] input[wc-control],
2771
- semtic-select[label-error-position="inline"] select[wc-control],
2772
- semtic-textarea[label-error-position="inline"] textarea[wc-control] {
2773
- grid-area: input;
2774
- }
2775
-
2776
- semtic-input[label-error-position="inline"] [semtic-error],
2777
- semtic-select[label-error-position="inline"] [semtic-error],
2778
- semtic-textarea[label-error-position="inline"] [semtic-error] {
2779
- grid-area: error;
2780
- text-align: right;
2781
- align-self: baseline;
2782
- }
2783
-
2784
- semtic-input[label-error-position="bottom"] [semtic-error],
2785
- semtic-select[label-error-position="bottom"] [semtic-error],
2786
- semtic-textarea[label-error-position="bottom"] [semtic-error] {
2787
- order: 99;
2788
- width: 100%;
2789
- }
2790
-
3027
+ /* label-error-position: the definition against the error, on the host.
3028
+ *
3029
+ * Independent of label-position, which arranges the inside of the
3030
+ * definition. That separation is the point of the two levels: these two
3031
+ * attributes used to have to be resolved together, so every combination
3032
+ * needed its own rule.
3033
+ *
3034
+ * "bottom" is the base template, so it needs nothing here.
3035
+ */
2791
3036
  semtic-input[label-error-position="top"],
2792
3037
  semtic-select[label-error-position="top"],
2793
- semtic-textarea[label-error-position="top"] {
2794
- display: grid;
2795
- grid-template-areas:
2796
- "error"
2797
- "label"
2798
- "input";
2799
- }
2800
-
2801
- semtic-input[label-error-position="top"] [semtic-label],
2802
- semtic-select[label-error-position="top"] [semtic-label],
2803
- semtic-textarea[label-error-position="top"] [semtic-label] {
2804
- grid-area: label;
2805
- }
2806
-
2807
- semtic-input[label-error-position="top"] input[wc-control],
2808
- semtic-select[label-error-position="top"] select[wc-control],
2809
- semtic-textarea[label-error-position="top"] textarea[wc-control] {
2810
- grid-area: input;
2811
- }
2812
-
2813
- semtic-input[label-error-position="top"] [semtic-error],
2814
- semtic-select[label-error-position="top"] [semtic-error],
2815
- semtic-textarea[label-error-position="top"] [semtic-error] {
2816
- grid-area: error;
3038
+ semtic-textarea[label-error-position="top"],
3039
+ semtic-checkbox[label-error-position="top"],
3040
+ semtic-radio[label-error-position="top"] {
3041
+ grid-template-areas: "error" "definition";
3042
+ grid-template-columns: minmax(0, 1fr);
2817
3043
  }
2818
3044
 
2819
3045
  semtic-input[label-error-position="left"],
2820
3046
  semtic-select[label-error-position="left"],
2821
- semtic-textarea[label-error-position="left"] {
2822
- display: grid;
2823
- grid-template-areas:
2824
- "label input"
2825
- "error input";
2826
- grid-template-columns: auto 1fr;
2827
- }
2828
-
2829
- semtic-input[label-error-position="left"] [semtic-label],
2830
- semtic-select[label-error-position="left"] [semtic-label],
2831
- semtic-textarea[label-error-position="left"] [semtic-label] {
2832
- grid-area: label;
2833
- }
2834
-
2835
- semtic-input[label-error-position="left"] input[wc-control],
2836
- semtic-select[label-error-position="left"] select[wc-control],
2837
- semtic-textarea[label-error-position="left"] textarea[wc-control] {
2838
- grid-area: input;
2839
- }
2840
-
2841
- semtic-input[label-error-position="left"] [semtic-error],
2842
- semtic-select[label-error-position="left"] [semtic-error],
2843
- semtic-textarea[label-error-position="left"] [semtic-error] {
2844
- grid-area: error;
3047
+ semtic-textarea[label-error-position="left"],
3048
+ semtic-checkbox[label-error-position="left"],
3049
+ semtic-radio[label-error-position="left"] {
3050
+ grid-template-areas: "error definition";
3051
+ grid-template-columns: auto minmax(0, 1fr);
2845
3052
  }
2846
3053
 
2847
3054
  semtic-input[label-error-position="right"],
2848
3055
  semtic-select[label-error-position="right"],
2849
- semtic-textarea[label-error-position="right"] {
2850
- display: grid;
2851
- grid-template-areas:
2852
- "label input"
2853
- "input error";
2854
- grid-template-columns: 1fr auto;
3056
+ semtic-textarea[label-error-position="right"],
3057
+ semtic-checkbox[label-error-position="right"],
3058
+ semtic-radio[label-error-position="right"] {
3059
+ grid-template-areas: "definition error";
3060
+ grid-template-columns: minmax(0, 1fr) auto;
2855
3061
  }
2856
3062
 
2857
- semtic-input[label-error-position="right"] [semtic-label],
2858
- semtic-select[label-error-position="right"] [semtic-label],
2859
- semtic-textarea[label-error-position="right"] [semtic-label] {
2860
- grid-area: label;
2861
- }
3063
+ /* inline: the error shares the label's row, right-aligned, so it reads
3064
+ * as an annotation on the label rather than a line of its own.
3065
+ *
3066
+ * This is the one value where the two levels cannot stay independent.
3067
+ * The label lives inside the definition and the error is a sibling of
3068
+ * it, so putting them on the same row means putting them in the same
3069
+ * grid -- hence display: contents on the definition, which hands its
3070
+ * three children up to the host. Only the vertical label positions can
3071
+ * do this: with the label beside the control there is no label row for
3072
+ * the error to share, so those fall through to the base template and
3073
+ * the error takes its own row underneath.
3074
+ */
3075
+ :is(
3076
+ semtic-input, semtic-select, semtic-textarea,
3077
+ semtic-checkbox, semtic-radio
3078
+ )[label-error-position="inline"]:is(
3079
+ :not([label-position]), [label-position="top"], [label-position="bottom"]
3080
+ ) {
3081
+ grid-template-areas: "label error" "control control";
3082
+ grid-template-columns: auto minmax(0, 1fr);
3083
+ align-items: baseline;
2862
3084
 
2863
- semtic-input[label-error-position="right"] input[wc-control],
2864
- semtic-select[label-error-position="right"] select[wc-control],
2865
- semtic-textarea[label-error-position="right"] textarea[wc-control] {
2866
- grid-area: input;
3085
+ & > [semtic-input-definition] {
3086
+ display: contents;
3087
+ }
3088
+
3089
+ & > [semtic-error] {
3090
+ text-align: right;
3091
+ }
2867
3092
  }
2868
3093
 
2869
- semtic-input[label-error-position="right"] [semtic-error],
2870
- semtic-select[label-error-position="right"] [semtic-error],
2871
- semtic-textarea[label-error-position="right"] [semtic-error] {
2872
- grid-area: error;
3094
+ :is(
3095
+ semtic-input, semtic-select, semtic-textarea,
3096
+ semtic-checkbox, semtic-radio
3097
+ )[label-error-position="inline"][label-position="bottom"] {
3098
+ grid-template-areas: "control control" "label error";
2873
3099
  }
2874
3100
  }
2875
3101
 
@@ -3424,26 +3650,6 @@
3424
3650
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--skirbi-primary-main) 25%, transparent);
3425
3651
  }
3426
3652
 
3427
- semtic-input[label-position="top"] {
3428
- display: grid;
3429
- grid-template-areas:
3430
- "label error"
3431
- "input input";
3432
- grid-template-columns: auto 1fr;
3433
- }
3434
-
3435
- semtic-input[label-position="top"] [semtic-label] {
3436
- grid-area: label;
3437
- }
3438
-
3439
- semtic-input[label-position="top"] input[wc-control] {
3440
- grid-area: input;
3441
- }
3442
-
3443
- semtic-input[label-position="top"] [semtic-error] {
3444
- grid-area: error;
3445
- text-align: right;
3446
- }
3447
3653
 
3448
3654
  }
3449
3655
 
@@ -3731,6 +3937,45 @@
3731
3937
  }
3732
3938
  }
3733
3939
 
3940
+ /**
3941
+ * @styles pinta.semtic-grid-diptych Diptych grid
3942
+ * @description
3943
+ *
3944
+ * Two-region grid primitive: a flexible content column and a fixed-width
3945
+ * aside (e.g. a sidenav). Content is expected first in DOM/reading order
3946
+ * so screen readers and keyboard navigation reach it before the aside;
3947
+ * the aside is repositioned to the visual left via `grid-area`, not by
3948
+ * reordering the DOM. On narrow screens the regions stack as content,
3949
+ * then aside.
3950
+ *
3951
+ * | Token | Purpose |
3952
+ * | --- | --- |
3953
+ * | `--skirbi-diptych-aside` | Width of the aside column. |
3954
+ * | `--skirbi-diptych-gap` | Gap between regions. |
3955
+ */
3956
+
3957
+ [skirbi-theme] {
3958
+ semtic-grid[diptych] {
3959
+ display: grid;
3960
+ grid-template-areas: "aside content";
3961
+ grid-template-columns:
3962
+ minmax(10rem, var(--skirbi-diptych-aside))
3963
+ minmax(0, 1fr);
3964
+ gap: var(--skirbi-diptych-gap);
3965
+ align-items: start;
3966
+
3967
+ > :first-child {
3968
+ grid-area: content;
3969
+ min-inline-size: 0;
3970
+ }
3971
+
3972
+ > :nth-child(2) {
3973
+ grid-area: aside;
3974
+ min-inline-size: 0;
3975
+ }
3976
+ }
3977
+ }
3978
+
3734
3979
  /**
3735
3980
  * @styles pinta.semtic-grid-triptych Triptych grid
3736
3981
  * @description
@@ -3886,4 +4131,27 @@
3886
4131
  display: none;
3887
4132
  }
3888
4133
 
4134
+ [skirbi-theme] {
4135
+ semtic-form-row {
4136
+ display: grid;
4137
+ gap: var(--skirbi-grid-gap, 1rem);
4138
+ grid-template-columns: repeat(
4139
+ var(--skirbi-form-row-columns, 2),
4140
+ minmax(0, 1fr)
4141
+ );
4142
+
4143
+ /* Trailing space so consecutive rows do not run together. */
4144
+ padding-block-end: var(--skirbi-form-row-spacing, 1rem);
4145
+ }
4146
+
4147
+ /* A nested row is a cell of the row around it, so the outer row's gap
4148
+ * already separates it from whatever follows. Its own trailing space
4149
+ * lands inside that gap and reads as a double one -- and against the
4150
+ * bottom of the outer row it is trailing space with nothing after it
4151
+ * to separate from. */
4152
+ semtic-form-row semtic-form-row {
4153
+ padding-block-end: 0;
4154
+ }
4155
+ }
4156
+
3889
4157
  }