@surflane/css 0.11.0 → 0.13.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
@@ -10,7 +10,7 @@
10
10
  justify-content: center;
11
11
  gap: 2px;
12
12
  height: var(--surf-control-height);
13
- border: 1px solid var(--surf-line);
13
+ border: 1px solid var(--surf-control-border);
14
14
  border-radius: var(--surf-radius-pill);
15
15
  background: transparent;
16
16
  color: var(--surf-ink-muted);
@@ -52,15 +52,21 @@
52
52
  }
53
53
  .surf-segment:hover,
54
54
  .surf-icon-button:hover {
55
- background: var(--surf-interaction-hover-bg);
55
+ background-image: linear-gradient(
56
+ var(--surf-interaction-hover-bg),
57
+ var(--surf-interaction-hover-bg)
58
+ );
56
59
  color: var(--surf-ink);
57
60
  }
58
61
  .surf-segment:active,
59
62
  .surf-icon-button:active {
60
- background: var(--surf-interaction-active-bg);
63
+ background-image: linear-gradient(
64
+ var(--surf-interaction-active-bg),
65
+ var(--surf-interaction-active-bg)
66
+ );
61
67
  }
62
68
  .surf-segment[aria-current='page'] {
63
- background: var(--surf-selected);
69
+ background-color: var(--surf-selected);
64
70
  color: var(--surf-ink);
65
71
  }
66
72
  .surf-segment:focus-visible,
@@ -93,10 +99,16 @@
93
99
  cursor: pointer;
94
100
  }
95
101
  .surf-theme-action:hover {
96
- background: var(--surf-interaction-hover-bg);
102
+ background-image: linear-gradient(
103
+ var(--surf-interaction-hover-bg),
104
+ var(--surf-interaction-hover-bg)
105
+ );
97
106
  }
98
107
  .surf-theme-action:active {
99
- background: var(--surf-interaction-active-bg);
108
+ background-image: linear-gradient(
109
+ var(--surf-interaction-active-bg),
110
+ var(--surf-interaction-active-bg)
111
+ );
100
112
  }
101
113
  .surf-theme-action:focus-visible {
102
114
  outline: var(--surf-focus-ring-width) solid var(--surf-interaction-focus);
@@ -110,11 +122,19 @@
110
122
  letter-spacing: var(--surf-type-caption-tracking);
111
123
  }
112
124
  .surf-control-group label:has(input:checked) .surf-segment {
113
- background: var(--surf-selected);
125
+ background-color: var(--surf-selected);
114
126
  color: var(--surf-ink);
115
127
  }
116
128
  .surf-control-group input:focus-visible + .surf-segment {
117
129
  outline: var(--surf-focus-ring-width) solid var(--surf-interaction-focus);
118
130
  outline-offset: var(--surf-focus-ring-offset);
119
131
  }
132
+ @media (forced-colors: active) {
133
+ .surf-segment[aria-current='page'],
134
+ .surf-control-group label:has(input:checked) .surf-segment {
135
+ background-color: Highlight;
136
+ color: HighlightText;
137
+ forced-color-adjust: none;
138
+ }
139
+ }
120
140
  }
@@ -70,12 +70,22 @@
70
70
  border-radius: var(--surf-radius-lg);
71
71
  background: var(--surf-surface);
72
72
  color: var(--surf-ink);
73
+ --surf-plane: var(--surf-surface);
74
+ --surf-recessed: var(--surf-canvas);
73
75
  }
74
- /* data-tone is the earlier name of data-surface. */
75
- .surf-surface:is([data-surface='canvas'], [data-tone='canvas']) {
76
+ .surf-surface[data-surface='canvas'] {
76
77
  background: var(--surf-canvas);
78
+ --surf-plane: var(--surf-canvas);
79
+ --surf-recessed: var(--surf-surface);
77
80
  border-radius: var(--surf-radius-sheet);
78
81
  }
82
+ /* Forced colors flatten every plane to Canvas, so a surface draws its edge. */
83
+ @media (forced-colors: active) {
84
+ .surf-surface {
85
+ outline: 1px solid CanvasText;
86
+ outline-offset: -1px;
87
+ }
88
+ }
79
89
  @media (max-width: 1100px) and (min-width: 761px) {
80
90
  .surf-grid:not([data-columns='1']) {
81
91
  --surf-layout-grid-columns: 2;
@@ -26,6 +26,9 @@
26
26
  .surf-page-header-description {
27
27
  max-width: var(--surf-layout-description-measure);
28
28
  }
29
+ .surf-page-header-description[data-lead] {
30
+ max-width: var(--surf-layout-reading-measure);
31
+ }
29
32
  .surf-page-header-actions {
30
33
  min-inline-size: 0;
31
34
  max-inline-size: 100%;
@@ -61,7 +61,7 @@
61
61
  line-height: var(--surf-type-caption-leading);
62
62
  letter-spacing: var(--surf-type-caption-tracking);
63
63
  }
64
- .surf-text[data-variant='table'] {
64
+ .surf-text[data-variant='compact'] {
65
65
  font-size: var(--surf-type-compact-size);
66
66
  line-height: var(--surf-type-compact-leading);
67
67
  letter-spacing: var(--surf-type-compact-tracking);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@surflane/css",
3
- "version": "0.11.0",
3
+ "version": "0.13.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.11.0"
40
+ "@surflane/design-tokens": "^0.13.0"
41
41
  },
42
42
  "publishConfig": {
43
43
  "access": "public"
@@ -17,17 +17,17 @@
17
17
  overflow: visible;
18
18
  border: 1px solid var(--surf-line);
19
19
  border-radius: var(--surf-radius-full);
20
- background: var(--surf-surface);
20
+ background: var(--surf-recessed);
21
21
  color: var(--surf-ink-body);
22
22
  font: var(--surf-weight-medium) var(--surf-type-caption-size)/1
23
23
  var(--surf-font-body);
24
24
  letter-spacing: var(--surf-type-caption-tracking);
25
25
  }
26
- .surf-avatar:is([data-size='sm'], [data-size='small']) {
26
+ .surf-avatar[data-size='small'] {
27
27
  --surf-avatar-size: var(--surf-size-avatar-small);
28
28
  font-size: var(--surf-type-caption-size);
29
29
  }
30
- .surf-avatar:is([data-size='lg'], [data-size='large']) {
30
+ .surf-avatar[data-size='large'] {
31
31
  --surf-avatar-size: var(--surf-size-avatar-large);
32
32
  font-size: var(--surf-size-font-large);
33
33
  }
@@ -10,7 +10,7 @@
10
10
  align-items: center;
11
11
  gap: var(--surf-status-badge-gap);
12
12
  max-width: 100%;
13
- padding: 4px 9px;
13
+ padding: var(--surf-space-1) var(--surf-space-2);
14
14
  border: 0;
15
15
  border-radius: var(--surf-radius-pill);
16
16
  background: var(--surf-badge-neutral-bg);
@@ -12,9 +12,21 @@
12
12
  border-radius: var(--surf-radius-lg);
13
13
  background: var(--surf-surface);
14
14
  color: var(--surf-ink-body);
15
+ /* On the card, the canvas is the recessed step: tracks and read-only values show. */
16
+ --surf-plane: var(--surf-surface);
17
+ --surf-recessed: var(--surf-canvas);
15
18
  }
16
- .surf-card:is([data-surface='canvas'], [data-tone='canvas']) {
19
+ .surf-card[data-surface='canvas'] {
17
20
  background: var(--surf-canvas);
21
+ --surf-plane: var(--surf-canvas);
22
+ --surf-recessed: var(--surf-surface);
23
+ }
24
+ /* Forced colors flatten every plane to Canvas, so a card draws its edge. */
25
+ @media (forced-colors: active) {
26
+ .surf-card {
27
+ outline: 1px solid CanvasText;
28
+ outline-offset: -1px;
29
+ }
18
30
  }
19
31
  .surf-card-header {
20
32
  display: grid;
@@ -56,15 +56,29 @@
56
56
  overflow-wrap: anywhere;
57
57
  }
58
58
  /* Copy results stay inside the button. */
59
- .surf-code-copy[data-copy-state='copied'] {
59
+ .surf-copy-button[data-copy-state='copied'] {
60
60
  color: var(--surf-status-success-fg);
61
61
  }
62
- .surf-code-copy[data-copy-state='failed'] {
62
+ .surf-copy-button[data-copy-state='failed'] {
63
63
  color: var(--surf-status-danger-fg);
64
64
  }
65
+ /* Every label sits in one cell: the longest sets the width, the current shows. */
66
+ /* The label sits beside the icon; the room a longer result needs trails it. */
67
+ .surf-copy-text {
68
+ display: inline-grid;
69
+ text-align: start;
70
+ }
71
+ .surf-copy-text > * {
72
+ grid-area: 1 / 1;
73
+ }
74
+ .surf-copy-room {
75
+ visibility: hidden;
76
+ }
77
+ .surf-copy-room::before {
78
+ content: attr(data-label);
79
+ }
65
80
  /* The result fades in where the action was, and the action fades back. */
66
- .surf-code-copy[data-copy-used]
67
- :is(.surf-code-copy-icon, .surf-code-copy-label) {
81
+ .surf-copy-button[data-copy-used] :is(.surf-copy-icon, .surf-copy-label) {
68
82
  animation: surf-copy-fade var(--surf-duration-base) var(--surf-ease-out);
69
83
  }
70
84
  @keyframes surf-copy-fade {
@@ -73,8 +87,7 @@
73
87
  }
74
88
  }
75
89
  @media (prefers-reduced-motion: reduce) {
76
- .surf-code-copy[data-copy-used]
77
- :is(.surf-code-copy-icon, .surf-code-copy-label) {
90
+ .surf-copy-button[data-copy-used] :is(.surf-copy-icon, .surf-copy-label) {
78
91
  animation: none;
79
92
  }
80
93
  }
@@ -21,6 +21,11 @@
21
21
  color: var(--surf-ink-muted);
22
22
  margin-bottom: var(--surf-space-3);
23
23
  }
24
+ /* The one larger glyph: it marks what the empty area is about. */
25
+ .surf-empty-icon > svg {
26
+ inline-size: var(--surf-space-8);
27
+ block-size: var(--surf-space-8);
28
+ }
24
29
  .surf-empty-title {
25
30
  font: var(--surf-weight-medium)
26
31
  var(--surf-type-section-size)/var(--surf-type-section-leading)
@@ -19,11 +19,16 @@
19
19
  border-radius: var(--surf-radius-md);
20
20
  min-width: 0;
21
21
  }
22
- .surf-list-item:is(:hover, :focus-within) {
23
- background: var(--surf-interaction-hover-bg);
22
+ /* Hover is a layer over the item's own fill, a selected one too. Keyboard focus
23
+ shows on the control that holds it, not as a hover. */
24
+ .surf-list-item:hover {
25
+ background-image: linear-gradient(
26
+ var(--surf-interaction-hover-bg),
27
+ var(--surf-interaction-hover-bg)
28
+ );
24
29
  }
25
30
  .surf-list-item[data-selected] {
26
- background: var(--surf-selected);
31
+ background-color: var(--surf-selected);
27
32
  }
28
33
  .surf-list-content {
29
34
  flex: 1;
@@ -48,14 +48,20 @@
48
48
  }
49
49
  /* Only a control that can act shows hover and pressed layers. */
50
50
  .surf-pagination-control:is(a, button):where([href], :enabled):hover {
51
- background: var(--surf-interaction-hover-bg);
51
+ background-image: linear-gradient(
52
+ var(--surf-interaction-hover-bg),
53
+ var(--surf-interaction-hover-bg)
54
+ );
52
55
  }
53
56
  /* Pressed layers show touch feedback in the control's shape instead. */
54
57
  .surf-pagination-control:is(a, button) {
55
58
  -webkit-tap-highlight-color: transparent;
56
59
  }
57
60
  .surf-pagination-control:is(a, button):where([href], :enabled):active {
58
- background: var(--surf-interaction-active-bg);
61
+ background-image: linear-gradient(
62
+ var(--surf-interaction-active-bg),
63
+ var(--surf-interaction-active-bg)
64
+ );
59
65
  }
60
66
  .surf-pagination-control[aria-disabled='true'] {
61
67
  opacity: var(--surf-control-disabled-opacity);
@@ -76,7 +82,9 @@
76
82
  }
77
83
  @media (forced-colors: active) {
78
84
  .surf-pagination .surf-pagination-control[aria-current='page'] {
79
- border-color: CanvasText;
85
+ background-color: Highlight;
86
+ color: HighlightText;
87
+ forced-color-adjust: none;
80
88
  }
81
89
  }
82
90
  .surf-pagination-summary {
@@ -44,12 +44,17 @@
44
44
  > .surf-table-body
45
45
  > .surf-table-row:nth-child(even)
46
46
  > * {
47
- background: var(--surf-surface);
47
+ background-color: var(--surf-recessed);
48
48
  }
49
- .surf-table-body > .surf-table-row:is(:hover, :focus-within) > * {
50
- background: var(--surf-interaction-hover-bg);
49
+ /* Hover is a layer over the row's own fill, a stripe or a selection. Keyboard focus
50
+ * shows on the control that holds it, not as a hover. */
51
+ .surf-table-body > .surf-table-row:hover > * {
52
+ background-image: linear-gradient(
53
+ var(--surf-interaction-hover-bg),
54
+ var(--surf-interaction-hover-bg)
55
+ );
51
56
  }
52
- /* A selected row takes the selected tone and a faint edge in the focus color, so it
57
+ /* A selected row takes the selected tone and an edge in the focus color, so it
53
58
  * reads as held. Each cell draws its share of the edge; inset shadows follow a
54
59
  * rounded row's corners. */
55
60
  .surf-table-body > .surf-table-row[data-selected] > * {
@@ -57,7 +62,7 @@
57
62
  --surf-table-edge-end: 0px;
58
63
  --surf-table-edge-top: 1px;
59
64
  --surf-table-edge-bottom: 1px;
60
- background: var(--surf-selected);
65
+ background-color: var(--surf-selected);
61
66
  box-shadow:
62
67
  inset 0 var(--surf-table-edge-top) var(--surf-selected-edge),
63
68
  inset 0 calc(-1 * var(--surf-table-edge-bottom)) var(--surf-selected-edge),
@@ -120,7 +125,11 @@
120
125
  }
121
126
  /* Compact density: 4px row padding and 2px between rows, for scanning many
122
127
  * records with a pointer. It overrides the component size's cell padding. */
123
- .surf-table[data-density='compact'] {
128
+ /* A table in a compact density scope is compact unless it says density='default'. */
129
+ .surf-table:is(
130
+ [data-density='compact'],
131
+ :where([data-ui-density='compact'] :not([data-density]))
132
+ ) {
124
133
  border-spacing: 0 2px;
125
134
  }
126
135
  /* Lined, grid and striped rows meet edge to edge, square, so lines and stripes
@@ -184,11 +193,17 @@
184
193
  :where([data-ui-size], [data-ui-size] *).surf-scroll-root.surf-table-bleed {
185
194
  --surf-table-bleed: var(--surf-ui-table-padding-x);
186
195
  }
187
- .surf-scroll-root.surf-table-bleed:has(.surf-table[data-density='compact']) {
196
+ .surf-scroll-root.surf-table-bleed:has(
197
+ .surf-table:is(
198
+ [data-density='compact'],
199
+ :where([data-ui-density='compact'] :not([data-density]))
200
+ )
201
+ ) {
188
202
  --surf-table-bleed: var(--surf-space-3);
189
203
  }
190
204
  /* A sticky header needs a Container with a bounded block size that scrolls
191
- * vertically. --table-surface matches the surface behind the table. */
205
+ * vertically. --surf-table-surface matches the surface behind the table; --table-surface
206
+ * is its earlier, deprecated name. */
192
207
  .surf-table[data-sticky-header]
193
208
  > .surf-table-head
194
209
  > .surf-table-row
@@ -196,32 +211,42 @@
196
211
  position: sticky;
197
212
  inset-block-start: 0;
198
213
  z-index: 1;
199
- background: var(--table-surface, var(--surf-canvas));
214
+ background: var(
215
+ --surf-table-surface,
216
+ var(--table-surface, var(--surf-plane))
217
+ );
200
218
  box-shadow: inset 0 -1px var(--surf-line);
201
219
  }
202
220
  .surf-table-truncate {
203
221
  display: inline-block;
204
- max-inline-size: 32ch;
222
+ max-inline-size: var(--surf-table-truncate-measure, 32ch);
205
223
  overflow: hidden;
206
224
  text-overflow: ellipsis;
207
225
  white-space: nowrap;
208
226
  vertical-align: bottom;
209
227
  }
210
228
  /* Loading, empty, error and permission messages span every column. */
211
- .surf-table-body > .surf-table-message-row:is(:hover, :focus-within) > * {
212
- background: none;
229
+ .surf-table-body > .surf-table-message-row:hover > * {
230
+ background-image: none;
213
231
  }
214
232
  }
215
233
  @layer surflane.sizes {
216
234
  /* Extra-small and icon buttons keep their own inset. */
217
- .surf-table-header
218
- > .surf-button:where(:not([data-size='xs'], [data-size^='icon'])) {
235
+ .surf-table-header > .surf-button:where(:not([data-size^='icon'])) {
219
236
  padding-inline: var(--surf-space-3);
220
237
  }
221
- .surf-table[data-density='compact'] .surf-table-cell {
238
+ .surf-table:is(
239
+ [data-density='compact'],
240
+ :where([data-ui-density='compact'] :not([data-density]))
241
+ )
242
+ .surf-table-cell {
222
243
  padding: var(--surf-space-1) var(--surf-space-3);
223
244
  }
224
- .surf-table[data-density='compact'] .surf-table-sort {
245
+ .surf-table:is(
246
+ [data-density='compact'],
247
+ :where([data-ui-density='compact'] :not([data-density]))
248
+ )
249
+ .surf-table-sort {
225
250
  height: auto;
226
251
  min-height: 28px;
227
252
  }