@stackoverflow/stacks 1.7.1 → 1.9.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.
Files changed (138) hide show
  1. package/README.md +1 -1
  2. package/dist/components/activity-indicator/activity-indicator.a11y.test.d.ts +1 -0
  3. package/dist/components/activity-indicator/activity-indicator.visual.test.d.ts +1 -0
  4. package/dist/components/avatar/avatar.a11y.test.d.ts +1 -0
  5. package/dist/components/avatar/avatar.visual.test.d.ts +1 -0
  6. package/dist/{controllers/s-banner.d.ts → components/banner/banner.d.ts} +1 -1
  7. package/dist/components/banner/banner.test.d.ts +1 -0
  8. package/dist/components/banner/banner.visual.test.d.ts +1 -0
  9. package/dist/components/button/button.a11y.test.d.ts +1 -0
  10. package/dist/components/button/button.visual.test.d.ts +1 -0
  11. package/dist/{controllers/s-expandable-control.d.ts → components/expandable/expandable.d.ts} +1 -1
  12. package/dist/components/expandable/expandable.test.d.ts +1 -0
  13. package/dist/{controllers/s-modal.d.ts → components/modal/modal.d.ts} +1 -1
  14. package/dist/{controllers/s-navigation-tablist.d.ts → components/navigation/navigation.d.ts} +1 -1
  15. package/dist/{controllers/s-popover.d.ts → components/popover/popover.d.ts} +1 -1
  16. package/dist/{controllers/s-tooltip.d.ts → components/popover/tooltip.d.ts} +1 -1
  17. package/dist/components/popover/tooltip.test.d.ts +1 -0
  18. package/dist/components/popover/tooltip.visual.test.d.ts +1 -0
  19. package/dist/{controllers/s-table.d.ts → components/table/table.d.ts} +1 -1
  20. package/dist/{controllers/s-toast.d.ts → components/toast/toast.d.ts} +1 -1
  21. package/dist/components/toast/toast.test.d.ts +1 -0
  22. package/dist/components/toast/toast.visual.test.d.ts +1 -0
  23. package/dist/{controllers/s-uploader.d.ts → components/uploader/uploader.d.ts} +1 -1
  24. package/dist/controllers.d.ts +9 -0
  25. package/dist/css/stacks.css +1351 -1171
  26. package/dist/css/stacks.min.css +1 -1
  27. package/dist/index.d.ts +1 -1
  28. package/dist/js/stacks.js +545 -545
  29. package/dist/js/stacks.min.js +1 -1
  30. package/dist/test/test-utils.d.ts +136 -0
  31. package/lib/{css/atomic/borders.less → atomic/border.less} +18 -0
  32. package/lib/base/fieldset.less +5 -0
  33. package/lib/{css/base/icons.less → base/icon.less} +0 -9
  34. package/lib/components/activity-indicator/activity-indicator.a11y.test.ts +21 -0
  35. package/lib/components/activity-indicator/activity-indicator.visual.test.ts +23 -0
  36. package/lib/components/avatar/avatar.a11y.test.ts +36 -0
  37. package/lib/components/avatar/avatar.visual.test.ts +54 -0
  38. package/lib/components/banner/banner.less +51 -0
  39. package/lib/{test/s-banner.test.ts → components/banner/banner.test.ts} +7 -3
  40. package/lib/{ts/controllers/s-banner.ts → components/banner/banner.ts} +1 -1
  41. package/lib/components/banner/banner.visual.test.ts +36 -0
  42. package/lib/components/button/button.a11y.test.ts +32 -0
  43. package/lib/{css/components/buttons.less → components/button/button.less} +7 -6
  44. package/lib/components/button/button.visual.test.ts +52 -0
  45. package/lib/{css/components/cards.less → components/card/card.less} +1 -1
  46. package/lib/components/check-control/check-control.less +17 -0
  47. package/lib/components/check-group/check-group.less +19 -0
  48. package/lib/components/checkbox_radio/checkbox_radio.less +158 -0
  49. package/lib/components/description/description.less +9 -0
  50. package/lib/{css/components → components/expandable}/expandable.less +3 -0
  51. package/lib/components/expandable/expandable.test.ts +53 -0
  52. package/lib/{ts/controllers/s-expandable-control.ts → components/expandable/expandable.ts} +1 -1
  53. package/lib/components/input-fill/input-fill.less +35 -0
  54. package/lib/components/input-icon/input-icon.less +45 -0
  55. package/lib/components/input-message/input-message.less +48 -0
  56. package/lib/components/input_textarea/input_textarea.less +166 -0
  57. package/lib/{css/components/labels.less → components/label/label.less} +4 -4
  58. package/lib/{css/components → components/link}/link.less +9 -2
  59. package/lib/{ts/controllers/s-modal.ts → components/modal/modal.ts} +1 -1
  60. package/lib/{ts/controllers/s-navigation-tablist.ts → components/navigation/navigation.ts} +1 -1
  61. package/lib/{css/components/notices.less → components/notice/notice.less} +0 -89
  62. package/lib/{css/components/popovers.less → components/popover/popover.less} +1 -0
  63. package/lib/{ts/controllers/s-popover.ts → components/popover/popover.ts} +1 -1
  64. package/lib/{test/s-tooltip.test.ts → components/popover/tooltip.test.ts} +6 -2
  65. package/lib/{ts/controllers/s-tooltip.ts → components/popover/tooltip.ts} +2 -2
  66. package/lib/{test/s-tooltip.visual.test.ts → components/popover/tooltip.visual.test.ts} +2 -2
  67. package/lib/{css/components → components/post-summary}/post-summary.less +6 -2
  68. package/lib/components/select/select.less +148 -0
  69. package/lib/{css/components/sidebar-widgets.less → components/sidebar-widget/sidebar-widget.less} +0 -1
  70. package/lib/{css/components → components/table}/table.less +0 -5
  71. package/lib/{ts/controllers/s-table.ts → components/table/table.ts} +1 -1
  72. package/lib/components/table-container/table-container.less +4 -0
  73. package/lib/{css/components/tags.less → components/tag/tag.less} +3 -3
  74. package/lib/components/toast/toast.less +35 -0
  75. package/lib/{test/s-toast.test.ts → components/toast/toast.test.ts} +7 -3
  76. package/lib/{ts/controllers/s-toast.ts → components/toast/toast.ts} +1 -1
  77. package/lib/components/toast/toast.visual.test.ts +27 -0
  78. package/lib/{css/components/toggle-switches.less → components/toggle-switch/toggle-switch.less} +8 -0
  79. package/lib/{ts/controllers/s-uploader.ts → components/uploader/uploader.ts} +1 -1
  80. package/lib/controllers.ts +33 -0
  81. package/lib/{css/exports → exports}/mixins.less +73 -11
  82. package/lib/{ts/index.ts → index.ts} +1 -1
  83. package/lib/input-utils.less +44 -0
  84. package/lib/{css/stacks-dynamic.less → stacks-dynamic.less} +1 -2
  85. package/lib/stacks-static.less +93 -0
  86. package/lib/test/test-utils.ts +444 -0
  87. package/lib/tsconfig.json +1 -1
  88. package/package.json +26 -25
  89. package/dist/controllers/index.d.ts +0 -9
  90. package/lib/css/components/inputs.less +0 -666
  91. package/lib/css/stacks-static.less +0 -97
  92. package/lib/test/s-avatar.test.ts +0 -74
  93. package/lib/test/s-banner.visual.test.ts +0 -61
  94. package/lib/test/s-button.visual.test.ts +0 -12
  95. package/lib/test/s-toast.visual.test.ts +0 -48
  96. package/lib/ts/controllers/index.ts +0 -17
  97. /package/lib/{css/atomic/colors.less → atomic/color.less} +0 -0
  98. /package/lib/{css/atomic → atomic}/flex.less +0 -0
  99. /package/lib/{css/atomic → atomic}/gap.less +0 -0
  100. /package/lib/{css/atomic → atomic}/grid.less +0 -0
  101. /package/lib/{css/atomic → atomic}/misc.less +0 -0
  102. /package/lib/{css/atomic → atomic}/spacing.less +0 -0
  103. /package/lib/{css/atomic → atomic}/typography.less +0 -0
  104. /package/lib/{css/atomic → atomic}/width-height.less +0 -0
  105. /package/lib/{css/base → base}/body.less +0 -0
  106. /package/lib/{css/base → base}/configuration-static.less +0 -0
  107. /package/lib/{css/base/internals.less → base/internal.less} +0 -0
  108. /package/lib/{css/base → base}/reset-meyer.less +0 -0
  109. /package/lib/{css/base → base}/reset-normalize.less +0 -0
  110. /package/lib/{css/base → base}/reset.less +0 -0
  111. /package/lib/{css/components → components/activity-indicator}/activity-indicator.less +0 -0
  112. /package/lib/{css/components/anchors.less → components/anchor/anchor.less} +0 -0
  113. /package/lib/{css/components/avatars.less → components/avatar/avatar.less} +0 -0
  114. /package/lib/{css/components → components/award-bling}/award-bling.less +0 -0
  115. /package/lib/{css/components/badges.less → components/badge/badge.less} +0 -0
  116. /package/lib/{css/components → components/block-link}/block-link.less +0 -0
  117. /package/lib/{css/components → components/breadcrumbs}/breadcrumbs.less +0 -0
  118. /package/lib/{css/components/button-groups.less → components/button-group/button-group.less} +0 -0
  119. /package/lib/{css/components/code-blocks.less → components/code-block/code-block.less} +0 -0
  120. /package/lib/{css/components/empty-states.less → components/empty-state/empty-state.less} +0 -0
  121. /package/lib/{css/components/link-previews.less → components/link-preview/link-preview.less} +0 -0
  122. /package/lib/{css/components → components/menu}/menu.less +0 -0
  123. /package/lib/{css/components/modals.less → components/modal/modal.less} +0 -0
  124. /package/lib/{css/components → components/navigation}/navigation.less +0 -0
  125. /package/lib/{css/components/page-titles.less → components/page-title/page-title.less} +0 -0
  126. /package/lib/{css/components → components/pagination}/pagination.less +0 -0
  127. /package/lib/{css/components/progress-bars.less → components/progress-bar/progress-bar.less} +0 -0
  128. /package/lib/{css/components → components/prose}/prose.less +0 -0
  129. /package/lib/{css/components → components/spinner}/spinner.less +0 -0
  130. /package/lib/{css/components → components/topbar}/topbar.less +0 -0
  131. /package/lib/{css/components → components/uploader}/uploader.less +0 -0
  132. /package/lib/{css/components/user-cards.less → components/user-card/user-card.less} +0 -0
  133. /package/lib/{css/exports → exports}/constants-colors.less +0 -0
  134. /package/lib/{css/exports → exports}/constants-helpers.less +0 -0
  135. /package/lib/{css/exports → exports}/constants-type.less +0 -0
  136. /package/lib/{css/exports → exports}/exports.less +0 -0
  137. /package/lib/{css/stacks.less → stacks.less} +0 -0
  138. /package/lib/{ts/stacks.ts → stacks.ts} +0 -0
