@stackoverflow/stacks 1.3.0 → 1.3.3

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.
Files changed (39) hide show
  1. package/dist/controllers/s-expandable-control.d.ts +1 -1
  2. package/dist/controllers/s-tooltip.d.ts +16 -1
  3. package/dist/css/stacks.css +848 -559
  4. package/dist/css/stacks.min.css +1 -1
  5. package/dist/js/stacks.js +153 -84
  6. package/dist/js/stacks.min.js +1 -1
  7. package/lib/css/atomic/borders.less +1 -0
  8. package/lib/css/atomic/colors.less +1 -0
  9. package/lib/css/atomic/misc.less +1 -1
  10. package/lib/css/atomic/typography.less +0 -6
  11. package/lib/css/components/activity-indicator.less +18 -17
  12. package/lib/css/components/avatars.less +50 -131
  13. package/lib/css/components/breadcrumbs.less +4 -4
  14. package/lib/css/components/buttons.less +8 -48
  15. package/lib/css/components/empty-states.less +15 -0
  16. package/lib/css/components/{collapsible.less → expandable.less} +0 -0
  17. package/lib/css/components/inputs.less +37 -101
  18. package/lib/css/components/labels.less +98 -0
  19. package/lib/css/components/links.less +15 -3
  20. package/lib/css/components/notices.less +190 -163
  21. package/lib/css/components/post-summary.less +98 -35
  22. package/lib/css/components/progress-bars.less +1 -1
  23. package/lib/css/components/prose.less +4 -4
  24. package/lib/css/components/spinner.less +39 -1
  25. package/lib/css/components/tables.less +1 -5
  26. package/lib/css/components/uploader.less +70 -84
  27. package/lib/css/exports/constants-colors.less +19 -0
  28. package/lib/css/stacks-dynamic.less +0 -1
  29. package/lib/css/stacks-static.less +3 -2
  30. package/lib/ts/controllers/s-expandable-control.ts +23 -19
  31. package/lib/ts/controllers/s-modal.ts +16 -16
  32. package/lib/ts/controllers/s-navigation-tablist.ts +13 -13
  33. package/lib/ts/controllers/s-popover.ts +26 -18
  34. package/lib/ts/controllers/s-table.ts +31 -29
  35. package/lib/ts/controllers/s-tooltip.ts +62 -23
  36. package/lib/ts/stacks.ts +8 -4
  37. package/package.json +17 -17
  38. package/lib/css/components/banners.less +0 -80
  39. package/lib/css/components/blank-states.less +0 -26
@@ -100,17 +100,13 @@
100
100
  }
101
101
 
102
102
  &.has-answers {
103
- color: var(--green-600);
104
- border: 1px solid var(--green-600);
103
+ color: var(--green-700);
104
+ border: 1px solid var(--green-700);
105
105
 
106
106
  &.has-accepted-answer {
107
- color: @white;
108
- background-color: var(--green-500);
109
- border-color: var(--green-500);
110
-
111
- .highcontrast-mode({
112
- color: var(--white);
113
- });
107
+ color: var(--white);
108
+ background-color: var(--green-700);
109
+ border-color: var(--green-700);
114
110
  }
115
111
  }
116
112
 
@@ -121,15 +117,15 @@
121
117
  }
122
118
 
123
119
  &.is-warm {
124
- color: var(--orange-800);
120
+ color: var(--yellow-800);
125
121
  }
126
122
 
127
123
  &.is-hot {
128
- color: var(--orange-600);
124
+ color: var(--orange-800);
129
125
  }
130
126
 
131
127
  &.is-supernova {
132
- color: var(--orange-400);
128
+ color: var(--red-800);
133
129
  }
134
130
 
