๐Ÿ“ฆ EqualifyEverything / equalify

๐Ÿ“„ tables.scss ยท 398 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398@use "./variables.module.scss";
@use "./fonts.scss";

// mask-image itself is a "discrete" animatable property โ€” browsers just
// flip it at the transition's halfway point rather than interpolating, so
// transitioning between two mask-image values (even structurally-identical
// gradients) snaps instead of fading. Registering this custom property with
// a numeric syntax makes it a genuinely interpolatable value that a
// transition CAN animate smoothly frame-by-frame, which then carries
// through into the gradient that references it.
@property --scroll-fade-alpha {
  syntax: '<number>';
  inherits: false;
  initial-value: 1;
}

.table-container {
  border: 1px solid variables.$gray;
  border-radius: variables.$spacing;
  width: 100%;
  overflow: hidden;
  position:relative;

  .table-scroll-wrapper {
    overflow-x: auto;

    // Thin, low-key scrollbar rather than the browser's chunky default โ€”
    // but never scrollbar-width:none / a webkit display:none thumb. Hiding
    // it entirely would remove a visible, draggable affordance that mouse
    // and trackpad users rely on to discover and control horizontal
    // scrolling, which is a real accessibility regression, not a cleanup.
    // The thumb color (#6b6b6b) is chosen for โ‰ฅ3:1 contrast (WCAG 1.4.11)
    // against both the white and paper track backgrounds it appears on.
    scrollbar-width: thin;
    scrollbar-color: #6b6b6b transparent;

    &::-webkit-scrollbar {
      height: 8px;
    }
    &::-webkit-scrollbar-track {
      background: transparent;
    }
    &::-webkit-scrollbar-thumb {
      background-color: #6b6b6b;
      border-radius: 999px;
      border: 2px solid transparent;
      background-clip: padding-box;
    }
    &::-webkit-scrollbar-thumb:hover {
      background-color: variables.$black;
    }

    // Makes the region keyboard-scrollable (tabIndex/role/aria-label are
    // set where this class is used) โ€” needs its own visible focus ring
    // since it's not a native interactive element and outline-offset:-2px
    // keeps it from being clipped by .table-container's overflow:hidden.
    &:focus-visible {
      outline: 2px solid variables.$red;
      outline-offset: -2px;
    }

    // Fades the last ~15px of actual content โ€” a mask rather than a
    // painted-on overlay, so it matches whatever's really there (theme,
    // striped rows) with no colors to keep in sync, and adds no new
    // DOM/accessibility surface since nothing is actually hidden from the
    // accessibility tree, keyboard nav, or scrolling. Applied here rather
    // than on the scrolling <table> itself: mask percentages resolve
    // against the masked element's own box, and the table's box is its
    // full (often huge) content width, not the visible viewport โ€” this
    // wrapper's box is the one that actually stays put at viewport size
    // while its content scrolls inside it.
    //
    // --scroll-fade-alpha (registered above) drives the fade layer's final
    // stop: 1 = opaque = no visible fade, 0.4 = softened-but-still-legible
    // fade (not a hard cut to fully invisible).
    //
    // Two mask layers: the fade (full height) and a flat opaque rectangle
    // sized to --table-header-height (set by useScrollFade, since header
    // height isn't a constant). mask-composite: add unions them, so the
    // header's row stays fully opaque regardless of what the fade layer
    // says underneath, while everything below it keeps the fade untouched.
    // Tradeoff: this combination stops the browser from smoothly
    // interpolating --scroll-fade-alpha on toggle โ€” it falls back to a
    // discrete on/off snap despite the transition below, even though the
    // custom property itself is still animating numerically. A single-layer
    // mask (no header exclusion) doesn't have that problem; getting both
    // smooth animation AND header exclusion needs the header to not be a
    // descendant of the masked element at all (a bigger structural change).
    --scroll-fade-alpha: 1;
    --table-header-height: 0px;
    mask-image:
      linear-gradient(to right, black calc(100% - 15px), rgba(0, 0, 0, var(--scroll-fade-alpha)) 100%),
      linear-gradient(black, black);
    -webkit-mask-image:
      linear-gradient(to right, black calc(100% - 15px), rgba(0, 0, 0, var(--scroll-fade-alpha)) 100%),
      linear-gradient(black, black);
    mask-repeat: no-repeat, no-repeat;
    mask-position: 0 0, 0 0;
    mask-size: 100% 100%, 100% var(--table-header-height);
    mask-composite: add, add;
    // -webkit-mask-composite's keyword set (source-over etc.) is WebKit's
    // older, differently-modeled equivalent โ€” intentionally left
    // unspecified rather than guessed at. Without it, very old Safari just
    // falls back to a single fade layer covering the header too.
    -webkit-mask-repeat: no-repeat, no-repeat;
    -webkit-mask-position: 0 0, 0 0;
    -webkit-mask-size: 100% 100%, 100% var(--table-header-height);
    transition: --scroll-fade-alpha 200ms ease;

    @media (prefers-reduced-motion: reduce) {
      transition: none;
    }

    &.scroll-fade-active {
      --scroll-fade-alpha: 0.4;
    }
  }
  table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    display: block;
    min-height: 300px;
    @include fonts.font-size-small;
    thead {
      background-color: variables.$white;
      tr {
        th {
          @include fonts.raleway-bold;
          text-align: left;
          padding: variables.$spacing;
          border: 0;
          border-bottom: 1px solid variables.$gray;
        }
      }
    }
    tbody {
      background-color: variables.$white;
      tr {
        td {
          @include fonts.raleway-medium;
          padding: variables.$spacing;
          border-bottom: 1px solid variables.$gray;
        }
        &:nth-child(even) {
          td {
            background-color: variables.$paper;
          }
        }
      }
    }
    // inline components
    .switch {
      margin: 0.5rem; /* m-2 */
      width: 2.5rem; /* w-10 (40px) */
      height: 1.5rem; /* h-6 (24px) */
      background-color: variables.$green-light; /* bg-green-200 */
      border-radius: 9999px; /* rounded-full */
      position: relative; /* relative */
      border-width: 0px; /* border-0 */
      cursor: pointer; /* cursor-pointer */

      &[data-state="checked"] {
        background-color: variables.$gray;
      }
      .switch-thumb {
        display: block; /* block */
        width: 1rem; /* w-4 (16px) */
        height: 1rem; /* h-4 (16px) */
        background-color: variables.$white; /* bg-white */
        border-radius: 9999px; /* rounded-full */
        box-shadow:
          0 4px 6px -1px rgba(0, 0, 0, 0.1),
          0 2px 4px -2px rgba(0, 0, 0, 0.1); /* shadow-md */
        transition-duration: 300ms; /* duration-300 */

        /* data-[state=checked]:bg-gray-500 */
        &[data-state="checked"] {
          background-color: variables.$black;
        }

        /* data-[state=checked]:translate-x-3 */
        &[data-state="checked"] {
          transform: translateX(0.75rem); /* translate-x-3 (12px) */
        }
      }
    }
    select {
      @include fonts.font-size-small;
      padding: calc(variables.$spacing/2) variables.$spacing;
      margin: 0;
    }
  }
  .pagination {
    background: variables.$white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: variables.$spacing;

    @media screen and (max-width: variables.$breakpoint-small) {
      flex-direction: column;
    }
    select {
      @include fonts.font-size-small;
      padding: 0 variables.$spacing;
      margin: 0;
    }

    @include fonts.font-size-small;
    .pagination-text {
    }
    .pagination-buttons {
      display: inline-flex;
      flex-wrap: wrap;
      justify-content: center;
      align-items: stretch;
      gap: calc(variables.$spacing/2);
      .pagination-buttons-prev-next {
        display:inline-flex;
        
        gap: calc(variables.$spacing/2);
      }

      .page-size-control {
        display: flex;
        flex-direction: row;
        align-items: stretch;
        gap: calc(variables.$spacing/2);

        select {
          width: auto;
          min-width: 48px;
        }

        @media screen and (max-width: variables.$breakpoint-small) {
          flex-direction: column;
          align-items: flex-start;
        }
      }

      @media screen and (max-width: variables.$breakpoint-small) {
        align-items: flex-end;
        justify-content: space-between;
        width: 100%;

        .pagination-edge {
          display: none;
        }
      }
    }
  }
  &.skeleton {
    table,
    thead,
    tbody {
      display: table;
      width: 100%;
    }
  }
}

