@apo100l/ace-ui-kit 0.3.1 → 0.5.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.
@@ -1,3 +1,4 @@
1
+ @use '../breakpoints' as bp;
1
2
  @use '../mixins/table';
2
3
 
3
4
  // Tables (docs/PRINCIPLES.md §5): 12px grey sentence-case header with no band, rules between rows,
@@ -9,18 +10,27 @@
9
10
  // <tbody><tr><td class="ak-table__primary"><a href="…">О компании</a></td><td class="ak-num">−1</td><td class="ak-table__actions">…</td></tr></tbody>
10
11
  // </table>
11
12
  // </div>
12
- // th[aria-sort] shows the sort direction (active column only). tr[aria-selected="true"] = selected row.
13
+ // th[aria-sort] shows the sort direction (active column only); the control inside th is a <button>
14
+ // (sorted in the browser) or an <a> (?sort= on the server). tr[aria-selected="true"] = selected row.
15
+ // --page-sticky: the header sticks under the page's fixed top bar (--ak-sticky-top) while the page
16
+ // scrolls — no inner scroll box. From md up; narrower, the wrap scrolls sideways as usual. An ancestor
17
+ // with overflow other than visible (a card with overflow: hidden) stops it from sticking.
13
18
  // .ak-table--compact: 36px rows. .ak-muted / .ak-dash for secondary text and missing values.
14
19
 
