@stackoverflow/stacks 1.3.6 → 1.4.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,10 +1,10 @@
1
1
  .s-label {
2
- --_fs: var(--fs-body2);
2
+ --_la-fs: var(--fs-body2);
3
3
 
4
+ // CONTEXTUAL STYLES
4
5
  &[for] {
5
6
  cursor: pointer;
6
7
  }
7
-
8
8
  fieldset[disabled] &,
9
9
  .is-disabled & {
10
10
  cursor: not-allowed;
@@ -14,85 +14,85 @@
14
14
  opacity: unset;
15
15
  }
16
16
  }
17
-
18
17
  .is-readonly & {
19
18
  cursor: not-allowed;
20
19
  }
21
20
 
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
-
21
+ // VARIANTS
30
22
  // Sizes
31
- &.s-label__sm {
32
- --_fs: var(--fs-caption);
23
+ &&__sm {
24
+ --_la-fs: var(--fs-caption);
33
25
  }
34
- &.s-label__md {
35
- --_fs: var(--fs-body3);
26
+ &&__md {
27
+ --_la-fs: var(--fs-body3);
36
28
  }
37
- &.s-label__lg {
38
- --_fs: var(--fs-title);
29
+ &&__lg {
30
+ --_la-fs: var(--fs-title);
39
31
  }
40
- &.s-label__xl {
41
- --_fs: var(--fs-headline1);
32
+ &&__xl {
33
+ --_la-fs: var(--fs-headline1);
42
34
  }
43
35
 
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
- }
36
+ // CHILD ELEMENTS
37
+ // Label status flag
38
+ // Is this form item required or optional? Flag the status for users.
39
+ // Default styling is optional.
40
+ & &--status {
41
+ --_la-status-b: none;
42
+ --_la-status-bg: var(--black-050);
43
+ --_la-status-fc: var(--fc-medium);
50
44
 
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);
45
+ .highcontrast-mode({
46
+ --_la-status-b: var(--su-static1) solid currentColor;
47
+ });
59
48
 
60
- .highcontrast-mode({
61
- --_b: var(--su-static1) solid currentColor;
62
- });
49
+ // TODO: include child component class (without variant) on selector
50
+ &__beta {
51
+ --_la-status-bg: var(--blue-100);
52
+ --_la-status-fc: var(--blue-700);
53
+ }
54
+ &__new {
55
+ --_la-status-bg: var(--green-100);
56
+ --_la-status-fc: var(--green-700);
57
+
58
+ .dark-mode({
59
+ --_la-status-bg: var(--green-050);
60
+ --_la-status-fc: var(--green-800);
61
+ });
62
+ }
63
+ &__required {
64
+ --_la-status-bg: var(--red-100);
65
+ --_la-status-fc: var(--red-700);
66
+
67
+ .dark-mode({
68
+ --_la-status-bg: var(--red-050);
69
+ --_la-status-fc: var(--red-800);
70
+ });
71
+ }
63
72
 
64
- &.s-label--status__required {
65
- --_bg: var(--red-100);
66
- --_fc: var(--red-700);
73
+ background-color: var(--_la-status-bg);
74
+ border: var(--_la-status-b);
75
+ color: var(--_la-status-fc);
67
76
 
68
- .dark-mode({
69
- --_bg: var(--red-050);
70
- --_fc: var(--red-800);
71
- });
77
+ border-radius: 1000px;
78
+ font-size: var(--fs-caption);
79
+ font-weight: 400;
80
+ margin-left: var(--su4);
81
+ padding: var(--su2) var(--su8);
82
+ vertical-align: text-bottom;
72
83
  }
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
- });
84
+ .s-description,
85
+ .s-input-message {
86
+ font-weight: normal;
87
+ margin-bottom: 0;
88
+ margin-top: var(--su4);
89
+ padding: 0;
82
90
  }
83
91
 
84
- &.s-label--status__beta {
85
- --_bg: var(--blue-100);
86
- --_fc: var(--blue-700);
87
- }
92
+ font-size: var(--_la-fs);
88
93
 
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
- }
94
+ color: var(--fc-dark);
95
+ font-family: inherit;
96
+ font-weight: 600;
97
+ padding: 0 var(--su2); // Helps the label visually line up with inputs
98
+ }
@@ -190,7 +190,7 @@ button.s-link {
190
190
  @focus-styles();
191
191
 
192
192
  &.is-selected {
193
- --_block-bs: inset var(--_block-bs-offset-x, 3px) 0 0 var(--theme-primary-color);
193
+ --_li-block-bs: inset var(--_li-block-bs-offset-x, 3px) 0 0 var(--theme-primary-color);
194
194
 
195
195
  color: var(--black-800);
196
196
  font-weight: bold;
@@ -201,12 +201,12 @@ button.s-link {
201
201
  });
202
202
 
203
203
  &.s-block-link__right {
204
- --_block-bs-offset-x: -3px;
204
+ --_li-block-bs-offset-x: -3px;
205
205
  }
206
206
 
207
207
  &.s-block-link__left,
208
208
  &.s-block-link__right {
209
- box-shadow: var(--_block-bs);
209
+ box-shadow: var(--_li-block-bs);
210
210
 
211
211
  &:focus:not(:focus-visible),
212
212
  &:focus-visible {
@@ -214,7 +214,7 @@ button.s-link {
214
214
  }
215
215
 
216
216
  &:focus-visible {
217
- box-shadow: var(--_block-bs), 0 0 0 var(--su-static4) var(--focus-ring-muted);
217
+ box-shadow: var(--_li-block-bs), 0 0 0 var(--su-static4) var(--focus-ring-muted);
218
218
  }
219
219
  }
220
220
  }
@@ -1,47 +1,36 @@
1
- //
2
- // STACK OVERFLOW
3
- // MENU
4
- //
5
- // This CSS comes from Stacks, our CSS & Pattern library for rapidly building
6
- // Stack Overflow. For documentation of all these classes and how to contribute,
7
- // visit https://stackoverflow.design/
8
- //
9
-
10
1
  .s-menu {
11
- .list-reset;
2
+ --_me-divider-bg: var(--bc-light);
3
+ --_me-label-btc: var(--bc-light);
4
+ --_me-label-cursor: pointer;
5
+
6
+ .dark-mode({
7
+ --_me-divider-bg: var(--bc-lightest);
8
+ --_me-label-btc: var(--bc-lightest);
9
+ });
10
+
11
+ & &--divider {
12
+ background-color: var(--_me-divider-bg);
13
+ height: var(--su-static1);
14
+ margin: var(--su8) 0;
15
+ }
16
+ & &--label {
17
+ &.is-disabled {
18
+ --_me-label-cursor: not-allowed;
19
+ }
12
20
 
13
- .s-menu--title {
21
+ cursor: var(--_me-label-cursor);
22
+ border-top: 1px solid var(--_me-label-btc);
23
+ padding: var(--su12);
24
+ }
25
+ & &--title {
26
+ color: var(--black-600);
27
+ font-size: var(--fs-fine);
14
28
  padding: var(--su8) var(--su12);
15
29
  text-transform: uppercase;
16
- font-size: var(--fs-fine);
17
- color: var(--black-600);
18
30
  }
19
-
20
- li + .s-menu--title {
31
+ & li + &--title {
21
32
  margin-top: var(--su12);
22
33
  }
23
34
 
24
- .s-menu--divider {
25
- margin: var(--su8) 0;
26
- height: 1px;
27
- background-color: var(--bc-light);
28
-
29
- .dark-mode({
30
- background-color: var(--bc-lightest);
31
- });
32
- }
33
-
34
- .s-menu--label {
35
- cursor: pointer;
36
- padding: var(--su12);
37
- border-top: 1px solid var(--bc-light);
38
-
39
- .dark-mode({
40
- border-top-color: var(--bc-lightest);
41
- });
42
-
43
- &.is-disabled {
44
- cursor: not-allowed;
45
- }
46
- }
35
+ .list-reset;
47
36
  }
@@ -1,146 +1,143 @@
1
- //
2
- // STACK OVERFLOW
3
- // NAVIGATION
4
- //
5
- // This CSS comes from Stacks, our CSS & Pattern library for rapidly building
6
- // Stack Overflow. For documentation of all these classes and how to contribute,
7
- // visit https://stackoverflow.design/
8
- //
9
- // TABLE OF CONTENTS
10
- // • BASE STYLE
11
- // • MUTED STYLE
12
- //
13
- // ============================================================================
14
- // $ BASE STYLE
15
- // ----------------------------------------------------------------------------
16
1
  .s-navigation {
17
- display: flex;
18
- margin: calc(var(--su2) * -1);
19
- padding: var(--su2) 0;
20
- flex-wrap: wrap;
21
-
22
- // If the s-navigation is a list, let's reset all the properties
23
- list-style: none;
24
-
25
- .s-navigation--item {
26
- display: flex;
27
- align-items: center;
28
- padding: var(--su6) var(--su12);
29
- position: relative;
30
-
31
- // Reset some things for when the navigation item is also a button
32
- border: none;
33
- font: unset;
34
- background: none;
35
- box-shadow: none;
36
- cursor: pointer;
37
- user-select: auto;
38
- border-radius: 1000px;
39
- margin: var(--su2);
40
- white-space: nowrap;
41
- color: var(--black-600);
42
-
43
- &:hover,
44
- &:active {
45
- background: var(--black-075);
46
- color: var(--black-600);
2
+ --_na-fd: row;
3
+ --_na-fw: wrap;
4
+ --_na-p: var(--su2) 0;
5
+ --_na-gap: var(--su4);
6
+
7
+ // MODIFIERS
8
+ &&__scroll {
9
+ --_na-fw: nowrap;
10
+ overflow-x: auto;
11
+ @scrollbar-styles();
12
+ }
13
+ // Sizes
14
+ &&__sm {
15
+ .s-navigation--item {
16
+ --_na-item-fs: var(--fs-caption);
17
+ --_na-item-p: var(--su4) var(--su12);
18
+ }
19
+ }
20
+ // Orientation
21
+ &&__vertical {
22
+ --_na-fd: column;
23
+ --_na-gap: 0;
24
+ --_na-p: 0;
47
25
 
48
- .highcontrast-mode({
49
- background: var(--black-600);
50
- color: var(--black-100);
51
- });
26
+ .s-navigation--item {
27
+ --_na-item-ws: normal;
52
28
  }
29
+ }
53
30
 
54
- @focus-styles();
31
+ // VARIANTS
32
+ &&__muted {
33
+ .s-navigation--item {
34
+ &.is-selected {
35
+ --_na-item-bg: var(--black-050);
36
+ --_na-item-fc: var(--black-800);
37
+ --_na-item-bg-hover: var(--_na-item-bg);
38
+ --_na-item-fc-hover: var(--_na-item-fc);
39
+
40
+ .highcontrast-mode({
41
+ --_na-item-bg: var(--black-800);
42
+ --_na-item-fc: var(--black-050);
43
+ });
44
+ }
45
+ }
46
+ }
55
47
 
48
+ // CHILD ELEMENTS
49
+ & &--item {
50
+ --_na-item-bg: none;
51
+ --_na-item-fc: var(--black-600);
52
+ --_na-item-fs: unset;
53
+ --_na-item-p: var(--su6) var(--su12);
54
+ --_na-item-py: var(--su12);
55
+ --_na-item-ws: nowrap;
56
+ // hover
57
+ --_na-item-bg-hover: var(--black-075);
58
+ --_na-item-fc-hover: var(--_na-item-fc);
59
+
60
+ .highcontrast-mode({
61
+ --_na-item-bg-hover: var(--black-600);
62
+ --_na-item-fc-hover: var(--black-100);
63
+ });
64
+
65
+ // STATES
66
+ // Selected
56
67
  &.is-selected {
57
- background: var(--theme-primary-color);
58
- color: var(--white);
59
-
60
- &:hover,
61
- &:active {
62
- background: var(--theme-primary-600);
63
- color: var(--white);
64
- }
68
+ --_na-item-bg: var(--theme-primary-color);
69
+ --_na-item-fc: var(--white);
70
+ --_na-item-bg-hover: var(--theme-primary-600);
65
71
 
66
- .highcontrast-mode({ text-decoration: none; });
72
+ .highcontrast-mode({
73
+ text-decoration: none;
74
+ });
67
75
  }
68
76
 
69
- &.s-navigation--item__dropdown {
70
- padding-right: 2em;
71
-
77
+ // MODIFIERS
78
+ // TODO: include child component class (without variant) on selector
79
+ &__dropdown {
72
80
  &:after {
73
- content: "";
74
- position: absolute;
75
- z-index: var(--zi-active);
76
- top: calc(50% - 2px);
77
- right: 0.9em;
78
81
  border-style: solid;
79
- border-width: var(--su-static4);
80
- border-top-width: var(--su-static4);
81
- border-bottom-width: 0;
82
+ border-width: var(--su-static4) var(--su-static4) 0 var(--su-static4);
82
83
  border-color: currentColor transparent;
84
+ content: "";
83
85
  pointer-events: none;
86
+ position: absolute;
87
+ right: 0.9em;
88
+ top: calc(50% - 2px);
89
+ z-index: var(--zi-active);
84
90
  }
91
+
92
+ padding-right: 2em;
85
93
  }
86
- }
87
94
 
88
- &.s-navigation__scroll {
89
- overflow-x: auto;
90
- flex-wrap: nowrap;
95
+ // Interaction states
96
+ &:hover,
97
+ &:active {
98
+ background-color: var(--_na-item-bg-hover);
99
+ color: var(--_na-item-fc-hover);
100
+ }
91
101
 
92
- @scrollbar-styles();
93
- }
102
+ @focus-styles();
94
103
 
95
- &.s-navigation__vertical {
96
- flex-direction: column;
97
- padding: 0;
98
- margin: 0;
104
+ background-color: var(--_na-item-bg);
105
+ color: var(--_na-item-fc);
106
+ font: unset; // Needs to come before font-size for cascade
107
+ font-size: var(--_na-item-fs);
108
+ padding: var(--_na-item-p);
109
+ white-space: var(--_na-item-ws);
99
110
 
100
- .s-navigation--item {
101
- margin: 0;
102
- white-space: normal;
103
- }
111
+ align-items: center;
112
+ border: none; // Reset some things for when the navigation item is also a button
113
+ border-radius: 1000px;
114
+ box-shadow: none;
115
+ cursor: pointer;
116
+ display: flex;
117
+ position: relative;
118
+ user-select: auto;
104
119
  }
105
-
106
- .s-navigation--title {
107
- font-size: var(--fs-fine);
108
- font-weight: bold;
109
- margin-top: var(--su16);
110
- padding: var(--su6) var(--su12);
111
- text-transform: uppercase;
120
+ & &--title {
121
+ --_na-title-mt: var(--su16);
112
122
 
113
123
  &:first-child {
114
- margin-top: 0;
124
+ --_na-title-mt: 0;
115
125
  }
116
- }
117
126
 
118
- // ============================================================================
119
- // $ MUTED STYLE
120
- // ----------------------------------------------------------------------------
121
- &.s-navigation__muted .s-navigation--item {
122
- &.is-selected {
123
- background: var(--black-050);
124
- color: var(--black-800);
127
+ margin-top: var(--_na-title-mt);
125
128
 
126
- .highcontrast-mode({
127
- background: var(--black-800);
128
- color: var(--black-050);
129
- });
130
- }
129
+ font-size: var(--fs-fine);
130
+ font-weight: bold;
131
+ padding: var(--su6) var(--su12);
132
+ text-transform: uppercase;
131
133
  }
132
134
 
133
- // ============================================================================
134
- // $ SMALL SIZE
135
- // ----------------------------------------------------------------------------
136
- &.s-navigation__sm {
137
- .s-navigation--item {
138
- padding: var(--su4) var(--su12);
139
- font-size: var(--fs-caption);
135
+ flex-direction: var(--_na-fd);
136
+ flex-wrap: var(--_na-fw);
137
+ gap: var(--_na-gap);
138
+ padding: var(--_na-p);
140
139
 
141
- &.s-navigation--item__dropdown {
142
- padding-right: 2em;
143
- }
144
- }
145
- }
140
+ display: flex;
141
+ list-style: none; // If the s-navigation is a list, let's reset all the properties
142
+ margin: 0;
146
143
  }