.tags {
  display: inline-flex;
  align-items: center;
  gap: calc(variables.$spacing/2);
  @include fonts.font-size-small;
  .tag {
    display: inline-block;
    background-color: #e5e7eb;
    border-radius: variables.$spacing;
    padding: calc(variables.$spacing/2) variables.$spacing;
  }
}

// Filters
.filter-group {
  display: inline-flex;
  justify-content: space-between;
  align-content: flex-end;
  align-items: flex-end;
  width: 100%;
  padding-top:1rem;

  .filter-group-right {
    display: inline-flex;
    justify-content: space-between;
    align-content: flex-end;
  }

  .filter-group-right .labeled-input:last-child {
      margin-right:0;
  } 
  
  @media screen and (max-width: variables.$breakpoint-small) {
    display: block;
  }
  .status-toggle-group {
    margin-left: variables.$spacing;
    button {
      background: transparent;
      border: 0;
      padding: variables.$spacing;
      cursor: pointer;
      &[aria-checked="true"] {
        @include fonts.raleway-bold;
        border-bottom: calc(variables.$spacing/2) solid variables.$red;
      }
    }
  }
  .content-toggle-group {
    margin-bottom: calc(variables.$spacing);
    .root {
      padding: calc(variables.$spacing/4) calc(variables.$spacing/2);
      background-color: variables.$paper;
      border-radius: 999px;
      width: auto;
      display: inline-block;

      button {
        cursor: pointer;
        border: 0;
        background: transparent;
        border-radius: 999px;
        padding: calc(variables.$spacing/4) variables.$spacing;
        &[aria-checked="true"] {
          background: variables.$black;
          color: variables.$white;
        }
      }
    }
  }
  .react-select,
  select {
    margin-bottom: calc(variables.$spacing);
    min-width: 180px;
  }
  .clear-button {
    margin-bottom: calc(variables.$spacing);
    border: 0;
    background: transparent;
    opacity: 0.2;
    cursor: pointer;
    &:hover {
      opacity: 1;
    }
  }
}

// The rest of the filters (status/duplicates/content type/tags/rules), kept
// in their own row below .filter-group's search box. A left-aligned wrapping
// row reads better here than .filter-group's space-between stretch, which
// was designed to spread several varied-width controls across the full row
// โ€” now that .filter-group holds just the lone search box, that stretch no
// longer does anything there, but this new row still has several controls
// to lay out sensibly.
.filter-group-secondary {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: variables.$spacing;
  width: 100%;
  margin-top: variables.$spacing;

  @media screen and (max-width: variables.$breakpoint-small) {
    display: block;
  }
  .react-select,
  select {
    margin-bottom: calc(variables.$spacing);
    min-width: 180px;
  }
  .clear-button {
    margin-bottom: calc(variables.$spacing);
    border: 0;
    background: transparent;
    opacity: 0.2;
    cursor: pointer;
    &:hover {
      opacity: 1;
    }
  }
}

// tables in cards
.card {
  &.dark {
    table {
      color: variables.$black;
      table {
        thead {
        }
      }
    }
  }
}