15
20
  .ak-table-wrap {
21
+ // positioned, so absolutely placed bits inside (.ak-sr-only headers) stay in the scroll box instead of
22
+ // widening the page — on phones that stretched the layout viewport and the fixed top bar with it
23
+ position: relative;
16
24
  width: 100%;
17
25
  overflow-x: auto;
18
26
 
27
+ // .ak-table thead th sets `background: none` later in this file — the sticky rules need the
28
+ // extra .ak-table to win, or rows show through the stuck header
19
29
  &--sticky {
20
30
  max-height: var(--ak-table-max-height, 70vh);
21
31
  overflow-y: auto;
22
32
 
23
- thead th {
33
+ .ak-table thead th {
24
34
  position: sticky;
25
35
  top: 0;
26
36
  z-index: 1;
@@ -28,6 +38,20 @@
28
38
  box-shadow: inset 0 -1px 0 var(--ak-color-border);
29
39
  }
30
40
  }
41
+
42
+ &--page-sticky {
43
+ @include bp.up(md) {
44
+ overflow: visible;
45
+
46
+ .ak-table thead th {
47
+ position: sticky;
48
+ top: var(--ak-sticky-top, var(--ak-topbar-height));
49
+ z-index: 1;
50
+ background: var(--ak-color-surface);
51
+ box-shadow: inset 0 -1px 0 var(--ak-color-border);
52
+ }
53
+ }
54
+ }
31
55
  }
32
56
 
33
57
  .ak-table {
@@ -63,8 +87,8 @@
63
87
  background: var(--ak-color-active);
64
88
  }
65
89
 
66
- // sortable headers: a button inside the th, the glyph only on the active column
67
- th > button {
90
+ // sortable headers: a button or a link inside the th, the glyph only on the active column
91
+ th > :is(button, a) {
68
92
  display: inline-flex;
69
93
  align-items: center;
70
94
  gap: 4px;
@@ -74,6 +98,7 @@
74
98
  background: none;
75
99
  color: inherit;
76
100
  font: inherit;
101
+ text-decoration: none;
77
102
  cursor: pointer;
78
103
 
79
104
  &:hover {
@@ -85,18 +110,18 @@
85
110
  border-radius: 2px;
86
111
  }
87
112
  }
88
- th[aria-sort='ascending'] > button::after,
89
- th[aria-sort='descending'] > button::after {
113
+ th[aria-sort='ascending'] > :is(button, a)::after,
114
+ th[aria-sort='descending'] > :is(button, a)::after {
90
115
  width: 0;
91
116
  height: 0;
92
117
  border-right: 4px solid transparent;
93
118
  border-left: 4px solid transparent;
94
119
  content: '';
95
120
  }
96
- th[aria-sort='ascending'] > button::after {
121
+ th[aria-sort='ascending'] > :is(button, a)::after {
97
122
  border-bottom: 5px solid currentColor;
98
123
  }
99
- th[aria-sort='descending'] > button::after {
124
+ th[aria-sort='descending'] > :is(button, a)::after {
100
125
  border-top: 5px solid currentColor;
101
126
  }
102
127
  th[aria-sort] {
@@ -131,12 +156,20 @@
131
156
  }
132
157
  small {
133
158
  display: block;
159
+ max-width: 60ch;
134
160
  margin-top: 2px;
135
161
  color: var(--ak-color-muted);
136
162
  font-size: var(--ak-font-size-sm);
137
163
  font-weight: var(--ak-font-weight-regular);
138
164
  }
139
165
  }
166
+ // row id: narrow, grey, tabular
167
+ .ak-table__id {
168
+ width: 1%;
169
+ color: var(--ak-color-muted);
170
+ font-variant-numeric: tabular-nums;
171
+ white-space: nowrap;
172
+ }
140
173
  .ak-table__check {
141
174
  width: 40px;
142
175
  padding-right: 0 !important;
@@ -157,14 +190,48 @@
157
190
  > * + * {
158
191
  margin-left: var(--ak-space-1);
159
192
  }
160
- > form {
161
- display: inline;
193
+ > form,
194
+ > .btn-group {
195
+ display: inline-flex;
196
+ margin: 0;
197
+ vertical-align: middle;
162
198
  }
163
199
  }
164
200
 
165
201
  .ak-muted {
166
202
  color: var(--ak-color-muted);
167
203
  }
204
+ // dates, codes, short values that must not wrap; figures that line up in a column
205
+ .ak-nowrap {
206
+ white-space: nowrap;
207
+ }
208
+ .ak-tabular {
209
+ font-variant-numeric: tabular-nums;
210
+ }
211
+ // one line with an ellipsis — give it a width (a .ak-table__primary subline has max-width: 60ch)
212
+ .ak-truncate {
213
+ overflow: hidden;
214
+ text-overflow: ellipsis;
215
+ white-space: nowrap;
216
+ }
217
+ // a row of badges (tags) under a title
218
+ .ak-tags {
219
+ display: flex !important;
220
+ flex-wrap: wrap;
221
+ gap: 4px;
222
+ margin-top: 4px;
223
+
224
+ // a long tag wraps inside its badge instead of widening the title column
225
+ > .ak-badge {
226
+ height: auto;
227
+ min-height: 20px;
228
+ padding-top: 2px;
229
+ padding-bottom: 2px;
230
+ line-height: 1.3;
231
+ white-space: normal;
232
+ overflow-wrap: break-word;
233
+ }
234
+ }
168
235
  .ak-dash::before {
169
236
  color: var(--ak-color-faint);
170
237
  content: '—';
@@ -206,6 +273,50 @@
206
273
  gap: var(--ak-space-2);
207
274
  padding: var(--ak-space-3) var(--ak-space-4);
208
275
  border-top: 1px solid var(--ak-color-border);
276
+
277
+ &__end {
278
+ display: flex;
279
+ flex-wrap: wrap;
280
+ align-items: center;
281
+ gap: var(--ak-space-4);
282
+ }
283
+ }
284
+
285
+ // rows per page as links: «Показывать по 100 200 500», the current one marked
286
+ // <nav class="ak-per-page" aria-label="Строк на странице"><span>Показывать по</span>
287
+ // <span aria-current="true">100</span><a href="?per_page=200">200</a></nav>
288
+ .ak-per-page {
289
+ display: inline-flex;
290
+ align-items: center;
291
+ gap: var(--ak-space-1);
292
+ color: var(--ak-color-muted);
293
+ font-size: var(--ak-font-size-sm);
294
+
295
+ > a,
296
+ > [aria-current] {
297
+ min-width: 28px;
298
+ padding: 2px 6px;
299
+ border-radius: var(--ak-radius-control);
300
+ font-variant-numeric: tabular-nums;
301
+ text-align: center;
302
+ }
303
+ > a {
304
+ color: var(--ak-color-link);
305
+ text-decoration: none;
306
+
307
+ &:hover {
308
+ background: var(--ak-color-raised);
309
+ }
310
+ &:focus-visible {
311
+ outline: none;
312
+ box-shadow: var(--ak-focus-ring);
313
+ }
314
+ }
315
+ > [aria-current] {
316
+ background: var(--ak-color-active);
317
+ color: var(--ak-color-text);
318
+ font-weight: var(--ak-font-weight-semibold);
319
+ }
209
320
  }
210
321
 
211
322
  .ak-pagination {
@@ -77,6 +77,14 @@
77
77
  --_bg-hover: var(--ak-color-negative-bg);
78
78
  --_fg: var(--ak-color-negative);
79
79
  --_border: var(--ak-color-control);
80
+ } @else if $name == danger-quiet {
81
+ --_bg-hover: var(--ak-color-negative-bg);
82
+
83
+ &:hover,
84
+ &:focus-visible {
85
+ --_fg: var(--ak-color-negative);
86
+ --_border: var(--ak-color-negative);
87
+ }
80
88
  } @else if $name == secondary {
81
89
  --_bg: var(--ak-color-surface);
82
90
  --_bg-hover: var(--ak-color-raised);