@surflane/css 0.16.1 → 0.18.0

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/controls.css CHANGED
@@ -14,18 +14,22 @@
14
14
  border-radius: var(--surf-radius-pill);
15
15
  background: transparent;
16
16
  color: var(--surf-ink-muted);
17
- font: var(--surf-weight-medium) var(--surf-type-caption-size)/1
18
- var(--surf-font-body);
17
+ font-weight: var(--surf-weight-medium);
18
+ font-size: var(--surf-type-caption-size);
19
+ line-height: 1;
20
+ font-family: var(--surf-font-body);
19
21
  letter-spacing: var(--surf-type-caption-tracking);
20
22
  flex-shrink: 0;
21
23
  }
22
24
  .surf-control-group {
23
25
  padding: 2px;
24
26
  }
27
+ /* An icon beside a segment's name keeps a step from it. */
25
28
  .surf-segment {
26
29
  display: inline-flex;
27
30
  align-items: center;
28
31
  justify-content: center;
32
+ gap: var(--surf-space-1);
29
33
  min-width: calc(var(--surf-control-height) - 6px);
30
34
  height: calc(var(--surf-control-height) - 6px);
31
35
  padding-inline: var(--surf-space-2);
@@ -103,9 +107,10 @@
103
107
  border-radius: var(--surf-control-radius);
104
108
  background: transparent;
105
109
  color: var(--surf-ink);
106
- font: var(--surf-weight-regular)
107
- var(--surf-type-body-size)/var(--surf-type-body-leading)
108
- var(--surf-font-body);
110
+ font-weight: var(--surf-weight-regular);
111
+ font-size: var(--surf-type-body-size);
112
+ line-height: var(--surf-type-body-leading);
113
+ font-family: var(--surf-font-body);
109
114
  letter-spacing: var(--surf-type-body-tracking);
110
115
  cursor: pointer;
111
116
  }
@@ -128,8 +133,10 @@
128
133
 
129
134
  .surf-segment {
130
135
  min-block-size: calc(var(--surf-control-height) - 6px);
131
- font: var(--surf-weight-medium) var(--surf-type-caption-size)/1
132
- var(--surf-font-body);
136
+ font-weight: var(--surf-weight-medium);
137
+ font-size: var(--surf-type-caption-size);
138
+ line-height: 1;
139
+ font-family: var(--surf-font-body);
133
140
  letter-spacing: var(--surf-type-caption-tracking);
134
141
  }
135
142
  .surf-control-group label:has(input:checked) .surf-segment {
@@ -96,9 +96,10 @@
96
96
  }