135
131
  &.is-published {
@@ -309,38 +305,91 @@
309
305
 
310
306
  .s-post-summary__watched {
311
307
  background-color: var(--yellow-050);
312
- }
313
308
 
314
- .s-post-summary__deleted {
315
- background-color: var(--red-050);
309
+ .s-post-summary--stats {
310
+ color: var(--black-500);
311
+ }
316
312
 
317
- .is-deleted {
318
- color: @white;
319
- background-color: var(--red-500);
313
+ .s-user-card {
314
+ .s-user-card--rep,
315
+ .s-user-card--time {
316
+ color: var(--black-600);
317
+ }
320
318
  }
321
319
  }
322
320
 
323
- .s-post-summary__ignored,
324
321
  .s-post-summary__deleted {
325
- .s-post-summary--content > *:not(.s-post-summary--content-menu-button):not(.s-post-summary--meta) {
326
- opacity: 0.6;
327
- }
328
- // TODO DEPRECATED remove `:not(.is-deleted)`
329
- .s-post-summary--stats-item:not(.s-badge):not(.is-deleted) {
330
- opacity: 0.6;
331
- filter: grayscale(100%);
322
+ background-color: var(--red-025);
323
+
324
+ .s-badge__filled {
325
+ color: var(--white);
326
+
327
+ .dark-mode({
328
+ background-color: var(--red-800)
329
+ });
332
330
  }
333
331
 
334
- .s-post-summary--content-title a {
335
- color: var(--black-600);
332
+ .is-deleted {
333
+ color: var(--white);
334
+ background-color: var(--red-600);
335
+ }
336
336
 
337
+ .s-post-summary--meta-tags > .s-tag {
338
+ &,
337
339
  &:hover,
338
- &:active {
340
+ &:active,
341
+ &:focus {
342
+ background-color: var(--black-075);
343
+ }
344
+
345
+ }
346
+ }
347
+
348
+ .s-post-summary__ignored {
349
+
350
+ .s-post-summary--stats {
351
+ color: var(--black-500);
352
+
353
+ .s-post-summary--stats-item {
354
+
355
+ &.has-answers {
356
+ color: var(--black-600);
357
+ border: 1px solid var(--black-075);
358
+ background-color: var(--black-075);
359
+
360
+ .has-accepted-answer {
361
+ color: var(--black-600);
362
+ background-color: var(--black-075);
363
+ border-color: var(--black-075);
364
+ }
365
+ }
366
+ }
367
+
368
+ .s-post-summary--stats-item__emphasized {
339
369
  color: var(--black-500);
340
370
  }
371
+ }
341
372
 
373
+ .s-post-summary--meta-tags > .s-tag {
374
+ &,
375
+ &:hover,
376
+ &:active,
377
+ &:focus {
378
+ background-color: var(--black-050);
379
+ }
380
+ }
381
+ }
382
+
383
+ .s-post-summary__ignored,
384
+ .s-post-summary__deleted {
385
+
386
+ .s-post-summary--content-title > a {
387
+ color: var(--black-500);
388
+
389
+ &:hover,
390
+ &:active,
342
391
  &:visited {
343
- color: var(--black-700);
392
+ color: var(--black-500);
344
393
  }
345
394
  }
346
395
 
@@ -349,12 +398,26 @@
349
398
  }
350
399
 
351
400
  .s-post-summary--meta > *:not(.s-post-summary--meta-tags) {
352
- opacity: 0.6;
353
- filter: grayscale(100%);
401
+ color: var(--black-600);
402
+ }
403
+
404
+ .s-post-summary--meta-tags > .s-tag {
405
+ &,
406
+ &:hover,
407
+ &:active,
408
+ &:focus {
409
+ color: var(--black-600);
410
+ }
354
411
  }
355
412
 
356
- .s-post-summary--meta-tags > a {
357
- opacity: 0.6;
358
- filter: grayscale(100%);
413
+ .s-user-card {
414
+ .s-user-card--link {
415
+ color: var(--black-500);
416
+ }
417
+
418
+ .s-user-card--rep,
419
+ .s-user-card--time {
420
+ color: var(--black-500);
421
+ }
359
422
  }
360
423
  }
@@ -209,7 +209,7 @@
209
209
  border-radius: 0;
210
210
  padding: var(--su12) var(--su6) 0 var(--su6);
211
211
  text-align: center;
212
- color: var(--black-300);
212
+ color: var(--black-500);
213
213
  z-index: var(--zi-base);
214
214
  }
215
215
 
@@ -18,14 +18,14 @@
18
18
  // Base styling
19
19
  font-size: 15px; // Force a font size that doesn’t change at the smallest breakpoint
20
20
  line-height: var(--s-prose-line-height);
21
- word-wrap: break-word;
21
+ overflow-wrap: break-word;
22
22
 
23
23
  p {
24
24
  margin-bottom: var(--s-prose-spacing);
25
25
  }
26
26
 
27
27
  pre {
28
- word-wrap: normal;
28
+ overflow-wrap: normal;
29
29
  }
30
30
 
31
31
  code {
@@ -54,10 +54,10 @@
54
54
  }
55
55
 
56
56
  li {
57
- word-wrap: break-word;
57
+ overflow-wrap: break-word;
58
58
 
59
59
  pre {
60
- word-wrap: normal;
60
+ overflow-wrap: normal;
61
61
  }
62
62
  }
63
63
 
@@ -96,6 +96,44 @@
96
96
  }
97
97
  }
98
98
 
99
+ .is-loading {
100
+ position: relative;
101
+ padding-left: 2.2em;
102
+
103
+ &:before {
104
+ content: "";
105
+ position: absolute;
106
+ opacity: 0.3;
107
+ left: 0.6em;
108
+ top: calc(50% - 0.6em);
109
+ width: 1.23076923em;
110
+ height: 1.23076923em;
111
+ border-width: 2px;
112
+ border-style: solid;
113
+ border-color: currentColor;
114
+ border-radius: var(--br-circle);
115
+ }
116
+
117
+ &:after {
118
+ content: "";
119
+ position: absolute;
120
+ left: 0.6em;
121
+ top: calc(50% - 0.6em);
122
+ width: 1.23076923em;
123
+ height: 1.23076923em;
124
+ border-width: 2px;
125
+ border-style: solid;
126
+ border-color: transparent;
127
+ border-left-color: currentColor;
128
+ border-radius: var(--br-circle);
129
+ animation: s-spinner-rotate 0.9s infinite
130
+ cubic-bezier(0.5, 0.1, 0.5, 0.9);
131
+ // see _stacks-spinner.less for an explanation of the following two
132
+ filter: invert(0); // (*)
133
+ transform-origin: 50% 50% 1px; // (*)
134
+ }
135
+ }
136
+
99
137
  // Keyframes
100
138
  @keyframes s-spinner-rotate {
101
139
  from {
@@ -104,4 +142,4 @@
104
142
  to {
105
143
  transform: rotate(360deg);
106
144
  }
107
- }
145
+ }
@@ -311,11 +311,7 @@
311
311
 
312
312
  th:not(.is-enabled),
313
313
  td:not(.is-enabled) {
314
- opacity: 0.3;
315
-
316
- .highcontrast-mode({
317
- opacity: 0.8;
318
- });
314
+ opacity: calc(var(--_o-disabled) * 0.6); // 0.5 * 0.6 = 0.3
319
315
  }
320
316
  }
321
317
  }
