@stackoverflow/stacks 1.8.0 → 1.9.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.
- package/README.md +161 -153
- package/dist/{controllers/s-banner.d.ts → components/banner/banner.d.ts} +1 -1
- package/dist/{controllers/s-expandable-control.d.ts → components/expandable/expandable.d.ts} +1 -1
- package/dist/{controllers/s-modal.d.ts → components/modal/modal.d.ts} +1 -1
- package/dist/{controllers/s-navigation-tablist.d.ts → components/navigation/navigation.d.ts} +1 -1
- package/dist/{controllers/s-popover.d.ts → components/popover/popover.d.ts} +1 -1
- package/dist/{controllers/s-tooltip.d.ts → components/popover/tooltip.d.ts} +1 -1
- package/dist/components/table/table.d.ts +30 -0
- package/dist/{controllers/s-toast.d.ts → components/toast/toast.d.ts} +1 -1
- package/dist/{controllers/s-uploader.d.ts → components/uploader/uploader.d.ts} +1 -1
- package/dist/controllers.d.ts +9 -0
- package/dist/css/stacks.css +2063 -1994
- package/dist/css/stacks.min.css +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/js/stacks.js +1465 -1436
- package/dist/js/stacks.min.js +1 -1
- package/lib/{css/atomic/borders.less → atomic/border.less} +397 -379
- package/lib/{css/atomic/colors.less → atomic/color.less} +210 -210
- package/lib/{css/atomic → atomic}/flex.less +426 -426
- package/lib/{css/atomic → atomic}/gap.less +44 -44
- package/lib/{css/atomic → atomic}/grid.less +139 -139
- package/lib/{css/atomic → atomic}/misc.less +343 -343
- package/lib/{css/atomic → atomic}/spacing.less +342 -342
- package/lib/{css/atomic → atomic}/typography.less +267 -267
- package/lib/{css/atomic → atomic}/width-height.less +194 -194
- package/lib/{css/base → base}/body.less +44 -44
- package/lib/{css/base → base}/configuration-static.less +61 -61
- package/lib/{css/base → base}/fieldset.less +5 -5
- package/lib/{css/base/icons.less → base/icon.less} +11 -20
- package/lib/{css/base/internals.less → base/internal.less} +220 -220
- package/lib/{css/base → base}/reset-meyer.less +64 -64
- package/lib/{css/base → base}/reset-normalize.less +449 -449
- package/lib/{css/base → base}/reset.less +20 -20
- package/lib/components/activity-indicator/activity-indicator.a11y.test.ts +21 -0
- package/lib/{css/components → components/activity-indicator}/activity-indicator.less +40 -40
- package/lib/components/activity-indicator/activity-indicator.visual.test.ts +23 -0
- package/lib/{css/components/anchors.less → components/anchor/anchor.less} +61 -61
- package/lib/components/avatar/avatar.a11y.test.ts +36 -0
- package/lib/{css/components/avatars.less → components/avatar/avatar.less} +108 -108
- package/lib/components/avatar/avatar.visual.test.ts +54 -0
- package/lib/components/award-bling/award-bling.a11y.test.ts +17 -0
- package/lib/{css/components → components/award-bling}/award-bling.less +31 -31
- package/lib/components/award-bling/award-bling.visual.test.ts +26 -0
- package/lib/{css/components/badges.less → components/badge/badge.less} +251 -251
- package/lib/components/banner/banner.a11y.test.ts +37 -0
- package/lib/components/banner/banner.less +51 -0
- package/lib/{test/s-banner.test.ts → components/banner/banner.test.ts} +73 -73
- package/lib/{ts/controllers/s-banner.ts → components/banner/banner.ts} +149 -149
- package/lib/components/banner/banner.visual.test.ts +37 -0
- package/lib/components/block-link/block-link.a11y.test.ts +68 -0
- package/lib/{css/components → components/block-link}/block-link.less +80 -80
- package/lib/components/block-link/block-link.visual.test.ts +61 -0
- package/lib/components/breadcrumbs/breadcrumbs.a11y.test.ts +37 -0
- package/lib/{css/components → components/breadcrumbs}/breadcrumbs.less +41 -41
- package/lib/components/breadcrumbs/breadcrumbs.visual.test.ts +37 -0
- package/lib/components/button/button.a11y.test.ts +32 -0
- package/lib/{css/components/buttons.less → components/button/button.less} +502 -501
- package/lib/components/button/button.visual.test.ts +52 -0
- package/lib/{css/components/button-groups.less → components/button-group/button-group.less} +83 -83
- package/lib/components/card/card.a11y.test.ts +13 -0
- package/lib/{css/components/cards.less → components/card/card.less} +29 -29
- package/lib/components/card/card.visual.test.ts +54 -0
- package/lib/components/check-control/check-control.less +17 -0
- package/lib/components/check-group/check-group.less +19 -0
- package/lib/{css/components/checkboxes-radios.less → components/checkbox_radio/checkbox_radio.less} +158 -158
- package/lib/{css/components/code-blocks.less → components/code-block/code-block.less} +116 -116
- package/lib/{css/components → components/description}/description.less +9 -9
- package/lib/{css/components/empty-states.less → components/empty-state/empty-state.less} +16 -16
- package/lib/{css/components → components/expandable}/expandable.less +118 -115
- package/lib/components/expandable/expandable.test.ts +51 -0
- package/lib/{ts/controllers/s-expandable-control.ts → components/expandable/expandable.ts} +238 -238
- package/lib/components/input-fill/input-fill.less +35 -0
- package/lib/components/input-icon/input-icon.less +45 -0
- package/lib/components/input-message/input-message.less +48 -0
- package/lib/{css/components/inputs.less → components/input_textarea/input_textarea.less} +166 -297
- package/lib/{css/components/labels.less → components/label/label.less} +111 -111
- package/lib/{css/components → components/link}/link.less +119 -119
- package/lib/{css/components/link-previews.less → components/link-preview/link-preview.less} +139 -139
- package/lib/{css/components → components/menu}/menu.less +41 -41
- package/lib/{css/components/modals.less → components/modal/modal.less} +113 -113
- package/lib/{ts/controllers/s-modal.ts → components/modal/modal.ts} +379 -379
- package/lib/{css/components → components/navigation}/navigation.less +134 -134
- package/lib/{ts/controllers/s-navigation-tablist.ts → components/navigation/navigation.ts} +128 -128
- package/lib/{css/components/notices.less → components/notice/notice.less} +203 -292
- package/lib/{css/components/page-titles.less → components/page-title/page-title.less} +51 -51
- package/lib/{css/components → components/pagination}/pagination.less +52 -52
- package/lib/{css/components/popovers.less → components/popover/popover.less} +148 -147
- package/lib/{ts/controllers/s-popover.ts → components/popover/popover.ts} +651 -651
- package/lib/{test/s-tooltip.test.ts → components/popover/tooltip.test.ts} +62 -62
- package/lib/{ts/controllers/s-tooltip.ts → components/popover/tooltip.ts} +343 -343
- package/lib/{test/s-tooltip.visual.test.ts → components/popover/tooltip.visual.test.ts} +31 -31
- package/lib/{css/components → components/post-summary}/post-summary.less +415 -415
- package/lib/{css/components/progress-bars.less → components/progress-bar/progress-bar.less} +291 -291
- package/lib/{css/components → components/prose}/prose.less +452 -452
- package/lib/{css/components → components/select}/select.less +148 -148
- package/lib/{css/components/sidebar-widgets.less → components/sidebar-widget/sidebar-widget.less} +257 -259
- package/lib/{css/components → components/spinner}/spinner.less +103 -103
- package/lib/{css/components → components/table}/table.less +307 -297
- package/lib/components/table/table.test.ts +366 -0
- package/lib/{ts/controllers/s-table.ts → components/table/table.ts} +296 -263
- package/lib/components/table-container/table-container.less +4 -0
- package/lib/{css/components/tags.less → components/tag/tag.less} +213 -213
- package/lib/components/toast/toast.less +35 -0
- package/lib/{test/s-toast.test.ts → components/toast/toast.test.ts} +63 -63
- package/lib/{ts/controllers/s-toast.ts → components/toast/toast.ts} +357 -357
- package/lib/components/toast/toast.visual.test.ts +27 -0
- package/lib/{css/components/toggle-switches.less → components/toggle-switch/toggle-switch.less} +110 -110
- package/lib/{css/components → components/topbar}/topbar.less +436 -435
- package/lib/{css/components → components/uploader}/uploader.less +195 -195
- package/lib/{ts/controllers/s-uploader.ts → components/uploader/uploader.ts} +205 -205
- package/lib/{css/components/user-cards.less → components/user-card/user-card.less} +129 -129
- package/lib/controllers.ts +33 -0
- package/lib/{css/exports → exports}/constants-colors.less +1112 -1111
- package/lib/{css/exports → exports}/constants-helpers.less +108 -108
- package/lib/{css/exports → exports}/constants-type.less +153 -153
- package/lib/{css/exports → exports}/exports.less +15 -15
- package/lib/{css/exports → exports}/mixins.less +299 -299
- package/lib/{ts/index.ts → index.ts} +32 -32
- package/lib/{css/input-utils.less → input-utils.less} +44 -44
- package/lib/{css/stacks-dynamic.less → stacks-dynamic.less} +24 -25
- package/lib/stacks-static.less +93 -0
- package/lib/{css/stacks.less → stacks.less} +13 -13
- package/lib/{ts/stacks.ts → stacks.ts} +113 -113
- package/lib/test/open-wc-testing-patch.d.ts +26 -0
- package/lib/test/test-utils.ts +466 -0
- package/lib/tsconfig.build.json +4 -0
- package/lib/tsconfig.json +16 -13
- package/package.json +106 -105
- package/dist/controllers/index.d.ts +0 -9
- package/dist/controllers/s-table.d.ts +0 -8
- package/lib/css/stacks-static.less +0 -87
- package/lib/test/s-avatar.a11y.test.ts +0 -77
- package/lib/test/s-banner.visual.test.ts +0 -61
- package/lib/test/s-btn.a11y.test.ts +0 -123
- package/lib/test/s-btn.visual.test.ts +0 -16
- package/lib/test/s-toast.visual.test.ts +0 -48
- package/lib/ts/controllers/index.ts +0 -17
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
.s-award-bling {
|
|
2
|
-
--_ab-before-bg: unset;
|
|
3
|
-
|
|
4
|
-
// VARIANTS
|
|
5
|
-
&&__gold {
|
|
6
|
-
--_ab-before-bg: var(--gold);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
&&__silver {
|
|
10
|
-
--_ab-before-bg: var(--silver);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
&&__bronze {
|
|
14
|
-
--_ab-before-bg: var(--bronze);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// CHILD ELEMENTS
|
|
18
|
-
&:before {
|
|
19
|
-
background-color: var(--_ab-before-bg);
|
|
20
|
-
|
|
21
|
-
border-radius: 100%;
|
|
22
|
-
content: "";
|
|
23
|
-
margin-right: var(--su4);
|
|
24
|
-
height: var(--su8);
|
|
25
|
-
width: var(--su8);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
align-items: center;
|
|
29
|
-
color: inherit;
|
|
30
|
-
display: flex;
|
|
31
|
-
}
|
|
1
|
+
.s-award-bling {
|
|
2
|
+
--_ab-before-bg: unset;
|
|
3
|
+
|
|
4
|
+
// VARIANTS
|
|
5
|
+
&&__gold {
|
|
6
|
+
--_ab-before-bg: var(--gold);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
&&__silver {
|
|
10
|
+
--_ab-before-bg: var(--silver);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
&&__bronze {
|
|
14
|
+
--_ab-before-bg: var(--bronze);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// CHILD ELEMENTS
|
|
18
|
+
&:before {
|
|
19
|
+
background-color: var(--_ab-before-bg);
|
|
20
|
+
|
|
21
|
+
border-radius: 100%;
|
|
22
|
+
content: "";
|
|
23
|
+
margin-right: var(--su4);
|
|
24
|
+
height: var(--su8);
|
|
25
|
+
width: var(--su8);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
align-items: center;
|
|
29
|
+
color: inherit;
|
|
30
|
+
display: flex;
|
|
31
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { defaultOptions, runComponentTests } from "../../test/test-utils";
|
|
2
|
+
import { html } from "@open-wc/testing";
|
|
3
|
+
import "../../index";
|
|
4
|
+
|
|
5
|
+
describe("anchors", () => {
|
|
6
|
+
runComponentTests({
|
|
7
|
+
type: "visual",
|
|
8
|
+
baseClass: "s-award-bling",
|
|
9
|
+
variants: ["gold", "silver", "bronze"],
|
|
10
|
+
children: {
|
|
11
|
+
default: `100 <div class="v-visible-sr">award</div>`,
|
|
12
|
+
},
|
|
13
|
+
options: {
|
|
14
|
+
...defaultOptions,
|
|
15
|
+
includeNullVariant: false,
|
|
16
|
+
},
|
|
17
|
+
template: ({ component, testid }) => html`
|
|
18
|
+
<div
|
|
19
|
+
class="d-inline-flex ai-center jc-center hs1 ws1 p8"
|
|
20
|
+
data-testid="${testid}"
|
|
21
|
+
>
|
|
22
|
+
${component}
|
|
23
|
+
</div>
|
|
24
|
+
`,
|
|
25
|
+
});
|
|
26
|
+
});
|
|
@@ -1,251 +1,251 @@
|
|
|
1
|
-
.s-badge {
|
|
2
|
-
--_ba-as: unset;
|
|
3
|
-
--_ba-bc: var(--bc-medium);
|
|
4
|
-
--_ba-bg: var(--black-050);
|
|
5
|
-
--_ba-fc: var(--black-700);
|
|
6
|
-
--_ba-fs: var(--fs-caption);
|
|
7
|
-
--_ba-g: 0.3em;
|
|
8
|
-
--_ba-lh: 2;
|
|
9
|
-
--_ba-px: var(--su6);
|
|
10
|
-
--_ba-py: 0;
|
|
11
|
-
--_ba-wmn: 0;
|
|
12
|
-
|
|
13
|
-
// CONTEXTUAL STYLES
|
|
14
|
-
.highcontrast-mode({
|
|
15
|
-
// Badge counts
|
|
16
|
-
&&__gold,
|
|
17
|
-
&&__silver,
|
|
18
|
-
&&__bronze,
|
|
19
|
-
// Number counts
|
|
20
|
-
&&__rep,
|
|
21
|
-
&&__rep-down,
|
|
22
|
-
&&__votes:not(&__answered),
|
|
23
|
-
// Users
|
|
24
|
-
&&__admin,
|
|
25
|
-
&&__moderator,
|
|
26
|
-
&&__staff {
|
|
27
|
-
--_ba-bc: currentColor;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
// MODIFIERS
|
|
32
|
-
// Sizes
|
|
33
|
-
&&__xs,
|
|
34
|
-
&&__sm {
|
|
35
|
-
--_ba-as: flex-start;
|
|
36
|
-
--_ba-fs: var(--fs-fine);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
&&__xs {
|
|
40
|
-
--_ba-lh: 1.5;
|
|
41
|
-
--_ba-px: var(--su2);
|
|
42
|
-
--_ba-wmn: calc(var(--su-static16) + var(--su-static2));
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
&&__sm {
|
|
46
|
-
--_ba-lh: 1.8;
|
|
47
|
-
--_ba-px: var(--su4);
|
|
48
|
-
--_ba-wmn: calc(var(--su-static16) + var(--su-static2));
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Badge counts
|
|
52
|
-
&&__gold,
|
|
53
|
-
&&__silver,
|
|
54
|
-
&&__bronze {
|
|
55
|
-
--_ba-fc: var(--black-700);
|
|
56
|
-
|
|
57
|
-
.highcontrast-mode({
|
|
58
|
-
--_ba-fc: var(--black-900);
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
&&__gold {
|
|
63
|
-
--_ba-bc: var(--gold-darker);
|
|
64
|
-
--_ba-bg: var(--gold-lighter);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
&&__silver {
|
|
68
|
-
--_ba-bc: var(--silver-darker);
|
|
69
|
-
--_ba-bg: var(--silver-lighter);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
&&__bronze {
|
|
73
|
-
--_ba-bc: var(--bronze-darker);
|
|
74
|
-
--_ba-bg: var(--bronze-lighter);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// Number counts
|
|
78
|
-
&&__answered,
|
|
79
|
-
&&__bounty,
|
|
80
|
-
&&__important {
|
|
81
|
-
--_ba-bc: transparent;
|
|
82
|
-
--_ba-fc: var(--white);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
&&__rep,
|
|
86
|
-
&&__rep-down,
|
|
87
|
-
&&__votes:not(&__answered) {
|
|
88
|
-
--_ba-bg: var(--white);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
&&__answered {
|
|
92
|
-
--_ba-bg: var(--green-400);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
&&__bounty {
|
|
96
|
-
--_ba-bg: var(--blue-600);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
&&__important {
|
|
100
|
-
--_ba-bg: var(--red-600);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
&&__rep {
|
|
104
|
-
--_ba-bc: var(--green-400);
|
|
105
|
-
--_ba-fc: var(--green-500);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
&&__rep-down {
|
|
109
|
-
--_ba-bc: var(--red-400);
|
|
110
|
-
--_ba-fc: var(--red-500);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
&&__votes:not(&__answered) {
|
|
114
|
-
--_ba-bc: var(--black-150);
|
|
115
|
-
--_ba-fc: var(--black-700);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// Users
|
|
119
|
-
&&__admin {
|
|
120
|
-
--_ba-bc: var(--theme-primary-200);
|
|
121
|
-
--_ba-bg: var(--theme-primary-075);
|
|
122
|
-
--_ba-fc: var(--theme-primary-800);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
&&__moderator {
|
|
126
|
-
--_ba-bc: var(--theme-secondary-200);
|
|
127
|
-
--_ba-bg: var(--theme-secondary-075);
|
|
128
|
-
--_ba-fc: var(--theme-secondary-800);
|
|
129
|
-
--_ba-g: calc(var(--su-static4) - var(--su-static1)); // 3px
|
|
130
|
-
// :before icon
|
|
131
|
-
--_ba-before-h: calc(var(--su-static16) - var(--su-static2)); // 14px
|
|
132
|
-
--_ba-before-icon: url("data:image/svg+xml,%3Csvg width='12' height='14' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5.528.746c.257-.329.675-.327.93 0l4.42 5.66c.258.329.257.864 0 1.192l-4.42 5.66c-.256.328-.674.327-.93 0l-4.42-5.66c-.257-.329-.256-.865 0-1.192l4.42-5.66z' fill='%23fff'/%3E%3C/svg%3E");
|
|
133
|
-
--_ba-before-mt: calc(var(--su-static1) * -1); // -1px
|
|
134
|
-
--_ba-before-w: var(--su-static12);
|
|
135
|
-
|
|
136
|
-
// Sizes
|
|
137
|
-
&.s-badge__xs {
|
|
138
|
-
--_ba-before-h: calc(var(--su-static8) + var(--su-static1)); // 9px
|
|
139
|
-
--_ba-before-icon: url("data:image/svg+xml,%3Csvg width='7' height='9' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 .246c.3-.329.701-.327 1 0L6.776 4c.3.329.298.672 0 1L4 8.75c-.299.329-.702.327-1 0L.224 5c-.284-.324-.285-.675 0-1L3 .246z' fill='%23fff'/%3E%3C/svg%3E");
|
|
140
|
-
--_ba-before-mt: 0;
|
|
141
|
-
--_ba-before-w: calc(var(--su-static8) - var(--su-static1)); // 7px
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
&.s-badge__sm {
|
|
145
|
-
--_ba-g: var(--su-static2);
|
|
146
|
-
--_ba-before-h: calc(var(--su-static12) - var(--su-static1)); // 11px
|
|
147
|
-
--_ba-before-icon: url("data:image/svg+xml,%3Csvg width='9' height='11' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3.55.246c.257-.329.647-.327.903 0l3.36 4.66c.256.329.256.864 0 1.192L4.45 10.75c-.257.329-.644.327-.9 0L.192 6.098c-.256-.329-.256-.865 0-1.192L3.55.246z' fill='%23fff'/%3E%3C/svg%3E");
|
|
148
|
-
--_ba-before-mt: 0;
|
|
149
|
-
--_ba-before-w: calc(var(--su-static8) + var(--su-static1)); // 9px
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
&:before {
|
|
153
|
-
height: var(--_ba-before-h);
|
|
154
|
-
margin-top: var(--_ba-before-mt);
|
|
155
|
-
width: var(--_ba-before-w);
|
|
156
|
-
|
|
157
|
-
content: "";
|
|
158
|
-
display: inline-block;
|
|
159
|
-
background-color: currentColor;
|
|
160
|
-
-webkit-mask: var(--_ba-before-icon) no-repeat center;
|
|
161
|
-
mask: var(--_ba-before-icon) no-repeat center;
|
|
162
|
-
-webkit-mask-size: contain;
|
|
163
|
-
mask-size: contain;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
&&__staff {
|
|
168
|
-
// Staff badges are always "Stack Overflow Orange"
|
|
169
|
-
--_ba-bc: var(--orange-300);
|
|
170
|
-
--_ba-bg: var(--orange-100);
|
|
171
|
-
--_ba-fc: var(--orange-900);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
// VARIANTS
|
|
175
|
-
&&__danger,
|
|
176
|
-
&&__muted {
|
|
177
|
-
&.s-badge__filled {
|
|
178
|
-
--_ba-bc: transparent;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
&&__danger {
|
|
183
|
-
--_ba-bc: var(--red-600);
|
|
184
|
-
--_ba-bg: var(--red-100);
|
|
185
|
-
--_ba-fc: var(--red-900);
|
|
186
|
-
|
|
187
|
-
&.s-badge__filled {
|
|
188
|
-
--_ba-bg: var(--red-500);
|
|
189
|
-
--_ba-fc: @white;
|
|
190
|
-
|
|
191
|
-
.highcontrast-mode({
|
|
192
|
-
--_ba-fc: var(--white);
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
&&__info {
|
|
197
|
-
--_ba-bc: var(--blue-600);
|
|
198
|
-
--_ba-bg: var(--blue-100);
|
|
199
|
-
--_ba-fc: var(--blue-900);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
&&__warning {
|
|
203
|
-
--_ba-bc: var(--yellow-600);
|
|
204
|
-
--_ba-bg: var(--yellow-100);
|
|
205
|
-
--_ba-fc: var(--yellow-900);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
&&__muted {
|
|
209
|
-
--_ba-bc: var(--black-600);
|
|
210
|
-
--_ba-bg: var(--black-100);
|
|
211
|
-
--_ba-fc: var(--black-900);
|
|
212
|
-
|
|
213
|
-
&.s-badge__filled {
|
|
214
|
-
--_ba-bg: var(--black-700);
|
|
215
|
-
--_ba-fc: var(--white);
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
// CHILD ELEMENTS
|
|
220
|
-
&--image, // Included with no base class to account for usage in .s-progress__badge
|
|
221
|
-
& &--image {
|
|
222
|
-
align-self: center;
|
|
223
|
-
display: inline-flex;
|
|
224
|
-
margin-right: var(--su1);
|
|
225
|
-
margin-left: calc((var(--su4) + var(--su1)) * -1);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
// INTERACTION
|
|
229
|
-
a&:hover {
|
|
230
|
-
text-decoration: none;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
align-self: var(--_ba-as);
|
|
234
|
-
background-color: var(--_ba-bg);
|
|
235
|
-
border: var(--su-static1) solid var(--_ba-bc);
|
|
236
|
-
color: var(--_ba-fc);
|
|
237
|
-
font-size: var(--_ba-fs);
|
|
238
|
-
gap: var(--_ba-g);
|
|
239
|
-
line-height: var(--_ba-lh);
|
|
240
|
-
min-width: var(--_ba-wmn);
|
|
241
|
-
padding: var(--_ba-py) var(--_ba-px);
|
|
242
|
-
|
|
243
|
-
align-items: center;
|
|
244
|
-
border-radius: var(--br-sm);
|
|
245
|
-
display: inline-flex;
|
|
246
|
-
font-weight: normal;
|
|
247
|
-
justify-content: center;
|
|
248
|
-
text-decoration: none;
|
|
249
|
-
vertical-align: middle;
|
|
250
|
-
white-space: nowrap;
|
|
251
|
-
}
|
|
1
|
+
.s-badge {
|
|
2
|
+
--_ba-as: unset;
|
|
3
|
+
--_ba-bc: var(--bc-medium);
|
|
4
|
+
--_ba-bg: var(--black-050);
|
|
5
|
+
--_ba-fc: var(--black-700);
|
|
6
|
+
--_ba-fs: var(--fs-caption);
|
|
7
|
+
--_ba-g: 0.3em;
|
|
8
|
+
--_ba-lh: 2;
|
|
9
|
+
--_ba-px: var(--su6);
|
|
10
|
+
--_ba-py: 0;
|
|
11
|
+
--_ba-wmn: 0;
|
|
12
|
+
|
|
13
|
+
// CONTEXTUAL STYLES
|
|
14
|
+
.highcontrast-mode({
|
|
15
|
+
// Badge counts
|
|
16
|
+
&&__gold,
|
|
17
|
+
&&__silver,
|
|
18
|
+
&&__bronze,
|
|
19
|
+
// Number counts
|
|
20
|
+
&&__rep,
|
|
21
|
+
&&__rep-down,
|
|
22
|
+
&&__votes:not(&__answered),
|
|
23
|
+
// Users
|
|
24
|
+
&&__admin,
|
|
25
|
+
&&__moderator,
|
|
26
|
+
&&__staff {
|
|
27
|
+
--_ba-bc: currentColor;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// MODIFIERS
|
|
32
|
+
// Sizes
|
|
33
|
+
&&__xs,
|
|
34
|
+
&&__sm {
|
|
35
|
+
--_ba-as: flex-start;
|
|
36
|
+
--_ba-fs: var(--fs-fine);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&&__xs {
|
|
40
|
+
--_ba-lh: 1.5;
|
|
41
|
+
--_ba-px: var(--su2);
|
|
42
|
+
--_ba-wmn: calc(var(--su-static16) + var(--su-static2));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&&__sm {
|
|
46
|
+
--_ba-lh: 1.8;
|
|
47
|
+
--_ba-px: var(--su4);
|
|
48
|
+
--_ba-wmn: calc(var(--su-static16) + var(--su-static2));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Badge counts
|
|
52
|
+
&&__gold,
|
|
53
|
+
&&__silver,
|
|
54
|
+
&&__bronze {
|
|
55
|
+
--_ba-fc: var(--black-700);
|
|
56
|
+
|
|
57
|
+
.highcontrast-mode({
|
|
58
|
+
--_ba-fc: var(--black-900);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&&__gold {
|
|
63
|
+
--_ba-bc: var(--gold-darker);
|
|
64
|
+
--_ba-bg: var(--gold-lighter);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&&__silver {
|
|
68
|
+
--_ba-bc: var(--silver-darker);
|
|
69
|
+
--_ba-bg: var(--silver-lighter);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&&__bronze {
|
|
73
|
+
--_ba-bc: var(--bronze-darker);
|
|
74
|
+
--_ba-bg: var(--bronze-lighter);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Number counts
|
|
78
|
+
&&__answered,
|
|
79
|
+
&&__bounty,
|
|
80
|
+
&&__important {
|
|
81
|
+
--_ba-bc: transparent;
|
|
82
|
+
--_ba-fc: var(--white);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
&&__rep,
|
|
86
|
+
&&__rep-down,
|
|
87
|
+
&&__votes:not(&__answered) {
|
|
88
|
+
--_ba-bg: var(--white);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
&&__answered {
|
|
92
|
+
--_ba-bg: var(--green-400);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
&&__bounty {
|
|
96
|
+
--_ba-bg: var(--blue-600);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
&&__important {
|
|
100
|
+
--_ba-bg: var(--red-600);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&&__rep {
|
|
104
|
+
--_ba-bc: var(--green-400);
|
|
105
|
+
--_ba-fc: var(--green-500);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
&&__rep-down {
|
|
109
|
+
--_ba-bc: var(--red-400);
|
|
110
|
+
--_ba-fc: var(--red-500);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
&&__votes:not(&__answered) {
|
|
114
|
+
--_ba-bc: var(--black-150);
|
|
115
|
+
--_ba-fc: var(--black-700);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Users
|
|
119
|
+
&&__admin {
|
|
120
|
+
--_ba-bc: var(--theme-primary-200);
|
|
121
|
+
--_ba-bg: var(--theme-primary-075);
|
|
122
|
+
--_ba-fc: var(--theme-primary-800);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
&&__moderator {
|
|
126
|
+
--_ba-bc: var(--theme-secondary-200);
|
|
127
|
+
--_ba-bg: var(--theme-secondary-075);
|
|
128
|
+
--_ba-fc: var(--theme-secondary-800);
|
|
129
|
+
--_ba-g: calc(var(--su-static4) - var(--su-static1)); // 3px
|
|
130
|
+
// :before icon
|
|
131
|
+
--_ba-before-h: calc(var(--su-static16) - var(--su-static2)); // 14px
|
|
132
|
+
--_ba-before-icon: url("data:image/svg+xml,%3Csvg width='12' height='14' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5.528.746c.257-.329.675-.327.93 0l4.42 5.66c.258.329.257.864 0 1.192l-4.42 5.66c-.256.328-.674.327-.93 0l-4.42-5.66c-.257-.329-.256-.865 0-1.192l4.42-5.66z' fill='%23fff'/%3E%3C/svg%3E");
|
|
133
|
+
--_ba-before-mt: calc(var(--su-static1) * -1); // -1px
|
|
134
|
+
--_ba-before-w: var(--su-static12);
|
|
135
|
+
|
|
136
|
+
// Sizes
|
|
137
|
+
&.s-badge__xs {
|
|
138
|
+
--_ba-before-h: calc(var(--su-static8) + var(--su-static1)); // 9px
|
|
139
|
+
--_ba-before-icon: url("data:image/svg+xml,%3Csvg width='7' height='9' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 .246c.3-.329.701-.327 1 0L6.776 4c.3.329.298.672 0 1L4 8.75c-.299.329-.702.327-1 0L.224 5c-.284-.324-.285-.675 0-1L3 .246z' fill='%23fff'/%3E%3C/svg%3E");
|
|
140
|
+
--_ba-before-mt: 0;
|
|
141
|
+
--_ba-before-w: calc(var(--su-static8) - var(--su-static1)); // 7px
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
&.s-badge__sm {
|
|
145
|
+
--_ba-g: var(--su-static2);
|
|
146
|
+
--_ba-before-h: calc(var(--su-static12) - var(--su-static1)); // 11px
|
|
147
|
+
--_ba-before-icon: url("data:image/svg+xml,%3Csvg width='9' height='11' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3.55.246c.257-.329.647-.327.903 0l3.36 4.66c.256.329.256.864 0 1.192L4.45 10.75c-.257.329-.644.327-.9 0L.192 6.098c-.256-.329-.256-.865 0-1.192L3.55.246z' fill='%23fff'/%3E%3C/svg%3E");
|
|
148
|
+
--_ba-before-mt: 0;
|
|
149
|
+
--_ba-before-w: calc(var(--su-static8) + var(--su-static1)); // 9px
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
&:before {
|
|
153
|
+
height: var(--_ba-before-h);
|
|
154
|
+
margin-top: var(--_ba-before-mt);
|
|
155
|
+
width: var(--_ba-before-w);
|
|
156
|
+
|
|
157
|
+
content: "";
|
|
158
|
+
display: inline-block;
|
|
159
|
+
background-color: currentColor;
|
|
160
|
+
-webkit-mask: var(--_ba-before-icon) no-repeat center;
|
|
161
|
+
mask: var(--_ba-before-icon) no-repeat center;
|
|
162
|
+
-webkit-mask-size: contain;
|
|
163
|
+
mask-size: contain;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
&&__staff {
|
|
168
|
+
// Staff badges are always "Stack Overflow Orange"
|
|
169
|
+
--_ba-bc: var(--orange-300);
|
|
170
|
+
--_ba-bg: var(--orange-100);
|
|
171
|
+
--_ba-fc: var(--orange-900);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// VARIANTS
|
|
175
|
+
&&__danger,
|
|
176
|
+
&&__muted {
|
|
177
|
+
&.s-badge__filled {
|
|
178
|
+
--_ba-bc: transparent;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
&&__danger {
|
|
183
|
+
--_ba-bc: var(--red-600);
|
|
184
|
+
--_ba-bg: var(--red-100);
|
|
185
|
+
--_ba-fc: var(--red-900);
|
|
186
|
+
|
|
187
|
+
&.s-badge__filled {
|
|
188
|
+
--_ba-bg: var(--red-500);
|
|
189
|
+
--_ba-fc: @white;
|
|
190
|
+
|
|
191
|
+
.highcontrast-mode({
|
|
192
|
+
--_ba-fc: var(--white);
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
&&__info {
|
|
197
|
+
--_ba-bc: var(--blue-600);
|
|
198
|
+
--_ba-bg: var(--blue-100);
|
|
199
|
+
--_ba-fc: var(--blue-900);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
&&__warning {
|
|
203
|
+
--_ba-bc: var(--yellow-600);
|
|
204
|
+
--_ba-bg: var(--yellow-100);
|
|
205
|
+
--_ba-fc: var(--yellow-900);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
&&__muted {
|
|
209
|
+
--_ba-bc: var(--black-600);
|
|
210
|
+
--_ba-bg: var(--black-100);
|
|
211
|
+
--_ba-fc: var(--black-900);
|
|
212
|
+
|
|
213
|
+
&.s-badge__filled {
|
|
214
|
+
--_ba-bg: var(--black-700);
|
|
215
|
+
--_ba-fc: var(--white);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// CHILD ELEMENTS
|
|
220
|
+
&--image, // Included with no base class to account for usage in .s-progress__badge
|
|
221
|
+
& &--image {
|
|
222
|
+
align-self: center;
|
|
223
|
+
display: inline-flex;
|
|
224
|
+
margin-right: var(--su1);
|
|
225
|
+
margin-left: calc((var(--su4) + var(--su1)) * -1);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// INTERACTION
|
|
229
|
+
a&:hover {
|
|
230
|
+
text-decoration: none;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
align-self: var(--_ba-as);
|
|
234
|
+
background-color: var(--_ba-bg);
|
|
235
|
+
border: var(--su-static1) solid var(--_ba-bc);
|
|
236
|
+
color: var(--_ba-fc);
|
|
237
|
+
font-size: var(--_ba-fs);
|
|
238
|
+
gap: var(--_ba-g);
|
|
239
|
+
line-height: var(--_ba-lh);
|
|
240
|
+
min-width: var(--_ba-wmn);
|
|
241
|
+
padding: var(--_ba-py) var(--_ba-px);
|
|
242
|
+
|
|
243
|
+
align-items: center;
|
|
244
|
+
border-radius: var(--br-sm);
|
|
245
|
+
display: inline-flex;
|
|
246
|
+
font-weight: normal;
|
|
247
|
+
justify-content: center;
|
|
248
|
+
text-decoration: none;
|
|
249
|
+
vertical-align: middle;
|
|
250
|
+
white-space: nowrap;
|
|
251
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { runComponentTests } from "../../test/test-utils";
|
|
2
|
+
import "../../index";
|
|
3
|
+
|
|
4
|
+
const bannerChild = `
|
|
5
|
+
<div
|
|
6
|
+
class="d-flex flex__center jc-space-between s-banner--container"
|
|
7
|
+
role="alertdialog"
|
|
8
|
+
aria-labelledby="banner-title"
|
|
9
|
+
aria-describedby="banner-description"
|
|
10
|
+
>
|
|
11
|
+
<div aria-label="banner message">
|
|
12
|
+
<h2 id="banner-title">Banner heading</h2>
|
|
13
|
+
<p id="banner-description">Banner description</p>
|
|
14
|
+
</div>
|
|
15
|
+
<div class="ml-auto myn8">
|
|
16
|
+
<span class="s-btn s-banner--btn">Close</span>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
describe("banner", () => {
|
|
22
|
+
runComponentTests({
|
|
23
|
+
type: "a11y",
|
|
24
|
+
baseClass: "s-banner",
|
|
25
|
+
variants: ["info", "success", "warning", "danger"],
|
|
26
|
+
modifiers: {
|
|
27
|
+
primary: ["important"],
|
|
28
|
+
},
|
|
29
|
+
attributes: {
|
|
30
|
+
role: "alert",
|
|
31
|
+
ariaHidden: "false",
|
|
32
|
+
},
|
|
33
|
+
children: {
|
|
34
|
+
default: bannerChild,
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// See also ./lib/components/notice/notice.less
|
|
2
|
+
// TODO deprecate .s-banner (by turning it into a modifier on .s-notice)
|
|
3
|
+
// This would reduce the amount of CSS we ship to the client and simplify our codebase
|
|
4
|
+
.s-banner {
|
|
5
|
+
--_no-x-offset: 0; // [1]
|
|
6
|
+
.construct-notice-component(s-banner);
|
|
7
|
+
|
|
8
|
+
&[aria-hidden="true"] { // If you want to hide and reveal the banner
|
|
9
|
+
--_no-x-offset: calc(var(--su48) + var(--su2) * -1); // -50px
|
|
10
|
+
opacity: 0;
|
|
11
|
+
visibility: hidden;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&[aria-hidden="false"] {
|
|
15
|
+
--_no-x-offset: calc(var(--su48) + var(--su1)); // 49px
|
|
16
|
+
opacity: 1;
|
|
17
|
+
visibility: visible;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&.is-pinned { // If you want to put the banner above the topbar
|
|
21
|
+
z-index: calc(var(--zi-navigation-fixed) + 1);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&__body-pt {
|
|
25
|
+
padding-top: 93px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
& &--container { // When we want to keep hero content capped
|
|
29
|
+
margin: 0 auto;
|
|
30
|
+
max-width: calc(var(--s-step) * 10);
|
|
31
|
+
position: relative;
|
|
32
|
+
width: 100%;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
border-width: var(--su-static1) 0;
|
|
36
|
+
inset: 0 0 auto 0;
|
|
37
|
+
padding: var(--su12);
|
|
38
|
+
position: fixed;
|
|
39
|
+
-webkit-transform: translate3d(0, var(--_no-x-offset), 0);
|
|
40
|
+
transform: translate3d(0, var(--_no-x-offset), 0);
|
|
41
|
+
width: 100%;
|
|
42
|
+
z-index: calc(var(--zi-navigation-fixed) - 1); // Tuck below topbar
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// [1] When we use .s-banner, we need to adjust the padding-top on
|
|
46
|
+
// the body tag. This class correctly adjusts the body padding ONLY if
|
|
47
|
+
// the notice is one line. If it wraps to multiple lines, more classes or
|
|
48
|
+
// (ideally) JS will need to be used to determine the notice's height
|
|
49
|
+
// at the time of render. The padding value is determined like so:
|
|
50
|
+
// 50px (top bar) + 44px (notice height) - 1px (bottom border)
|
|
51
|
+
// The borders subtraction are necessary to neatly tuck everything together.
|