@stackoverflow/stacks 1.1.0 → 1.3.1

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 (40) 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 +887 -708
  4. package/dist/css/stacks.min.css +1 -1
  5. package/dist/js/stacks.js +174 -91
  6. package/dist/js/stacks.min.js +1 -1
  7. package/lib/css/atomic/misc.less +1 -1
  8. package/lib/css/atomic/typography.less +0 -6
  9. package/lib/css/atomic/width-height.less +1 -1
  10. package/lib/css/components/activity-indicator.less +18 -17
  11. package/lib/css/components/avatars.less +51 -131
  12. package/lib/css/components/badges.less +47 -0
  13. package/lib/css/components/breadcrumbs.less +4 -4
  14. package/lib/css/components/buttons.less +38 -54
  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 +44 -110
  18. package/lib/css/components/labels.less +98 -0
  19. package/lib/css/components/notices.less +190 -163
  20. package/lib/css/components/post-summary.less +34 -99
  21. package/lib/css/components/progress-bars.less +1 -1
  22. package/lib/css/components/prose.less +4 -4
  23. package/lib/css/components/spinner.less +39 -1
  24. package/lib/css/components/tables.less +1 -5
  25. package/lib/css/components/topbar.less +4 -1
  26. package/lib/css/components/uploader.less +70 -84
  27. package/lib/css/exports/constants-colors.less +63 -49
  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/controllers/s-uploader.ts +26 -12
  37. package/lib/ts/stacks.ts +8 -4
  38. package/package.json +25 -25
  39. package/lib/css/components/banners.less +0 -80
  40. package/lib/css/components/blank-states.less +0 -26
@@ -12,8 +12,6 @@
12
12
  // - Base Style (Input / Textarea)
13
13
  // - Textarea Styles
14
14
  // - Fieldset Resets
15
- // • Labels
16
- // • Label Statuses
17
15
  // • Text Styles
18
16
  // • Connected Input Fills
19
17
  // • Select Menus
@@ -45,7 +43,11 @@
45
43
  }
46
44
  }
47
45
 
48
- @basic-styling: {
46
+ // ============================================================================
47
+ // $ BASE INPUT / TEXTAREA STYLE
48
+ // ----------------------------------------------------------------------------
49
+ .s-input,
50
+ .s-textarea {
49
51
  -webkit-appearance: none; // Removes shadows we don't want in mobile Safari
50
52
  width: 100%;
51
53
  margin: 0; // A guard against Core's default margins
@@ -95,14 +97,6 @@
95
97
  @autofill();
96
98
  }
97
99
 
98
- // ============================================================================
99
- // $ BASE INPUT / TEXTAREA STYLE
100
- // ----------------------------------------------------------------------------
101
- .s-input,
102
- .s-textarea {
103
- @basic-styling();
104
- }
105
-
106
100
  .s-input.s-input__search,
107
101
  .s-input.s-input__creditcard {
108
102
  padding-left: var(--su-static32);
@@ -122,83 +116,28 @@ fieldset {
122
116
  .s-btn,
123
117
  .s-link {
124
118
  box-shadow: none !important;
125
- opacity: 0.5;
119
+ opacity: var(--_o-disabled-static);
126
120
  pointer-events: none;
127
121
  }
128
122
 
129
123
  .s-checkbox,
130
124
  .s-input-message,
131
- .s-label,
132
125
  .s-radio,
133
126
  .s-toggle-switch,
134
127
  .s-toggle-switch label {
135
128
  cursor: not-allowed;
136
- opacity: 0.5;
129
+ opacity: var(--_o-disabled-static);
137
130
  }
138
131
 
139
132
  .s-input,
140
133
  .s-textarea,
141
134
  .s-select > select {
142
135
  cursor: not-allowed;
143
- opacity: 0.5;
136
+ opacity: var(--_o-disabled-static);
144
137
  }
145
138
  }
146
139
  }
147
140
 
148
- // ============================================================================
149
- // $ LABELS
150
- // ============================================================================
151
- .s-label {
152
- padding: 0 var(--su2); // Helps the label visually line up with inputs
153
- color: var(--fc-dark);
154
- font-family: inherit;
155
- font-size: var(--fs-body2);
156
- font-weight: 600;
157
-
158
- &[for] {
159
- cursor: pointer;
160
- }
161
- }
162
-
163
- // $$ LABEL STATUS FLAG
164
- // ----------------------------------------------------------------------------
165
- // Is this form item required or optional? Flag the status for users.
166
- // Default styling is optional.
167
- .s-label--status {
168
- margin-left: var(--su4);
169
- padding: var(--su2) var(--su8);
170
- border-radius: 1000px;
171
- background-color: var(--black-050);
172
- color: var(--fc-medium);
173
- font-size: var(--fs-caption);
174
- font-weight: 400;
175
- vertical-align: text-bottom;
176
-
177
- .highcontrast-mode({
178
- border: 1px solid currentColor;
179
- });
180
-
181
- &.s-label--status__required {
182
- background-color: var(--red-100);
183
- color: var(--red-600);
184
-
185
- .dark-mode({
186
- color: var(--red-800);
187
- });
188
- }
189
-
190
- &.s-label--status__new {
191
- background-color: var(--green-100);
192
- color: var(--green-700);
193
- }
194
-
195
- &.s-label--status__beta {
196
- background-color: var(--blue-100);
197
- color: var(--blue-700);
198
- }
199
- }
200
-
201
-
202
141
  // ============================================================================
203
142
  // $ TEXT STYLES
204
143
  // ============================================================================
@@ -208,14 +147,6 @@ fieldset {
208
147
  font-size: var(--fs-caption);
209
148
  }
210
149
 
211
- .s-label .s-description,
212
- .s-label .s-input-message {
213
- padding: 0;
214
- margin-top: 4px;
215
- margin-bottom: 0;
216
- font-weight: normal;
217
- }
218
-
219
150
  // ============================================================================
220
151
  // $ CONNECTED INPUTS
221
152
  // To visually connect inputs together
@@ -363,7 +294,7 @@ fieldset {
363
294
 
364
295
  // Disabled
365
296
  &[disabled] {
366
- opacity: 0.5;
297
+ opacity: var(--_o-disabled-static);
367
298
  cursor: not-allowed;
368
299
  }
369
300
  }
@@ -377,10 +308,9 @@ fieldset {
377
308
  background-repeat: no-repeat;
378
309
  background-size: contain;
379
310
 
380
- &:checked {
311
+ &:checked, &:indeterminate {
381
312
  border-color: var(--theme-secondary-400) !important;
382
313
  background-color: var(--theme-secondary-400);
383
- background-image: url("data:image/svg+xml,%3Csvg width='11' height='11' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10 3.41L8.59 2 4 6.59 2.41 5 1 6.41l3 3z' fill='%23fff'/%3E%3C/svg%3E");
384
314
 
385
315
  .highcontrast-dark-mode({
386
316
  border-color: var(--blue-700) !important;
@@ -392,6 +322,13 @@ fieldset {
392
322
  }
393
323
  }
394
324
 
325
+ &:checked {
326
+ background-image: url("data:image/svg+xml,%3Csvg width='11' height='11' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10 3.41L8.59 2 4 6.59 2.41 5 1 6.41l3 3z' fill='%23fff'/%3E%3C/svg%3E");
327
+ }
328
+ &:indeterminate {
329
+ background-image: url("data:image/svg+xml,%3Csvg width='11' height='11' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 4.5 h7 v2 h-7 z' fill='%23fff'/%3E%3C/svg%3E");
330
+ }
331
+
395
332
  &:focus {
396
333
  border-color: var(--theme-secondary-300);
397
334
  box-shadow: 0 0 0 var(--su-static4) var(--focus-ring);
@@ -456,21 +393,26 @@ fieldset {
456
393
  .s-input,
457
394
  .s-textarea,
458
395
  .s-select > select {
459
- // Disabled, Read-only
460
- &[disabled],
461
- &[read-only] {
396
+ // Disabled
397
+ &[disabled] {
462
398
  cursor: not-allowed;
463
- opacity: 0.5;
464
-
465
- .highcontrast-mode({
466
- opacity: 0.5;
467
- });
399
+ opacity: var(--_o-disabled-static);
468
400
  }
469
401
 
470
- // Disabled
471
- &[disabled] {
402
+ // Readonly
403
+ // Note: The readonly attribute is not supported on select elements
404
+ // See https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly
405
+ // and https://github.com/StackExchange/Stacks/pull/1040#discussion_r931144086
406
+ &[readonly],
407
+ .is-readonly & {
408
+ border-color: var(--bc-light);
409
+ background-color: var(--black-050);
410
+ color: var(--black-200);
472
411
  cursor: not-allowed;
473
- opacity: 0.5;
412
+
413
+ .highcontrast-mode({
414
+ color: var(--fc-light);
415
+ });
474
416
  }
475
417
  }
476
418
 
@@ -479,6 +421,7 @@ fieldset {
479
421
  // Classes are applied at the wrapping container level.
480
422
  // ----------------------------------------------------------------------------
481
423
  .is-disabled,
424
+ .is-readonly,
482
425
  .has-success,
483
426
  .has-error,
484
427
  .has-warning {
@@ -606,26 +549,25 @@ fieldset {
606
549
  border-color: var(--bc-darker) transparent;
607
550
  }
608
551
 
609
- .s-label,
610
552
  .s-description {
611
- opacity: 0.5;
553
+ opacity: var(--_o-disabled-static);
554
+ }
612
555
 
613
- .s-description {
614
- opacity: unset;
615
- }
556
+ .s-input-icon {
557
+ color: var(--black-400);
616
558
  }
559
+ }
617
560
 
561
+ // $$ READONLY
562
+ // ----------------------------------------------------------------------------
563
+ .is-readonly {
618
564
  .s-input-icon {
619
565
  color: var(--black-200);
620
566
 
621
567
  .highcontrast-mode({
622
- color: var(--black-400);
568
+ color: var(--fc-light);
623
569
  });
624
570
  }
625
-
626
- .s-label {
627
- cursor: not-allowed;
628
- }
629
571
  }
630
572
 
631
573
  // $$ ICONS
@@ -641,11 +583,7 @@ fieldset {
641
583
  &.s-input-icon__creditcard {
642
584
  right: auto;
643
585
  left: 0.7em;
644
- color: var(--black-200);
645
-
646
- .highcontrast-mode({
647
- color: var(--black-400);
648
- });
586
+ color: var(--black-400);
649
587
  }
650
588
  }
651
589
 
@@ -661,25 +599,21 @@ fieldset {
661
599
  // ----------------------------------------------------------------------------
662
600
  .s-input__sm,
663
601
  .s-textarea__sm,
664
- .s-label__sm,
665
602
  .s-select__sm > select {
666
603
  font-size: var(--fs-caption);
667
604
  }
668
605
  .s-input__md,
669
606
  .s-textarea__md,
670
- .s-label__md,
671
607
  .s-select__md > select {
672
608
  font-size: var(--fs-body3);
673
609
  }
674
610
  .s-input__lg,
675
611
  .s-textarea__lg,
676
- .s-label__lg,
677
612
  .s-select__lg > select {
678
613
  font-size: var(--fs-title);
679
614
  }
680
615
  .s-input__xl,
681
616
  .s-textarea__xl,
682
- .s-label__xl,
683
617
  .s-select__xl > select {
684
618
  font-size: var(--fs-headline1);
685
619
  }
@@ -0,0 +1,98 @@
1
+ .s-label {
2
+ --_fs: var(--fs-body2);
3
+
4
+ &[for] {
5
+ cursor: pointer;
6
+ }
7
+
8
+ fieldset[disabled] &,
9
+ .is-disabled & {
10
+ cursor: not-allowed;
11
+ opacity: var(--_o-disabled-static);
12
+
13
+ .s-description {
14
+ opacity: unset;
15
+ }
16
+ }
17
+
18
+ .is-readonly & {
19
+ cursor: not-allowed;
20
+ }
21
+
22
+ .s-description,
23
+ .s-input-message {
24
+ font-weight: normal;
25
+ margin-bottom: 0;
26
+ margin-top: var(--su4);
27
+ padding: 0;
28
+ }
29
+
30
+ // Sizes
31
+ &.s-label__sm {
32
+ --_fs: var(--fs-caption);
33
+ }
34
+ &.s-label__md {
35
+ --_fs: var(--fs-body3);
36
+ }
37
+ &.s-label__lg {
38
+ --_fs: var(--fs-title);
39
+ }
40
+ &.s-label__xl {
41
+ --_fs: var(--fs-headline1);
42
+ }
43
+
44
+ color: var(--fc-dark);
45
+ font-family: inherit;
46
+ font-size: var(--_fs);
47
+ font-weight: 600;
48
+ padding: 0 var(--su2); // Helps the label visually line up with inputs
49
+ }
50
+
51
+ // $$ LABEL STATUS FLAG
52
+ // ----------------------------------------------------------------------------
53
+ // Is this form item required or optional? Flag the status for users.
54
+ // Default styling is optional.
55
+ .s-label--status {
56
+ --_b: none;
57
+ --_bg: var(--black-050);
58
+ --_fc: var(--fc-medium);
59
+
60
+ .highcontrast-mode({
61
+ --_b: var(--su-static1) solid currentColor;
62
+ });
63
+
64
+ &.s-label--status__required {
65
+ --_bg: var(--red-100);
66
+ --_fc: var(--red-700);
67
+
68
+ .dark-mode({
69
+ --_bg: var(--red-050);
70
+ --_fc: var(--red-800);
71
+ });
72
+ }
73
+
74
+ &.s-label--status__new {
75
+ --_bg: var(--green-100);
76
+ --_fc: var(--green-700);
77
+
78
+ .dark-mode({
79
+ --_bg: var(--green-050);
80
+ --_fc: var(--green-800);
81
+ });
82
+ }
83
+
84
+ &.s-label--status__beta {
85
+ --_bg: var(--blue-100);
86
+ --_fc: var(--blue-700);
87
+ }
88
+
89
+ background-color: var(--_bg);
90
+ border: var(--_b);
91
+ border-radius: 1000px;
92
+ color: var(--_fc);
93
+ font-size: var(--fs-caption);
94
+ font-weight: 400;
95
+ margin-left: var(--su4);
96
+ padding: var(--su2) var(--su8);
97
+ vertical-align: text-bottom;
98
+ }