97
97
  .surf-prose {
98
98
  max-width: var(--surf-layout-reading);
99
- font: var(--surf-weight-regular)
100
- var(--surf-type-reading-size)/var(--surf-type-reading-leading)
101
- var(--surf-font-body);
99
+ font-weight: var(--surf-weight-regular);
100
+ font-size: var(--surf-type-reading-size);
101
+ line-height: var(--surf-type-reading-leading);
102
+ font-family: var(--surf-font-body);
102
103
  color: var(--surf-ink-body);
103
104
  overflow-wrap: anywhere;
104
105
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@surflane/css",
3
- "version": "0.16.1",
3
+ "version": "0.18.0",
4
4
  "description": "Surflane's CSS-only layer: control, layout composition, document typography and presentation classes that work without React, on top of @surflane/design-tokens.",
5
5
  "keywords": [
6
6
  "design-system",
@@ -37,7 +37,7 @@
37
37
  "./package.json": "./package.json"
38
38
  },
39
39
  "peerDependencies": {
40
- "@surflane/design-tokens": "^0.16.1"
40
+ "@surflane/design-tokens": "^0.18.0"
41
41
  },
42
42
  "publishConfig": {
43
43
  "access": "public"
@@ -19,8 +19,10 @@
19
19
  border-radius: var(--surf-radius-full);
20
20
  background: var(--surf-recessed);
21
21
  color: var(--surf-ink-body);
22
- font: var(--surf-weight-medium) var(--surf-type-caption-size)/1
23
- var(--surf-font-body);
22
+ font-weight: var(--surf-weight-medium);
23
+ font-size: var(--surf-type-caption-size);
24
+ line-height: 1;
25
+ font-family: var(--surf-font-body);
24
26
  letter-spacing: var(--surf-type-caption-tracking);
25
27
  }
26
28
  .surf-avatar[data-size='small'] {
@@ -15,9 +15,10 @@
15
15
  border-radius: var(--surf-radius-pill);
16
16
  background: var(--surf-badge-neutral-bg);
17
17
  color: var(--surf-status-neutral-fg);
18
- font: var(--surf-weight-medium)
19
- var(--surf-type-caption-size)/var(--surf-type-caption-leading)
20
- var(--surf-font-body);
18
+ font-weight: var(--surf-weight-medium);
19
+ font-size: var(--surf-type-caption-size);
20
+ line-height: var(--surf-type-caption-leading);
21
+ font-family: var(--surf-font-body);
21
22
  overflow-wrap: anywhere;
22
23
  }
23
24
  .surf-badge-icon {
@@ -18,8 +18,10 @@
18
18
  padding-inline: var(--surf-banner-inset, var(--surf-space-4));
19
19
  background: var(--surf-status-info-bg);
20
20
  color: var(--surf-status-info-fg);
21
- font: var(--surf-weight-regular) var(--surf-type-body-size) /
22
- var(--surf-type-body-leading) var(--surf-font-body);
21
+ font-weight: var(--surf-weight-regular);
22
+ font-size: var(--surf-type-body-size);
23
+ line-height: var(--surf-type-body-leading);
24
+ font-family: var(--surf-font-body);
23
25
  letter-spacing: var(--surf-type-body-tracking);
24
26
  }
25
27
  .surf-banner[data-tone='caution'] {
@@ -7,7 +7,8 @@
7
7
  max-width: 100%;
8
8
  overflow: auto;
9
9
  }
10
- .surf-feedback-sr {
10
+ .surf-feedback-sr,
11
+ .surf-visually-hidden {
11
12
  position: absolute;
12
13
  width: 1px;
13
14
  height: 1px;
@@ -21,9 +21,10 @@
21
21
  max-width: 100%;
22
22
  }
23
23
  .surf-breadcrumbs {
24
- font: var(--surf-weight-regular)
25
- var(--surf-type-caption-size)/var(--surf-type-caption-leading)
26
- var(--surf-font-body);
24
+ font-weight: var(--surf-weight-regular);
25
+ font-size: var(--surf-type-caption-size);
26
+ line-height: var(--surf-type-caption-leading);
27
+ font-family: var(--surf-font-body);
27
28
  }
28
29
  .surf-breadcrumb-separator {
29
30
  display: inline-flex;
@@ -6,6 +6,9 @@
6
6
  /* Cards use one surface; children provide hierarchy without extra frames. */
7
7
  .surf-card {
8
8
  display: grid;
9
+ /* Stretched to a taller neighbor in a row, a card keeps its parts at the top
10
+ and leaves the extra height below them. */
11
+ align-content: start;
9
12
  gap: var(--surf-space-4);
10
13
  min-width: 0;
11
14
  padding: var(--surf-surface-padding, var(--surf-space-6));
@@ -36,9 +39,10 @@
36
39
  .surf-card-title {
37
40
  margin: 0;
38
41
  color: var(--surf-ink);
39
- font: var(--surf-weight-medium)
40
- var(--surf-type-section-size)/var(--surf-type-section-leading)
41
- var(--surf-font-body);
42
+ font-weight: var(--surf-weight-medium);
43
+ font-size: var(--surf-type-section-size);
44
+ line-height: var(--surf-type-section-leading);
45
+ font-family: var(--surf-font-body);
42
46
  letter-spacing: var(--surf-type-section-tracking);
43
47
  overflow-wrap: anywhere;
44
48
  }
@@ -27,9 +27,10 @@
27
27
  }
28
28
  .surf-code-language {
29
29
  color: var(--surf-ink-muted);
30
- font: var(--surf-weight-regular)
31
- var(--surf-type-caption-size)/var(--surf-type-caption-leading)
32
- var(--surf-font-code);
30
+ font-weight: var(--surf-weight-regular);
31
+ font-size: var(--surf-type-caption-size);
32
+ line-height: var(--surf-type-caption-leading);
33
+ font-family: var(--surf-font-code);
33
34
  letter-spacing: var(--surf-tracking-mono);
34
35
  }
35
36
  .surf-code-block > :is(.surf-scroll-root, .surf-code-scroll) {
@@ -39,9 +40,10 @@
39
40
  .surf-code-text {
40
41
  margin: 0;
41
42
  padding: var(--surf-space-4);
42
- font: var(--surf-weight-regular)
43
- var(--surf-type-code-size)/var(--surf-type-code-leading)
44
- var(--surf-font-code);
43
+ font-weight: var(--surf-weight-regular);
44
+ font-size: var(--surf-type-code-size);
45
+ line-height: var(--surf-type-code-leading);
46
+ font-family: var(--surf-font-code);
45
47
  letter-spacing: var(--surf-tracking-mono);
46
48
  font-variant-ligatures: none;
47
49
  white-space: pre;
@@ -21,8 +21,10 @@
21
21
  align-items: start;
22
22
  column-gap: var(--surf-description-list-gap);
23
23
  margin: 0;
24
- font: var(--surf-weight-regular) var(--surf-size-font-default) /
25
- var(--surf-description-list-leading) var(--surf-font-body);
24
+ font-weight: var(--surf-weight-regular);
25
+ font-size: var(--surf-size-font-default);
26
+ line-height: var(--surf-description-list-leading);
27
+ font-family: var(--surf-font-body);
26
28
  letter-spacing: var(--surf-type-body-tracking);
27
29
  }
28
30
  /* Two columns where both fit, one where they do not. */
@@ -61,8 +63,10 @@
61
63
  color: var(--surf-ink);
62
64
  overflow-wrap: anywhere;
63
65
  }
64
- /* Stacked, and inline on a phone: each term above its value, a pair set apart from
65
- the next by its own padding rather than a row height. */
66
+ /* Stacked: each term above its value, a pair set apart from the next by its own
67
+ padding rather than a row height. On a phone inline pairs take that padding
68
+ too, but a pair stays on one row where it fits; only a value that does not
69
+ moves under its term. */
66
70
  .surf-description-list[data-layout='stacked'] .surf-description-list-item {
67
71
  min-block-size: 0;
68
72
  padding-block: var(--surf-description-list-stack-padding);
@@ -75,8 +79,10 @@
75
79
  min-block-size: 0;
76
80
  padding-block: var(--surf-description-list-stack-padding);
77
81
  }
78
- .surf-description-list .surf-description-list-term {
79
- flex-basis: 100%;
82
+ /* A value is as wide as its content: one that fits beside its term stays there,
83
+ and a longer one moves under it whole rather than breaking beside it. */
84
+ .surf-description-list .surf-description-list-value {
85
+ flex-basis: auto;
80
86
  }
81
87
  }
82
88
  .surf-description-list-value[data-empty] {
@@ -27,9 +27,10 @@
27
27
  block-size: var(--surf-space-8);
28
28
  }
29
29
  .surf-empty-title {
30
- font: var(--surf-weight-medium)
31
- var(--surf-type-section-size)/var(--surf-type-section-leading)
32
- var(--surf-font-display);
30
+ font-weight: var(--surf-weight-medium);
31
+ font-size: var(--surf-type-section-size);
32
+ line-height: var(--surf-type-section-leading);
33
+ font-family: var(--surf-font-display);
33
34
  letter-spacing: var(--surf-type-section-tracking);
34
35
  color: var(--surf-ink);
35
36
  margin: 0;
@@ -37,9 +37,10 @@
37
37
  background: transparent;
38
38
  color: var(--surf-ink);
39
39
  text-decoration: none;
40
- font: var(--surf-weight-medium)
41
- var(--surf-type-label-size)/var(--surf-type-label-leading)
42
- var(--surf-font-body);
40
+ font-weight: var(--surf-weight-medium);
41
+ font-size: var(--surf-type-label-size);
42
+ line-height: var(--surf-type-label-leading);
43
+ font-family: var(--surf-font-body);
43
44
  letter-spacing: var(--surf-type-label-tracking);
44
45
  }
45
46
  .surf-pagination .surf-pagination-control[aria-current='page'] {
@@ -20,9 +20,31 @@
20
20
  min-height: var(--surf-space-6);
21
21
  align-self: stretch;
22
22
  }
23
+ /* A dot between values on one line: a point, not a boundary, sized with the text
24
+ it sits in and with room on each side. Its comma stays in the line, clipped and
25
+ transparent, so it is read and copied with its space but never seen; a hidden
26
+ element taken out of the flow would copy as line breaks. */
27
+ .surf-separator[data-variant='dot'] {
28
+ display: inline-block;
29
+ inline-size: 0.2em;
30
+ block-size: 0.2em;
31
+ min-height: 0;
32
+ margin-inline: var(--surf-space-2);
33
+ overflow: hidden;
34
+ align-self: center;
35
+ vertical-align: middle;
36
+ border-radius: var(--surf-radius-full);
37
+ background: var(--surf-ink-muted);
38
+ color: transparent;
39
+ line-height: 0;
40
+ white-space: pre;
41
+ }
23
42
  @media (forced-colors: active) {
24
43
  .surf-separator {
25
44
  background: CanvasText;
26
45
  }
46
+ .surf-separator[data-variant='dot'] {
47
+ forced-color-adjust: none;
48
+ }
27
49
  }
28
50
  }
@@ -7,13 +7,39 @@
7
7
  .surf-table {
8
8
  width: 100%;
9
9
  border-collapse: separate;
10
- border-spacing: 0 var(--surf-space-1);
10
+ --surf-table-row-space: var(--surf-space-1);
11
+ border-spacing: 0 var(--surf-table-row-space);
11
12
  font: inherit;
12
13
  color: var(--surf-ink-body);
13
14
  /* Columns size to whole words: break-word only splits a word that cannot fit,
14
15
  * while an inherited overflow-wrap: anywhere would squeeze columns mid-word. */
15
16
  overflow-wrap: break-word;
16
17
  }
18
+ /* Fixed columns take their width from Table.Column and the header row, so they
19
+ hold still while rows turn into skeletons or a message. */
20
+ .surf-table[data-layout='fixed'] {
21
+ table-layout: fixed;
22
+ }
23
+ /* One line per cell; Table.Truncate ends what does not fit. */
24
+ .surf-table[data-nowrap] .surf-table-cell {
25
+ white-space: nowrap;
26
+ overflow-wrap: normal;
27
+ }
28
+ /* A Container whose table steps columns aside measures its own width. Only then:
29
+ a container sized by its width no longer grows with its content. */
30
+ .surf-table-container:has(.surf-table [data-hide-below]) {
31
+ container: surf-table / inline-size;
32
+ }
33
+ @container surf-table (max-width: 40rem) {
34
+ .surf-table [data-hide-below='md'] {
35
+ display: none;
36
+ }
37
+ }
38
+ @container surf-table (max-width: 30rem) {
39
+ .surf-table [data-hide-below] {
40
+ display: none;
41
+ }
42
+ }
17
43
  .surf-table-caption {
18
44
  text-align: start;
19
45
  font-weight: var(--surf-weight-regular);
@@ -130,12 +156,14 @@
130
156
  [data-density='compact'],
131
157
  :where([data-ui-density='compact'] :not([data-density]))
132
158
  ) {
133
- border-spacing: 0 2px;
159
+ --surf-table-row-space: 2px;
160
+ border-spacing: 0 var(--surf-table-row-space);
134
161
  }
135
162
  /* Lined, grid and striped rows meet edge to edge, square, so lines and stripes
136
163
  * run unbroken. Lines stay inside the table: none above the header, below the
137
164
  * last row or at its sides. */
138
165
  .surf-table[data-variant] {
166
+ --surf-table-row-space: 0px;
139
167
  border-spacing: 0;
140
168
  }
141
169
  .surf-table[data-variant] > .surf-table-body > .surf-table-row > * {
@@ -209,7 +237,9 @@
209
237
  > .surf-table-row
210
238
  > .surf-table-cell {
211
239
  position: sticky;
212
- inset-block-start: 0;
240
+ /* A header of more rows stacks them: the Container measures where each row
241
+ sits under the ones above it. */
242
+ inset-block-start: var(--surf-table-sticky-top, 0px);
213
243
  z-index: 1;
214
244
  background: var(
215
245
  --surf-table-surface,
@@ -217,6 +247,20 @@
217
247
  );
218
248
  box-shadow: inset 0 -1px var(--surf-line);
219
249
  }
250
+ /* A lower header row covers the space between it and the row above, so nothing
251
+ that scrolls under the header shows between its rows. */
252
+ .surf-table[data-sticky-header]
253
+ > .surf-table-head
254
+ > .surf-table-row
255
+ + .surf-table-row
256
+ > .surf-table-cell::before {
257
+ content: '';
258
+ position: absolute;
259
+ inset-inline: 0;
260
+ inset-block-end: 100%;
261
+ block-size: var(--surf-table-row-space);
262
+ background: inherit;
263
+ }
220
264
  /* A sticky first column stays at the inline start while the rest scrolls under it,
221
265
  * on the surface behind the table. The fill has no specificity, so a stripe or a
222
266
  * selection still paints over it. Under a sticky header the header sits above the
@@ -252,6 +296,31 @@
252
296
  > :first-child {
253
297
  z-index: 3;
254
298
  }
299
+ /* When the first header cell spans the header's rows, the first cell of a lower
300
+ header row is a data column's: it scrolls with the rest. */
301
+ .surf-table[data-sticky-column]:has(
302
+ > .surf-table-head
303
+ > .surf-table-row:first-child
304
+ > :first-child[rowspan]:not([rowspan='1'])
305
+ )
306
+ > .surf-table-head
307
+ > .surf-table-row
308
+ + .surf-table-row
309
+ > :first-child {
310
+ inset-inline-start: auto;
311
+ z-index: 2;
312
+ }
313
+ .surf-table[data-sticky-column]:has(
314
+ > .surf-table-head
315
+ > .surf-table-row:first-child
316
+ > :first-child[rowspan]:not([rowspan='1'])
317
+ )
318
+ > .surf-table-head
319
+ > .surf-table-row
320
+ + .surf-table-row
321
+ > :first-child::after {
322
+ display: none;
323
+ }
255
324
  /* Once rows pass under the column, a line marks its edge. */
256
325
  .surf-table[data-sticky-column]
257
326
  > :is(.surf-table-head, .surf-table-body, .surf-table-foot)
@@ -274,6 +343,17 @@
274
343
  > :first-child::after {
275
344
  opacity: 1;
276
345
  }
346
+ /* Backgrounds turn to the canvas, so a sticky column's edge keeps its line in the
347
+ text color. */
348
+ @media (forced-colors: active) {
349
+ .surf-table[data-sticky-column]
350
+ > :is(.surf-table-head, .surf-table-body, .surf-table-foot)
351
+ > .surf-table-row
352
+ > :first-child::after {
353
+ background: CanvasText;
354
+ forced-color-adjust: none;
355
+ }
356
+ }
277
357
  .surf-table-truncate {
278
358
  display: inline-block;
279
359
  max-inline-size: var(--surf-table-truncate-measure, 32ch);
@@ -13,8 +13,10 @@
13
13
  padding: 0;
14
14
  list-style: none;
15
15
  color: var(--surf-ink-body);
16
- font: var(--surf-weight-regular) var(--surf-type-body-size) /
17
- var(--surf-type-body-leading) var(--surf-font-body);
16
+ font-weight: var(--surf-weight-regular);
17
+ font-size: var(--surf-type-body-size);
18
+ line-height: var(--surf-type-body-leading);
19
+ font-family: var(--surf-font-body);
18
20
  letter-spacing: var(--surf-type-body-tracking);
19
21
  }
20
22
  .surf-timeline-item {