@@ -1,97 +0,0 @@
1
- //
2
- // STACK OVERFLOW
3
- // STATIC STACK ELEMENTS
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
- // This is where all the magic happens.
10
- //
11
- // ============================================================================
12
- // $ STATIC ELEMENTS
13
- // The following items are elements which we DO NOT allow communities
14
- // to modify via variables.
15
- // ----------------------------------------------------------------------------
16
- @import "base/reset.less";
17
- @import "base/icons.less";
18
-
19
- // -- COMPONENTS
20
- @import "components/activity-indicator.less";
21
- @import "components/anchors.less";
22
- @import "components/award-bling.less";
23
- @import "components/avatars.less";
24
- @import "components/badges.less";
25
- @import "components/buttons.less";
26
- @import "components/empty-states.less";
27
- @import "components/block-link.less";
28
- @import "components/breadcrumbs.less";
29
- @import "components/button-groups.less";
30
- @import "components/cards.less";
31
- @import "components/code-blocks.less";
32
- @import "components/expandable.less";
33
- @import "components/inputs.less";
34
- @import "components/labels.less";
35
- @import "components/link.less";
36
- @import "components/link-previews.less";
37
- @import "components/menu.less";
38
- @import "components/modals.less";
39
- @import "components/navigation.less";
40
- @import "components/notices.less";
41
- @import "components/page-titles.less";
42
- @import "components/pagination.less";
43
- @import "components/popovers.less";
44
- @import "components/post-summary.less";
45
- @import "components/progress-bars.less";
46
- @import "components/prose.less";
47
- @import "components/sidebar-widgets.less";
48
- @import "components/spinner.less";
49
- @import "components/table.less";
50
- @import "components/tags.less";
51
- @import "components/toggle-switches.less";
52
- @import "components/topbar.less";
53
- @import "components/uploader.less";
54
- @import "components/user-cards.less";
55
-
56
- // -- LESS CONSTANTS AND MIXINS
57
- @import "exports/exports.less";
58
-
59
- // -- ATOMIC CLASSES
60
- @import "atomic/borders.less";
61
- @import "atomic/colors.less";
62
- @import "atomic/flex.less";
63
- @import "atomic/gap.less";
64
- @import "atomic/grid.less";
65
- @import "atomic/spacing.less";
66
- @import "atomic/typography.less";
67
- @import "atomic/misc.less";
68
- @import "atomic/width-height.less";
69
-
70
- /* stylelint-disable */
71
- #stacks-internals #screen-lg({
72
- #stacks-internals-collect-large();
73
- });
74
- #stacks-internals #screen-md({
75
- #stacks-internals-collect-medium();
76
- });
77
- #stacks-internals #screen-sm({
78
- #stacks-internals-collect-small();
79
- });
80
-
81
- // We need printing styles to be last so they can override all other styles.
82
- .print\:d-block {
83
- @media print {
84
- display: block !important;
85
- }
86
- }
87
-
88
- .print\:d-none {
89
- @media print {
90
- display: none !important;
91
- }
92
- }
93
- /* stylelint-enable */
94
-
95
- // -- CONFIG
96
- @import "base/configuration-static.less";
97
- @import "base/internals.less";
@@ -1,74 +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} styles in 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
- describe("s-avatar", () => {
44
- // Test default, high contrast themes
45
- baseThemes.forEach((baseTheme) => {
46
- // Test light, dark theme
47
- colorThemes.forEach((colorTheme) => {
48
- const testidBase = `s-avatar-${
49
- baseTheme ? `${baseTheme}-` : ""
50
- }${colorTheme}`;
51
- const theme = [baseTheme, colorTheme].filter(Boolean);
52
-
53
- // Test each size
54
- ["", ...avatarStyles.sizes].forEach((size) => {
55
- const sizeClasses = size ? ` s-avatar__${size}` : "";
56
- const classesSize = ` ${sizeClasses}`;
57
- const testidSize = `${testidBase}-${size}`;
58
-
59
- // Test each size with each child
60
- ["", ...avatarStyles.children].forEach((child) => {
61
- const testidChildren = `${testidSize}${
62
- child ? `-with-${child}` : ""
63
- }`;
64
- makeTest({
65
- child,
66
- classes: classesSize,
67
- testid: testidChildren,
68
- theme,
69
- });
70
- });
71
- });
72
- });
73
- });
74
- });
@@ -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,12 +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
- // const btn = await fixture(html`
8
- // <button class="s-btn is-loading" type="button">Loading</button>
9
- // `);
10
- // await visualDiff(btn, "s-btn-is-loading");
11
- // });
12
- // });
@@ -1,48 +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 testToast = (variant = "info", important = false) => {
6
- const importantClass = important ? "s-notice__important" : "";
7
-
8
- return html`<div class="s-toast" aria-hidden="false">
9
- <aside class="s-notice s-notice__${variant} ${importantClass}">
10
- Test toast: ${variant} ${importantClass}
11
- </aside>
12
- </div>`;
13
- };
14
-
15
- describe("s-toast", () => {
16
- it("should not introduce visual regressions for info toast", async () => {
17
- const toast = await fixture(testToast("info"));
18
- await visualDiff(toast, "s-toast__info");
19
- });
20
- it("should not introduce visual regressions for important info toast", async () => {
21
- const toast = await fixture(testToast("info", true));
22
- await visualDiff(toast, "s-toast__info-important");
23
- });
24
- it("should not introduce visual regressions for success toast", async () => {
25
- const toast = await fixture(testToast("success"));
26
- await visualDiff(toast, "s-toast__success");
27
- });
28
- it("should not introduce visual regressions for important success toast", async () => {
29
- const toast = await fixture(testToast("success", true));
30
- await visualDiff(toast, "s-toast__success-important");
31
- });
32
- it("should not introduce visual regressions for warning toast", async () => {
33
- const toast = await fixture(testToast("warning"));
34
- await visualDiff(toast, "s-toast__warning");
35
- });
36
- it("should not introduce visual regressions for important warning toast", async () => {
37
- const toast = await fixture(testToast("warning", true));
38
- await visualDiff(toast, "s-toast__warning-important");
39
- });
40
- it("should not introduce visual regressions for danger toast", async () => {
41
- const toast = await fixture(testToast("danger"));
42
- await visualDiff(toast, "s-toast__danger");
43
- });
44
- it("should not introduce visual regressions for important danger toast", async () => {
45
- const toast = await fixture(testToast("danger", true));
46
- await visualDiff(toast, "s-toast__danger-important");
47
- });
48
- });
@@ -1,17 +0,0 @@
1
- // export all controllers *with helpers* so they can be bulk re-exported by the package entry point
2
- export { ExpandableController } from "./s-expandable-control";
3
- export { hideModal, ModalController, showModal } from "./s-modal";
4
- export { hideBanner, BannerController, showBanner } from "./s-banner";
5
- export { hideToast, ToastController, showToast } from "./s-toast";
6
- export { TabListController } from "./s-navigation-tablist";
7
- export {
8
- attachPopover,
9
- detachPopover,
10
- hidePopover,
11
- BasePopoverController,
12
- PopoverController,
13
- showPopover,
14
- } from "./s-popover";
15
- export { TableController } from "./s-table";
16
- export { setTooltipHtml, setTooltipText, TooltipController } from "./s-tooltip";
17
- export { UploaderController } from "./s-uploader";
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes