@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
package/package.json
CHANGED
|
@@ -1,105 +1,106 @@
|
|
|
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
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@stackoverflow/stacks",
|
|
3
|
+
"description": "Stack Overflow’s CSS and Design Pattern Library. Stacks is an atomic CSS library with classes and components for rapidly building Stack Overflow.",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "https://github.com/StackExchange/Stacks.git"
|
|
7
|
+
},
|
|
8
|
+
"version": "1.9.1",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"lib"
|
|
12
|
+
],
|
|
13
|
+
"main": "./dist/js/stacks.js",
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"style": "./dist/css/stacks.css",
|
|
16
|
+
"less": "./lib/stacks.less",
|
|
17
|
+
"unpkg": "dist/css/stacks.min.css",
|
|
18
|
+
"scripts": {
|
|
19
|
+
"start": "concurrently -n w: npm:start:*",
|
|
20
|
+
"build": "concurrently -n w: npm:build:*",
|
|
21
|
+
"build:bundle": "webpack --mode=production",
|
|
22
|
+
"build:docs": "webpack --mode=production --config ./docs/webpack.config.js && cd ./docs && eleventy",
|
|
23
|
+
"start:webpack": "webpack --watch --config ./docs/webpack.config.js",
|
|
24
|
+
"start:eleventy": "cd ./docs && eleventy --serve",
|
|
25
|
+
"test": "web-test-runner",
|
|
26
|
+
"test:a11y": "web-test-runner --group=a11y",
|
|
27
|
+
"test:unit": "web-test-runner --group=unit",
|
|
28
|
+
"test:unit:watch": "web-test-runner --group=unit --watch",
|
|
29
|
+
"test:visual": "web-test-runner --group=visual",
|
|
30
|
+
"test:visual:update": "web-test-runner --group=visual --update-visual-baseline",
|
|
31
|
+
"prepublishOnly": "npm run build",
|
|
32
|
+
"format": "prettier --write ./lib",
|
|
33
|
+
"lint": "concurrently -n w: npm:lint:*",
|
|
34
|
+
"lint:ts": "eslint ./lib",
|
|
35
|
+
"lint:css": "stylelint ./lib",
|
|
36
|
+
"lint:format": "prettier --check ./lib"
|
|
37
|
+
},
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@hotwired/stimulus": "^3.2.1",
|
|
41
|
+
"@popperjs/core": "^2.11.7"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@11ty/eleventy": "^2.0.1",
|
|
45
|
+
"@highlightjs/cdn-assets": "^11.7.0",
|
|
46
|
+
"@open-wc/testing": "^3.1.8",
|
|
47
|
+
"@rollup/plugin-commonjs": "^24.1.0",
|
|
48
|
+
"@rollup/plugin-replace": "^5.0.2",
|
|
49
|
+
"@stackoverflow/stacks-editor": "^0.8.7",
|
|
50
|
+
"@stackoverflow/stacks-icons": "^5.3.1",
|
|
51
|
+
"@testing-library/dom": "^9.2.0",
|
|
52
|
+
"@testing-library/user-event": "^14.4.3",
|
|
53
|
+
"@typescript-eslint/eslint-plugin": "^5.59.2",
|
|
54
|
+
"@typescript-eslint/parser": "^5.59.1",
|
|
55
|
+
"@web/dev-server-esbuild": "^0.4.1",
|
|
56
|
+
"@web/dev-server-rollup": "^0.4.0",
|
|
57
|
+
"@web/test-runner": "^0.16.1",
|
|
58
|
+
"@web/test-runner-playwright": "^0.10.0",
|
|
59
|
+
"@web/test-runner-visual-regression": "^0.8.0",
|
|
60
|
+
"concurrently": "^8.0.1",
|
|
61
|
+
"css-loader": "^6.7.3",
|
|
62
|
+
"cssnano": "^6.0.0",
|
|
63
|
+
"docsearch.js": "^2.6.3",
|
|
64
|
+
"eleventy-plugin-highlightjs": "^1.1.0",
|
|
65
|
+
"eleventy-plugin-nesting-toc": "^1.3.0",
|
|
66
|
+
"eslint": "^8.38.0",
|
|
67
|
+
"eslint-config-prettier": "^8.8.0",
|
|
68
|
+
"eslint-plugin-no-unsanitized": "^4.0.2",
|
|
69
|
+
"jquery": "^3.6.4",
|
|
70
|
+
"less-loader": "^11.1.0",
|
|
71
|
+
"list.js": "^2.3.1",
|
|
72
|
+
"markdown-it": "^13.0.1",
|
|
73
|
+
"mini-css-extract-plugin": "^2.7.5",
|
|
74
|
+
"postcss-less": "^6.0.0",
|
|
75
|
+
"postcss-loader": "^7.2.4",
|
|
76
|
+
"prettier": "^2.8.8",
|
|
77
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
78
|
+
"stylelint": "^15.6.1",
|
|
79
|
+
"stylelint-config-recommended": "^12.0.0",
|
|
80
|
+
"stylelint-config-standard": "^33.0.0",
|
|
81
|
+
"terser-webpack-plugin": "^5.3.6",
|
|
82
|
+
"ts-loader": "^9.4.2",
|
|
83
|
+
"typescript": "^5.0.4",
|
|
84
|
+
"webpack": "^5.82.0",
|
|
85
|
+
"webpack-cli": "^5.0.2",
|
|
86
|
+
"webpack-merge": "^5.8.0"
|
|
87
|
+
},
|
|
88
|
+
"browserslist": [
|
|
89
|
+
"last 2 versions",
|
|
90
|
+
"not dead",
|
|
91
|
+
"not ie > 0",
|
|
92
|
+
"not op_mini all",
|
|
93
|
+
"not baidu > 0",
|
|
94
|
+
"not and_ff > 0",
|
|
95
|
+
"not and_qq > 0",
|
|
96
|
+
"not kaios > 0",
|
|
97
|
+
"not op_mob > 0",
|
|
98
|
+
"not ie_mob > 0",
|
|
99
|
+
"not and_uc > 0",
|
|
100
|
+
"not Samsung > 0",
|
|
101
|
+
"not Android > 0"
|
|
102
|
+
],
|
|
103
|
+
"overrides": {
|
|
104
|
+
"aria-query": "~5.0.0"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export { ExpandableController } from "./s-expandable-control";
|
|
2
|
-
export { hideModal, ModalController, showModal } from "./s-modal";
|
|
3
|
-
export { hideBanner, BannerController, showBanner } from "./s-banner";
|
|
4
|
-
export { hideToast, ToastController, showToast } from "./s-toast";
|
|
5
|
-
export { TabListController } from "./s-navigation-tablist";
|
|
6
|
-
export { attachPopover, detachPopover, hidePopover, BasePopoverController, PopoverController, showPopover, } from "./s-popover";
|
|
7
|
-
export { TableController } from "./s-table";
|
|
8
|
-
export { setTooltipHtml, setTooltipText, TooltipController } from "./s-tooltip";
|
|
9
|
-
export { UploaderController } from "./s-uploader";
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as Stacks from "../stacks";
|
|
2
|
-
export declare class TableController extends Stacks.StacksController {
|
|
3
|
-
static targets: string[];
|
|
4
|
-
readonly columnTarget: Element;
|
|
5
|
-
readonly columnTargets: Element[];
|
|
6
|
-
setCurrentSort(headElem: Element, direction: "asc" | "desc" | "none"): void;
|
|
7
|
-
sort(evt: Event): void;
|
|
8
|
-
}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
// stacks-static.less contains styles which we DO NOT allow communities to modify via variables
|
|
2
|
-
// BASE
|
|
3
|
-
@import "base/reset.less";
|
|
4
|
-
@import "base/fieldset.less";
|
|
5
|
-
@import "base/icons.less";
|
|
6
|
-
@import "input-utils.less";
|
|
7
|
-
|
|
8
|
-
// COMPONENTS
|
|
9
|
-
@import "components/activity-indicator.less";
|
|
10
|
-
@import "components/anchors.less";
|
|
11
|
-
@import "components/award-bling.less";
|
|
12
|
-
@import "components/avatars.less";
|
|
13
|
-
@import "components/badges.less";
|
|
14
|
-
@import "components/buttons.less";
|
|
15
|
-
@import "components/empty-states.less";
|
|
16
|
-
@import "components/block-link.less";
|
|
17
|
-
@import "components/breadcrumbs.less";
|
|
18
|
-
@import "components/button-groups.less";
|
|
19
|
-
@import "components/cards.less";
|
|
20
|
-
@import "components/checkboxes-radios.less";
|
|
21
|
-
@import "components/code-blocks.less";
|
|
22
|
-
@import "components/description.less";
|
|
23
|
-
@import "components/expandable.less";
|
|
24
|
-
@import "components/inputs.less";
|
|
25
|
-
@import "components/labels.less";
|
|
26
|
-
@import "components/link.less";
|
|
27
|
-
@import "components/link-previews.less";
|
|
28
|
-
@import "components/menu.less";
|
|
29
|
-
@import "components/modals.less";
|
|
30
|
-
@import "components/navigation.less";
|
|
31
|
-
@import "components/notices.less";
|
|
32
|
-
@import "components/page-titles.less";
|
|
33
|
-
@import "components/pagination.less";
|
|
34
|
-
@import "components/popovers.less";
|
|
35
|
-
@import "components/post-summary.less";
|
|
36
|
-
@import "components/progress-bars.less";
|
|
37
|
-
@import "components/prose.less";
|
|
38
|
-
@import "components/select.less";
|
|
39
|
-
@import "components/sidebar-widgets.less";
|
|
40
|
-
@import "components/spinner.less";
|
|
41
|
-
@import "components/table.less";
|
|
42
|
-
@import "components/tags.less";
|
|
43
|
-
@import "components/toggle-switches.less";
|
|
44
|
-
@import "components/topbar.less";
|
|
45
|
-
@import "components/uploader.less";
|
|
46
|
-
@import "components/user-cards.less";
|
|
47
|
-
|
|
48
|
-
// LESS CONSTANTS AND MIXINS
|
|
49
|
-
@import "exports/exports.less";
|
|
50
|
-
|
|
51
|
-
// ATOMIC CLASSES
|
|
52
|
-
@import "atomic/borders.less";
|
|
53
|
-
@import "atomic/colors.less";
|
|
54
|
-
@import "atomic/flex.less";
|
|
55
|
-
@import "atomic/gap.less";
|
|
56
|
-
@import "atomic/grid.less";
|
|
57
|
-
@import "atomic/spacing.less";
|
|
58
|
-
@import "atomic/typography.less";
|
|
59
|
-
@import "atomic/misc.less";
|
|
60
|
-
@import "atomic/width-height.less";
|
|
61
|
-
|
|
62
|
-
/* stylelint-disable */
|
|
63
|
-
#stacks-internals #screen-lg({
|
|
64
|
-
#stacks-internals-collect-large();
|
|
65
|
-
});
|
|
66
|
-
#stacks-internals #screen-md({
|
|
67
|
-
#stacks-internals-collect-medium();
|
|
68
|
-
});
|
|
69
|
-
#stacks-internals #screen-sm({
|
|
70
|
-
#stacks-internals-collect-small();
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
@media print { // We need printing styles to be last so they can override all other styles.
|
|
74
|
-
.print\:d-block & {
|
|
75
|
-
display: block !important;
|
|
76
|
-
}
|
|
77
|
-
.print\:d-none & {
|
|
78
|
-
display: none !important;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
/* stylelint-enable */
|
|
82
|
-
|
|
83
|
-
// CONFIG
|
|
84
|
-
@import "base/configuration-static.less";
|
|
85
|
-
@import "base/internals.less";
|
|
86
|
-
|
|
87
|
-
// [1] The following items are elements which we DO NOT allow communities to modify via variables.
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { html, fixture, expect } from "@open-wc/testing";
|
|
2
|
-
import { screen } from "@testing-library/dom";
|
|
3
|
-
import "../ts/index";
|
|
4
|
-
|
|
5
|
-
// TODO abstract to a helper file… maybe create a helper function to test in all themes
|
|
6
|
-
const colorThemes = ["theme-dark", "theme-light"];
|
|
7
|
-
const baseThemes = ["", "theme-highcontrast"];
|
|
8
|
-
|
|
9
|
-
const avatarStyles = {
|
|
10
|
-
sizes: ["24", "32", "48", "64", "96", "128"],
|
|
11
|
-
children: ["image", "letter"],
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const makeTest = ({ testid, theme, classes, child = "" }) => {
|
|
15
|
-
it(`a11y: ${testid} should be accessible`, async () => {
|
|
16
|
-
await fixture(html`<a
|
|
17
|
-
href="#"
|
|
18
|
-
class="s-avatar${classes}"
|
|
19
|
-
data-testid="${testid}"
|
|
20
|
-
>
|
|
21
|
-
<div
|
|
22
|
-
class="${child === "letter" ? "s-avatar--letter" : "d-none"}"
|
|
23
|
-
aria-hidden="true"
|
|
24
|
-
>
|
|
25
|
-
S
|
|
26
|
-
</div>
|
|
27
|
-
<img
|
|
28
|
-
class="${child === "image" ? "s-avatar--image" : "d-none"}"
|
|
29
|
-
src="https://picsum.photos/48"
|
|
30
|
-
alt="team logo"
|
|
31
|
-
/>
|
|
32
|
-
<span class="v-visible-sr">Stack Overflow</span>
|
|
33
|
-
</a>`);
|
|
34
|
-
|
|
35
|
-
document.body.className = "";
|
|
36
|
-
document.body.classList.add(...theme);
|
|
37
|
-
const avatar = screen.getByTestId(testid);
|
|
38
|
-
// TODO add conditional option for high contrast mode to test against AAA
|
|
39
|
-
await expect(avatar).to.be.accessible();
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
// TODO move to test utils
|
|
44
|
-
const buildTestid = (arr) => arr.filter(Boolean).join("-");
|
|
45
|
-
|
|
46
|
-
describe("s-avatar", () => {
|
|
47
|
-
// Test default, high contrast themes
|
|
48
|
-
baseThemes.forEach((baseTheme) => {
|
|
49
|
-
// Test light, dark theme
|
|
50
|
-
colorThemes.forEach((colorTheme) => {
|
|
51
|
-
const theme = [baseTheme, colorTheme].filter(Boolean);
|
|
52
|
-
const testidBase = buildTestid(["s-avatar", ...theme]);
|
|
53
|
-
|
|
54
|
-
// Test each size
|
|
55
|
-
["", ...avatarStyles.sizes].forEach((size) => {
|
|
56
|
-
const sizeClasses = size ? ` s-avatar__${size}` : "";
|
|
57
|
-
const classesSize = ` ${sizeClasses}`;
|
|
58
|
-
const testidSize = buildTestid([testidBase, size]);
|
|
59
|
-
|
|
60
|
-
// Test each size with each child
|
|
61
|
-
["", ...avatarStyles.children].forEach((child) => {
|
|
62
|
-
const testidChildren = buildTestid([
|
|
63
|
-
testidSize,
|
|
64
|
-
`with-${child}`,
|
|
65
|
-
]);
|
|
66
|
-
|
|
67
|
-
makeTest({
|
|
68
|
-
child,
|
|
69
|
-
classes: classesSize,
|
|
70
|
-
testid: testidChildren,
|
|
71
|
-
theme,
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
});
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { html, fixture } from "@open-wc/testing";
|
|
2
|
-
import { visualDiff } from "@web/test-runner-visual-regression";
|
|
3
|
-
import "../ts/index";
|
|
4
|
-
|
|
5
|
-
const testBanner = (variant = "info", important = false) => {
|
|
6
|
-
const importantClass = important ? "s-banner__important" : "";
|
|
7
|
-
|
|
8
|
-
return html`<aside
|
|
9
|
-
class="s-banner s-banner__${variant} ${importantClass} is-pinned ps-relatives"
|
|
10
|
-
role="alert"
|
|
11
|
-
aria-hidden="false"
|
|
12
|
-
>
|
|
13
|
-
<div
|
|
14
|
-
class="d-flex flex__center jc-space-between s-banner--container"
|
|
15
|
-
role="alertdialog"
|
|
16
|
-
aria-describedby="banner-message"
|
|
17
|
-
>
|
|
18
|
-
<div aria-label="banner message">
|
|
19
|
-
Test Banner: ${variant} ${importantClass}
|
|
20
|
-
</div>
|
|
21
|
-
<div class="ml-auto myn8">
|
|
22
|
-
<span class="s-btn s-banner--btn">Close</span>
|
|
23
|
-
</div>
|
|
24
|
-
</div>
|
|
25
|
-
</aside>`;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
describe("s-banner", () => {
|
|
29
|
-
it("should not introduce visual regressions for info banner", async () => {
|
|
30
|
-
const banner = await fixture(testBanner("info"));
|
|
31
|
-
await visualDiff(banner, "s-banner__info");
|
|
32
|
-
});
|
|
33
|
-
it("should not introduce visual regressions for important info banner", async () => {
|
|
34
|
-
const banner = await fixture(testBanner("info", true));
|
|
35
|
-
await visualDiff(banner, "s-banner__info-important");
|
|
36
|
-
});
|
|
37
|
-
it("should not introduce visual regressions for success banner", async () => {
|
|
38
|
-
const banner = await fixture(testBanner("success"));
|
|
39
|
-
await visualDiff(banner, "s-banner__success");
|
|
40
|
-
});
|
|
41
|
-
it("should not introduce visual regressions for important success banner", async () => {
|
|
42
|
-
const banner = await fixture(testBanner("success", true));
|
|
43
|
-
await visualDiff(banner, "s-banner__success-important");
|
|
44
|
-
});
|
|
45
|
-
it("should not introduce visual regressions for warning banner", async () => {
|
|
46
|
-
const banner = await fixture(testBanner("warning"));
|
|
47
|
-
await visualDiff(banner, "s-banner__warning");
|
|
48
|
-
});
|
|
49
|
-
it("should not introduce visual regressions for important warning banner", async () => {
|
|
50
|
-
const banner = await fixture(testBanner("warning", true));
|
|
51
|
-
await visualDiff(banner, "s-banner__warning-important");
|
|
52
|
-
});
|
|
53
|
-
it("should not introduce visual regressions for danger banner", async () => {
|
|
54
|
-
const banner = await fixture(testBanner("danger"));
|
|
55
|
-
await visualDiff(banner, "s-banner__danger");
|
|
56
|
-
});
|
|
57
|
-
it("should not introduce visual regressions for important danger banner", async () => {
|
|
58
|
-
const banner = await fixture(testBanner("danger", true));
|
|
59
|
-
await visualDiff(banner, "s-banner__danger-important");
|
|
60
|
-
});
|
|
61
|
-
});
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { html, fixture, expect } from "@open-wc/testing";
|
|
2
|
-
import { screen } from "@testing-library/dom";
|
|
3
|
-
import "../ts/index";
|
|
4
|
-
|
|
5
|
-
// TODO abstract to a helper file…
|
|
6
|
-
// TODO reinstate "theme-dark" test once we add ability to skip tests or resolve dark mode contrast issues
|
|
7
|
-
// const colorThemes = ["theme-dark", "theme-light"];
|
|
8
|
-
const colorThemes = ["theme-light"];
|
|
9
|
-
const baseThemes = ["", "theme-highcontrast"];
|
|
10
|
-
|
|
11
|
-
const btnStyles = {
|
|
12
|
-
variants: ["danger", "muted", "primary"],
|
|
13
|
-
modifiers: ["filled", "outlined", "filled-outlined"],
|
|
14
|
-
secondaryModifiers: ["dropdown", "icon"],
|
|
15
|
-
globalModifiers: ["is-loading"],
|
|
16
|
-
sizes: ["xs", "sm", "md"],
|
|
17
|
-
resets: ["link", "unset"],
|
|
18
|
-
social: ["facebook", "github", "google"],
|
|
19
|
-
// TODO reinstate children test once we add ability to skip tests or resolve badge contrast issues
|
|
20
|
-
// children: ["badge"],
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
const makeTest = ({ testid, theme, classes, child = "" }) => {
|
|
24
|
-
it(`a11y: ${testid} should be accessible`, async () => {
|
|
25
|
-
await fixture(html`<button
|
|
26
|
-
class="s-btn${classes}"
|
|
27
|
-
role="button"
|
|
28
|
-
data-testid="${testid}"
|
|
29
|
-
>
|
|
30
|
-
Ask question
|
|
31
|
-
<span class="${child === "badge" ? "s-btn--badge" : "d-none"}">
|
|
32
|
-
<span class="s-btn--number">198</span>
|
|
33
|
-
</span>
|
|
34
|
-
</button>`);
|
|
35
|
-
|
|
36
|
-
document.body.className = "";
|
|
37
|
-
document.body.classList.add(...theme);
|
|
38
|
-
const button = screen.getByTestId(testid);
|
|
39
|
-
// TODO add conditional option for high contrast mode to test against AAA
|
|
40
|
-
await expect(button).to.be.accessible();
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
// TODO move to test utils
|
|
45
|
-
const buildTestid = (arr) => arr.filter(Boolean).join("-");
|
|
46
|
-
|
|
47
|
-
describe("s-btn", () => {
|
|
48
|
-
// Test default, high contrast themes
|
|
49
|
-
baseThemes.forEach((baseTheme) => {
|
|
50
|
-
// Test light, dark theme
|
|
51
|
-
colorThemes.forEach((colorTheme) => {
|
|
52
|
-
const theme = [baseTheme, colorTheme].filter(Boolean);
|
|
53
|
-
const testidBase = buildTestid(["s-btn", ...theme]);
|
|
54
|
-
|
|
55
|
-
// Test each combination of base modifiers
|
|
56
|
-
["", ...btnStyles.modifiers].forEach((modifier) => {
|
|
57
|
-
const modifierClasses = modifier
|
|
58
|
-
? ` s-btn__${modifier.replace("-", " s-btn__")}`
|
|
59
|
-
: "";
|
|
60
|
-
|
|
61
|
-
// Test each variant
|
|
62
|
-
["", ...btnStyles.variants].forEach((variant) => {
|
|
63
|
-
const variantClasses = variant ? ` s-btn__${variant}` : "";
|
|
64
|
-
const classesVariant = ` ${variantClasses}${modifierClasses}`;
|
|
65
|
-
const testidVariant = buildTestid([
|
|
66
|
-
testidBase,
|
|
67
|
-
variant,
|
|
68
|
-
modifier,
|
|
69
|
-
]);
|
|
70
|
-
|
|
71
|
-
// Test each variant with each child
|
|
72
|
-
// TODO reinstate children test once we add ability to skip tests or resolve badge contrast issues
|
|
73
|
-
// [...btnStyles.children].forEach((child) => {
|
|
74
|
-
// const testidChildren = `${testidVariant}${
|
|
75
|
-
// child ? `-with-${child}` : ""
|
|
76
|
-
// }`;
|
|
77
|
-
// makeTest({
|
|
78
|
-
// child,
|
|
79
|
-
// classes: classesVariant,
|
|
80
|
-
// testid: testidChildren,
|
|
81
|
-
// theme,
|
|
82
|
-
// });
|
|
83
|
-
// });
|
|
84
|
-
|
|
85
|
-
[
|
|
86
|
-
"", // Test no additional classes
|
|
87
|
-
...btnStyles.sizes, // Test each size
|
|
88
|
-
...btnStyles.resets, // Test each reset
|
|
89
|
-
...btnStyles.social, // Test each social style
|
|
90
|
-
].forEach((style) => {
|
|
91
|
-
const testidStyle = buildTestid([testidVariant, style]);
|
|
92
|
-
const classesStyle = `${classesVariant}${
|
|
93
|
-
style ? ` s-btn__${style}` : ""
|
|
94
|
-
}`;
|
|
95
|
-
|
|
96
|
-
makeTest({
|
|
97
|
-
classes: classesStyle,
|
|
98
|
-
testid: testidStyle,
|
|
99
|
-
theme,
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
// Test each globalModifier
|
|
104
|
-
[...btnStyles.globalModifiers].forEach((globalModifier) => {
|
|
105
|
-
const testidGlobal = buildTestid([
|
|
106
|
-
testidVariant,
|
|
107
|
-
globalModifier,
|
|
108
|
-
]);
|
|
109
|
-
const classesGlobal = `${classesVariant}${
|
|
110
|
-
globalModifier ? ` ${globalModifier}` : ""
|
|
111
|
-
}`;
|
|
112
|
-
|
|
113
|
-
makeTest({
|
|
114
|
-
classes: classesGlobal,
|
|
115
|
-
testid: testidGlobal,
|
|
116
|
-
theme,
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
});
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { html, fixture } from "@open-wc/testing";
|
|
2
|
-
import { visualDiff } from "@web/test-runner-visual-regression";
|
|
3
|
-
import "../ts/index";
|
|
4
|
-
|
|
5
|
-
describe("s-btn", () => {
|
|
6
|
-
it("should not introduce visual regressions for loading button", async () => {
|
|
7
|
-
// Adding a padded wrapper to avoid GitHub Actions diff discrepancies
|
|
8
|
-
const btn = await fixture(html`
|
|
9
|
-
<div style="height: 38px; width: 88px; display: inline-block;">
|
|
10
|
-
<button class="s-btn is-loading" type="button">Loading</button>
|
|
11
|
-
</div>
|
|
12
|
-
`);
|
|
13
|
-
|
|
14
|
-
await visualDiff(btn, "s-btn-is-loading");
|
|
15
|
-
});
|
|
16
|
-
});
|