@@ -7,106 +7,91 @@
7
7
  // visit https://stackoverflow.design/
8
8
 
9
9
  .s-uploader {
10
- align-items: center;
11
- background-color: var(--black-025);
12
- border-radius: var(--br-lg);
13
- display: flex;
14
- min-height: var(--su-static128);
15
- justify-content: center;
16
- padding: var(--su8) var(--su16);
17
- position: relative;
18
- text-align: center;
19
-
20
- // Add the dashed border as an SVG background mask
21
- &:before {
22
- --s-uploader-background-image: url("data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='5' ry='5' stroke='%23000000' stroke-width='8' stroke-dasharray='7%2c 22' stroke-dashoffset='0' stroke-linecap='square'/%3e%3c/svg%3e");
23
- content: '';
24
- display: block;
25
- position: absolute;
26
- top: 0;
27
- left: 0;
28
- right: 0;
29
- bottom: 0;
30
- background-color: var(--black-150);
31
- -webkit-mask-image: var(--s-uploader-background-image);
32
- mask-image: var(--s-uploader-background-image);
33
- border-radius: var(--br-lg);
10
+ --_bg: var(--black-025);
11
+ --_bg-focus: var(--black-050);
12
+ --_bg-bc: var(--black-150);
13
+ --_focus-ring-color: var(--focus-ring);
34
14
 
35
- .highcontrast-mode({
36
- background-color: var(--black-400);
37
- });
38
- }
15
+ // Static custom properties (not redefined but repeated enough to warrant a custom property)
16
+ --_bg-b-image: url("data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='5' ry='5' stroke='%23000000' stroke-width='8' stroke-dasharray='7%2c 22' stroke-dashoffset='0' stroke-linecap='square'/%3e%3c/svg%3e");
39
17
 
40
- &.has-error {
41
- background-color: var(--red-050);
18
+ .highcontrast-mode({
19
+ --_bg-bc-hc: var(--black-400);
20
+ });
42
21
 
43
- &:before {
44
- background-color: var(--red-400);
22
+ &.is-active {
23
+ --_bg: var(--black-050);
24
+ --_bg-bc: var(--black-200);
25
+ }
45
26
 
46
- .highcontrast-mode({
47
- background-color: var(--red-400);
48
- });
49
- }
27
+ &.is-disabled {
28
+ opacity: var(--_o-disabled-static);
29
+ }
50
30
 
51
- .s-link {
52
- color: var(--red-900);
53
- }
31
+ &.has-error {
32
+ --_bg: var(--red-050);
33
+ --_bg-focus: var(--red-100);
34
+ --_bg-bc: var(--red-400);
35
+ --_bg-bc-hc-state: var(--red-400);
36
+ --_focus-ring-color: var(--focus-ring-error);
37
+ --_link-fc: var(--red-900);
54
38
  }
55
39
 
56
40
  &.has-success {
57
- background-color: var(--green-025);
58
-
59
- &:before {
60
- background-color: var(--green-400);
61
-
62
- .highcontrast-mode({
63
- background-color: var(--green-400);
64
- });
65
- }
66
-
67
- .s-link {
68
- color: var(--green-900);
69
- }
41
+ --_bg: var(--green-025);
42
+ --_bg-focus: var(--green-050);
43
+ --_bg-bc: var(--green-400);
44
+ --_bg-bc-hc-state: var(--green-400);
45
+ --_focus-ring-color: var(--focus-ring-success);
46
+ --_link-fc: var(--green-900);
70
47
  }
71
48
 
72
49
  &.has-warning {
73
- background-color: var(--yellow-050);
74
-
75
- &:before {
76
- background-color: var(--yellow-400);
77
-
78
- .highcontrast-mode({
79
- background-color: var(--yellow-400);
80
- });
81
- }
82
-
83
- .s-link {
84
- color: var(--yellow-900);
85
- }
50
+ --_bg: var(--yellow-050);
51
+ --_bg-focus: var(--yellow-100);
52
+ --_bg-bc: var(--yellow-400);
53
+ --_bg-bc-hc-state: var(--yellow-400);
54
+ --_focus-ring-color: var(--focus-ring-warning);
55
+ --_link-fc: var(--yellow-900);
86
56
  }
87
57
 
88
- &.is-active {
89
- background-color: var(--black-050);
90
-
91
- &:before {
92
- background-color: var(--black-200);
93
-
94
- .highcontrast-mode({
95
- background-color: var(--black);
96
- });
58
+ &.has-error,
59
+ &.has-success,
60
+ &.has-warning {
61
+ .s-link {
62
+ color: var(--_link-fc);
97
63
  }
98
64
  }
99
65
 
100
- &.is-disabled {
101
- opacity: 0.5;
102
- }
103
-
104
66
  // This is to for safari shadow DOM
105
67
  // see https://github.com/StackExchange/Stacks/pull/690#issuecomment-861028193
106
68
  input[type="file"]::file-selector-button {
107
69
  cursor: pointer;
108
70
  }
109
-
71
+ .s-uploader--container {
72
+ align-items: center;
73
+ background-color: var(--_bg);
74
+ border-radius: var(--br-lg);
75
+ display: flex;
76
+ flex-direction: column;
77
+ justify-content: center;
78
+ min-height: var(--su-static128);
79
+ padding: var(--su8) var(--su16);
80
+ position: relative;
81
+ text-align: center;
82
+
83
+ // Add the dashed border as an SVG background mask
84
+ &:before {
85
+ -webkit-mask-image: var(--_bg-b-image);
86
+ mask-image: var(--_bg-b-image);
87
+ background-color: var(--_bg-bc-hc-state, var(--_bg-bc-hc, var(--_bg-bc)));
88
+ content: '';
89
+ border-radius: var(--br-lg);
90
+ display: block;
91
+ position: absolute;
92
+ inset: 0;
93
+ }
94
+ }
110
95
  .s-uploader--input {
111
96
  cursor: pointer;
112
97
  height: 100%;
@@ -114,13 +99,13 @@
114
99
  opacity: 0;
115
100
  position: absolute;
116
101
  width: 100%;
102
+ z-index: var(--zi-selected);
117
103
 
118
104
  &:focus:focus-visible + .s-uploader--container {
119
- background-color: var(--black-050);
120
- box-shadow: 0 0 0 var(--su-static4) var(--focus-ring);
105
+ background-color: var(--_bg-focus);
106
+ box-shadow: 0 0 0 var(--su-static4) var(--_focus-ring-color);
121
107
  }
122
108
  }
123
-
124
109
  .s-uploader--preview {
125
110
  max-width: 100%;
126
111
  pointer-events: none;
@@ -185,8 +170,7 @@
185
170
  object-fit: cover;
186
171
  }
187
172
  &:not(img) {
188
- --s-uploader--preview-document-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' fill='%23535A60' width='18' height='18' viewBox='0 0 18 18'%3E%3Cpath d='M3 3a2 2 0 012-2h6l4 4v10a2 2 0 01-2 2H5a2 2 0 01-2-2V3zm7-1.5V6h4.5L10 1.5z'%3E%3C/path%3E%3C/svg%3E");
189
- background-image: var(--s-uploader--preview-document-icon);
173
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' fill='%23535A60' width='18' height='18' viewBox='0 0 18 18'%3E%3Cpath d='M3 3a2 2 0 012-2h6l4 4v10a2 2 0 01-2 2H5a2 2 0 01-2-2V3zm7-1.5V6h4.5L10 1.5z'%3E%3C/path%3E%3C/svg%3E");
190
174
  background-position: center;
191
175
  background-repeat: no-repeat;
192
176
  }
@@ -207,4 +191,6 @@
207
191
  top: var(--su8);
208
192
  z-index: var(--zi-active);
209
193
  }
194
+
195
+ position: relative;
210
196
  }
@@ -120,6 +120,7 @@
120
120
  @yellow-900: hsl(@yellow-h, 84%, 28%);
121
121
 
122
122
  // Red
123
+ @red-025: hsl(@red-h, 80%, 98%);
123
124
  @red-050: hsl(@red-h, 75%, 97%);
124
125
  @red-100: hsl(@red-h, 76%, 90%);
125
126
  @red-200: hsl(@red-h, 74%, 83%);
@@ -364,6 +365,7 @@
364
365
  --yellow-900: @yellow-900;
365
366
 
366
367
  // Red
368
+ --red-025: @red-025;
367
369
  --red-050: @red-050;
368
370
  --red-100: @red-100;
369
371
  --red-200: @red-200;
@@ -409,6 +411,10 @@
409
411
  --focus-ring-error: hsla(@red-h, 62%, 47%, 15%);
410
412
  --focus-ring-muted: hsla(@black-h, @black-s, 15%, 10%);
411
413
 
414
+ // Opacity
415
+ --_o-disabled: 0.5;
416
+ --_o-disabled-static: 0.5;
417
+
412
418
  // Shadows
413
419
  --bs-sm: 0 1px 2px hsla(0, 0%, 0%, 0.05), 0 1px 4px hsla(0, 0%, 0%, 0.05), 0 2px 8px hsla(0, 0%, 0%, 0.05);
414
420
  --bs-md: 0 1px 3px hsla(0, 0%, 0%, 0.06), 0 2px 6px hsla(0, 0%, 0%, 0.06), 0 3px 8px hsla(0, 0%, 0%, 0.09);
@@ -560,6 +566,7 @@
560
566
  --yellow-900: hsl(@yellow-h, 93%, 83.5%);
561
567
 
562
568
  // Red
569
+ --red-025: hsl(@red-h + 3, 10%, 24%);
563
570
  --red-050: hsl(@red-h + 3, 30%, 26.5%);
564
571
  --red-100: hsl(@red-h + 3, 35%, 33%);
565
572
  --red-200: hsl(@red-h + 3, 37%, 38.5%);
@@ -605,6 +612,10 @@
605
612
  --focus-ring-error: hsla(@red-h, 62%, 52%, 30%);
606
613
  --focus-ring-muted: hsla(@black-h, @black-s, 100%, 10%);
607
614
 
615
+ // Opacity
616
+ --_o-disabled: 0.5;
617
+ --_o-disabled-static: 0.5;
618
+
608
619
  // Shadows
609
620
  --bs-sm: 0 1px 2px hsla(0, 0%, 0%, 0.1), 0 1px 4px hsla(0, 0%, 0%, 0.1), 0 2px 8px hsla(0, 0%, 0%, 0.1);
610
621
  --bs-md: 0 1px 3px hsla(0, 0%, 0%, 0.11), 0 2px 6px hsla(0, 0%, 0%, 0.11), 0 3px 8px hsla(0, 0%, 0%, 0.14);
@@ -770,6 +781,7 @@
770
781
  --yellow-900: hsl(@yellow-h, 100%, 7%);
771
782
 
772
783
  // Red
784
+ --red-025: hsl(@red-h, 100%, 97%);
773
785
  --red-050: hsl(@red-h, 100%, 94%);
774
786
  --red-100: hsl(@red-h, 100%, 92%);
775
787
  --red-200: hsl(@red-h, 100%, 89%);
@@ -816,6 +828,9 @@
816
828
  --focus-ring-error: fade(@red-600, 90%);
817
829
  --focus-ring-muted: fade(@black-400, 95%);
818
830
 
831
+ // Opacity
832
+ --_o-disabled: 0.8;
833
+
819
834
  // Shadows
820
835
  --bs-sm: none;
821
836
  --bs-md: none;
@@ -926,6 +941,7 @@
926
941
  --yellow-900: hsl(@yellow-h, 100%, 95%);
927
942
 
928
943
  // Red
944
+ --red-025: hsl(@red-h, 100%, 7%);
929
945
  --red-050: hsl(@red-h, 100%, 9%);
930
946
  --red-100: hsl(@red-h, 100%, 12%);
931
947
  --red-200: hsl(@red-h, 100%, 17%);
@@ -972,6 +988,9 @@
972
988
  --fc-medium: var(--black-700);
973
989
  --fc-light: var(--black-500);
974
990
 
991
+ // Opacity
992
+ --_o-disabled: 0.8;
993
+
975
994
  // Shadows
976
995
  --bs-sm: none;
977
996
  --bs-md: none;
@@ -18,7 +18,6 @@
18
18
  @import "base/body.less";
19
19
 
20
20
  // -- COMPONENTS
21
- @import "components/banners.less";
22
21
  @import "components/buttons.less";
23
22
  @import "components/links.less";
24
23
  @import "components/link-previews.less";
@@ -20,13 +20,14 @@
20
20
  @import "components/activity-indicator.less";
21
21
  @import "components/avatars.less";
22
22
  @import "components/badges.less";
23
- @import "components/blank-states.less";
23
+ @import "components/empty-states.less";
24
24
  @import "components/breadcrumbs.less";
25
25
  @import "components/button-groups.less";
26
26
  @import "components/cards.less";
27
27
  @import "components/code-blocks.less";
28
- @import "components/collapsible.less";
28
+ @import "components/expandable.less";
29
29
  @import "components/inputs.less";
30
+ @import "components/labels.less";
30
31
  @import "components/menu.less";
31
32
  @import "components/modals.less";
32
33
  @import "components/navigation.less";