@stackoverflow/stacks 2.7.3 → 2.7.4

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 (83) hide show
  1. package/LICENSE.MD +9 -9
  2. package/README.md +158 -180
  3. package/dist/css/stacks.css +6 -0
  4. package/dist/js/stacks.min.js +1 -1
  5. package/lib/atomic/border.less +139 -139
  6. package/lib/atomic/color.less +36 -36
  7. package/lib/atomic/flex.less +426 -426
  8. package/lib/atomic/gap.less +44 -44
  9. package/lib/atomic/grid.less +139 -139
  10. package/lib/atomic/misc.less +374 -374
  11. package/lib/atomic/spacing.less +98 -98
  12. package/lib/atomic/typography.less +266 -264
  13. package/lib/atomic/width-height.less +194 -194
  14. package/lib/base/body.less +44 -44
  15. package/lib/base/configuration-static.less +61 -61
  16. package/lib/base/fieldset.less +5 -5
  17. package/lib/base/icon.less +11 -11
  18. package/lib/base/internal.less +220 -220
  19. package/lib/base/reset-meyer.less +64 -64
  20. package/lib/base/reset-normalize.less +449 -449
  21. package/lib/base/reset.less +20 -20
  22. package/lib/components/activity-indicator/activity-indicator.less +53 -53
  23. package/lib/components/avatar/avatar.less +108 -108
  24. package/lib/components/award-bling/award-bling.less +31 -31
  25. package/lib/components/banner/banner.less +44 -44
  26. package/lib/components/banner/banner.ts +149 -149
  27. package/lib/components/block-link/block-link.less +82 -82
  28. package/lib/components/breadcrumbs/breadcrumbs.less +41 -41
  29. package/lib/components/button-group/button-group.less +82 -82
  30. package/lib/components/card/card.less +37 -37
  31. package/lib/components/check-control/check-control.less +17 -17
  32. package/lib/components/check-group/check-group.less +19 -19
  33. package/lib/components/checkbox_radio/checkbox_radio.less +159 -159
  34. package/lib/components/code-block/code-block.fixtures.ts +88 -88
  35. package/lib/components/code-block/code-block.less +116 -116
  36. package/lib/components/description/description.less +9 -9
  37. package/lib/components/empty-state/empty-state.less +16 -16
  38. package/lib/components/expandable/expandable.less +118 -118
  39. package/lib/components/input-fill/input-fill.less +35 -35
  40. package/lib/components/input-icon/input-icon.less +45 -45
  41. package/lib/components/input-message/input-message.less +49 -49
  42. package/lib/components/label/label.less +110 -110
  43. package/lib/components/link-preview/link-preview.less +148 -148
  44. package/lib/components/menu/menu.less +41 -41
  45. package/lib/components/modal/modal.less +118 -118
  46. package/lib/components/modal/modal.ts +383 -383
  47. package/lib/components/navigation/navigation.less +136 -136
  48. package/lib/components/navigation/navigation.ts +128 -128
  49. package/lib/components/page-title/page-title.less +51 -51
  50. package/lib/components/popover/popover.less +159 -159
  51. package/lib/components/popover/popover.ts +651 -651
  52. package/lib/components/post-summary/post-summary.less +457 -457
  53. package/lib/components/progress-bar/progress-bar.less +291 -291
  54. package/lib/components/prose/prose.less +452 -452
  55. package/lib/components/select/select.less +138 -138
  56. package/lib/components/spinner/spinner.less +103 -103
  57. package/lib/components/table/table.ts +296 -296
  58. package/lib/components/table-container/table-container.less +4 -4
  59. package/lib/components/tag/tag.less +186 -186
  60. package/lib/components/toast/toast.less +35 -35
  61. package/lib/components/toast/toast.ts +357 -357
  62. package/lib/components/toggle-switch/toggle-switch.less +104 -104
  63. package/lib/components/topbar/topbar.less +553 -553
  64. package/lib/components/uploader/uploader.less +205 -205
  65. package/lib/components/user-card/user-card.less +129 -129
  66. package/lib/controllers.ts +33 -33
  67. package/lib/exports/color-mixins.less +283 -283
  68. package/lib/exports/constants-helpers.less +108 -108
  69. package/lib/exports/constants-type.less +155 -155
  70. package/lib/exports/exports.less +15 -15
  71. package/lib/exports/mixins.less +334 -333
  72. package/lib/exports/spacing-mixins.less +67 -67
  73. package/lib/index.ts +32 -32
  74. package/lib/input-utils.less +41 -41
  75. package/lib/stacks-dynamic.less +24 -24
  76. package/lib/stacks-static.less +93 -93
  77. package/lib/stacks.less +13 -13
  78. package/lib/test/assertions.ts +36 -36
  79. package/lib/test/less-test-utils.ts +28 -28
  80. package/lib/test/open-wc-testing-patch.d.ts +26 -26
  81. package/lib/tsconfig.build.json +4 -4
  82. package/lib/tsconfig.json +17 -17
  83. package/package.json +26 -22
@@ -1,149 +1,149 @@
1
- import * as Stacks from "../../stacks";
2
-
3
- export class BannerController extends Stacks.StacksController {
4
- static targets = ["banner"];
5
-
6
- declare readonly bannerTarget: HTMLElement;
7
-
8
- /**
9
- * Toggles the visibility of the banner
10
- */
11
- toggle(dispatcher: Event | Element | null = null) {
12
- this._toggle(undefined, dispatcher);
13
- }
14
-
15
- /**
16
- * Shows the banner
17
- */
18
- show(dispatcher: Event | Element | null = null) {
19
- this._toggle(true, dispatcher);
20
- }
21
-
22
- /**
23
- * Hides the banner
24
- */
25
- hide(dispatcher: Event | Element | null = null) {
26
- this._toggle(false, dispatcher);
27
- }
28
-
29
- /**
30
- * Toggles the visibility of the banner element
31
- * @param show Optional parameter that force shows/hides the element or toggles it if left undefined
32
- */
33
- private _toggle(
34
- show?: boolean | undefined,
35
- dispatcher: Event | Element | null = null
36
- ) {
37
- let toShow = show;
38
- const isVisible =
39
- this.bannerTarget.getAttribute("aria-hidden") === "false";
40
-
41
- // if we're letting the class toggle, we need to figure out if the banner is visible manually
42
- if (typeof toShow === "undefined") {
43
- toShow = !isVisible;
44
- }
45
-
46
- // if the state matches the disired state, return without changing anything
47
- if ((toShow && isVisible) || (!toShow && !isVisible)) {
48
- return;
49
- }
50
-
51
- const dispatchingElement = this.getDispatcher(dispatcher);
52
-
53
- // show/hide events trigger before toggling the class
54
- const triggeredEvent = this.triggerEvent(
55
- toShow ? "show" : "hide",
56
- {
57
- dispatcher: this.getDispatcher(dispatchingElement),
58
- },
59
- this.bannerTarget
60
- );
61
-
62
- // if this pre-show/hide event was prevented, don't attempt to continue changing the banner state
63
- if (triggeredEvent.defaultPrevented) {
64
- return;
65
- }
66
-
67
- this.bannerTarget.setAttribute(
68
- "aria-hidden",
69
- toShow ? "false" : "true"
70
- );
71
-
72
- if (!toShow) {
73
- this.removeBannerOnHide();
74
- }
75
-
76
- this.triggerEvent(
77
- toShow ? "shown" : "hidden",
78
- {
79
- dispatcher: dispatchingElement,
80
- },
81
- this.bannerTarget
82
- );
83
- }
84
-
85
- /**
86
- * Remove the element on hide if the `remove-when-hidden` flag is set
87
- */
88
- private removeBannerOnHide() {
89
- if (this.data.get("remove-when-hidden") !== "true") {
90
- return;
91
- }
92
-
93
- this.bannerTarget.addEventListener(
94
- "s-banner:hidden",
95
- () => {
96
- this.element.remove();
97
- },
98
- { once: true }
99
- );
100
- }
101
-
102
- /**
103
- * Determines the correct dispatching element from a potential input
104
- * @param dispatcher The event or element to get the dispatcher from
105
- */
106
- private getDispatcher(dispatcher: Event | Element | null = null): Element {
107
- if (dispatcher instanceof Event) {
108
- return <Element>dispatcher.target;
109
- } else if (dispatcher instanceof Element) {
110
- return dispatcher;
111
- } else {
112
- return this.element;
113
- }
114
- }
115
- }
116
-
117
- /**
118
- * Helper to manually show an s-banner element via external JS
119
- * @param element the element the `data-controller="s-banner"` attribute is on
120
- */
121
- export function showBanner(element: HTMLElement) {
122
- toggleBanner(element, true);
123
- }
124
-
125
- /**
126
- * Helper to manually hide an s-banner element via external JS
127
- * @param element the element the `data-controller="s-banner"` attribute is on
128
- */
129
- export function hideBanner(element: HTMLElement) {
130
- toggleBanner(element, false);
131
- }
132
-
133
- /**
134
- * Helper to manually show an s-banner element via external JS
135
- * @param element the element the `data-controller="s-banner"` attribute is on
136
- * @param show whether to force show/hide the banner; toggles the banner if left undefined
137
- */
138
- function toggleBanner(element: HTMLElement, show?: boolean | undefined) {
139
- const controller = Stacks.application.getControllerForElementAndIdentifier(
140
- element,
141
- "s-banner"
142
- ) as BannerController;
143
-
144
- if (!controller) {
145
- throw "Unable to get s-banner controller from element";
146
- }
147
-
148
- show ? controller.show() : controller.hide();
149
- }
1
+ import * as Stacks from "../../stacks";
2
+
3
+ export class BannerController extends Stacks.StacksController {
4
+ static targets = ["banner"];
5
+
6
+ declare readonly bannerTarget: HTMLElement;
7
+
8
+ /**
9
+ * Toggles the visibility of the banner
10
+ */
11
+ toggle(dispatcher: Event | Element | null = null) {
12
+ this._toggle(undefined, dispatcher);
13
+ }
14
+
15
+ /**
16
+ * Shows the banner
17
+ */
18
+ show(dispatcher: Event | Element | null = null) {
19
+ this._toggle(true, dispatcher);
20
+ }
21
+
22
+ /**
23
+ * Hides the banner
24
+ */
25
+ hide(dispatcher: Event | Element | null = null) {
26
+ this._toggle(false, dispatcher);
27
+ }
28
+
29
+ /**
30
+ * Toggles the visibility of the banner element
31
+ * @param show Optional parameter that force shows/hides the element or toggles it if left undefined
32
+ */
33
+ private _toggle(
34
+ show?: boolean | undefined,
35
+ dispatcher: Event | Element | null = null
36
+ ) {
37
+ let toShow = show;
38
+ const isVisible =
39
+ this.bannerTarget.getAttribute("aria-hidden") === "false";
40
+
41
+ // if we're letting the class toggle, we need to figure out if the banner is visible manually
42
+ if (typeof toShow === "undefined") {
43
+ toShow = !isVisible;
44
+ }
45
+
46
+ // if the state matches the disired state, return without changing anything
47
+ if ((toShow && isVisible) || (!toShow && !isVisible)) {
48
+ return;
49
+ }
50
+
51
+ const dispatchingElement = this.getDispatcher(dispatcher);
52
+
53
+ // show/hide events trigger before toggling the class
54
+ const triggeredEvent = this.triggerEvent(
55
+ toShow ? "show" : "hide",
56
+ {
57
+ dispatcher: this.getDispatcher(dispatchingElement),
58
+ },
59
+ this.bannerTarget
60
+ );
61
+
62
+ // if this pre-show/hide event was prevented, don't attempt to continue changing the banner state
63
+ if (triggeredEvent.defaultPrevented) {
64
+ return;
65
+ }
66
+
67
+ this.bannerTarget.setAttribute(
68
+ "aria-hidden",
69
+ toShow ? "false" : "true"
70
+ );
71
+
72
+ if (!toShow) {
73
+ this.removeBannerOnHide();
74
+ }
75
+
76
+ this.triggerEvent(
77
+ toShow ? "shown" : "hidden",
78
+ {
79
+ dispatcher: dispatchingElement,
80
+ },
81
+ this.bannerTarget
82
+ );
83
+ }
84
+
85
+ /**
86
+ * Remove the element on hide if the `remove-when-hidden` flag is set
87
+ */
88
+ private removeBannerOnHide() {
89
+ if (this.data.get("remove-when-hidden") !== "true") {
90
+ return;
91
+ }
92
+
93
+ this.bannerTarget.addEventListener(
94
+ "s-banner:hidden",
95
+ () => {
96
+ this.element.remove();
97
+ },
98
+ { once: true }
99
+ );
100
+ }
101
+
102
+ /**
103
+ * Determines the correct dispatching element from a potential input
104
+ * @param dispatcher The event or element to get the dispatcher from
105
+ */
106
+ private getDispatcher(dispatcher: Event | Element | null = null): Element {
107
+ if (dispatcher instanceof Event) {
108
+ return <Element>dispatcher.target;
109
+ } else if (dispatcher instanceof Element) {
110
+ return dispatcher;
111
+ } else {
112
+ return this.element;
113
+ }
114
+ }
115
+ }
116
+
117
+ /**
118
+ * Helper to manually show an s-banner element via external JS
119
+ * @param element the element the `data-controller="s-banner"` attribute is on
120
+ */
121
+ export function showBanner(element: HTMLElement) {
122
+ toggleBanner(element, true);
123
+ }
124
+
125
+ /**
126
+ * Helper to manually hide an s-banner element via external JS
127
+ * @param element the element the `data-controller="s-banner"` attribute is on
128
+ */
129
+ export function hideBanner(element: HTMLElement) {
130
+ toggleBanner(element, false);
131
+ }
132
+
133
+ /**
134
+ * Helper to manually show an s-banner element via external JS
135
+ * @param element the element the `data-controller="s-banner"` attribute is on
136
+ * @param show whether to force show/hide the banner; toggles the banner if left undefined
137
+ */
138
+ function toggleBanner(element: HTMLElement, show?: boolean | undefined) {
139
+ const controller = Stacks.application.getControllerForElementAndIdentifier(
140
+ element,
141
+ "s-banner"
142
+ ) as BannerController;
143
+
144
+ if (!controller) {
145
+ throw "Unable to get s-banner controller from element";
146
+ }
147
+
148
+ show ? controller.show() : controller.hide();
149
+ }
@@ -1,82 +1,82 @@
1
- a.s-block-link,
2
- .s-block-link {
3
- --_bl-bs-color: var(--theme-primary);
4
- --_bl-bg: transparent;
5
- --_bl-fc: var(--black-500);
6
- --_bl-fc-hover: var(--black-600);
7
- --_bl-fc-visited: var(--_bl-fc);
8
-
9
- // CONTEXTUAL STYLES
10
- .dark-mode({
11
- &.is-selected {
12
- --_bl-bg: var(--black-100);
13
- }
14
- });
15
-
16
- // STATES
17
- &.is-selected {
18
- --_bl-bg: var(--black-150);
19
- --_bl-fc: var(--black-600);
20
-
21
- font-weight: bold;
22
- }
23
-
24
- // MODIFIERS
25
- &&__left,
26
- &&__right {
27
- &.is-selected {
28
- &:not(:focus-visible):not(.focus-inset) {
29
- box-shadow: inset var(--_li-block-bs-offset-x, 3px) 0 0 var(--_bl-bs-color);
30
- }
31
- }
32
- }
33
-
34
- &&__right {
35
- &.is-selected {
36
- --_li-block-bs-offset-x: calc(var(--su-static1) - var(--su-static4)); // -3px
37
- }
38
- }
39
-
40
- // VARIANTS
41
- &&__danger {
42
- --_bl-fc: var(--red-400);
43
- --_bl-fc-hover: var(--red-500);
44
- --_bl-fc-visited: var(--red-500);
45
- }
46
-
47
- &:active,
48
- &:hover {
49
- &,
50
- &:visited {
51
- color: var(--_bl-fc-hover);
52
- }
53
- }
54
-
55
- &:visited {
56
- color: var(--_bl-fc-visited);
57
- }
58
-
59
- &:focus-visible {
60
- .focus-styles(true);
61
- }
62
-
63
- &:focus-visible,
64
- &.focus-inset {
65
- border-radius: var(--br-sm);
66
- }
67
-
68
- background-color: var(--_bl-bg); // [1]
69
- color: var(--_bl-fc);
70
-
71
- border-radius: 0; // [1]
72
- border: none; // [1]
73
- cursor: pointer; // [1]
74
- display: block;
75
- font-family: inherit; // [1]
76
- line-height: inherit; // [1]
77
- padding: var(--su6) var(--su12);
78
- text-align: left; // [1]
79
- width: 100%;
80
- }
81
-
82
- // [1] Normalize for when applying to a button
1
+ a.s-block-link,
2
+ .s-block-link {
3
+ --_bl-bs-color: var(--theme-primary);
4
+ --_bl-bg: transparent;
5
+ --_bl-fc: var(--black-500);
6
+ --_bl-fc-hover: var(--black-600);
7
+ --_bl-fc-visited: var(--_bl-fc);
8
+
9
+ // CONTEXTUAL STYLES
10
+ .dark-mode({
11
+ &.is-selected {
12
+ --_bl-bg: var(--black-100);
13
+ }
14
+ });
15
+
16
+ // STATES
17
+ &.is-selected {
18
+ --_bl-bg: var(--black-150);
19
+ --_bl-fc: var(--black-600);
20
+
21
+ font-weight: bold;
22
+ }
23
+
24
+ // MODIFIERS
25
+ &&__left,
26
+ &&__right {
27
+ &.is-selected {
28
+ &:not(:focus-visible):not(.focus-inset) {
29
+ box-shadow: inset var(--_li-block-bs-offset-x, 3px) 0 0 var(--_bl-bs-color);
30
+ }
31
+ }
32
+ }
33
+
34
+ &&__right {
35
+ &.is-selected {
36
+ --_li-block-bs-offset-x: calc(var(--su-static1) - var(--su-static4)); // -3px
37
+ }
38
+ }
39
+
40
+ // VARIANTS
41
+ &&__danger {
42
+ --_bl-fc: var(--red-400);
43
+ --_bl-fc-hover: var(--red-500);
44
+ --_bl-fc-visited: var(--red-500);
45
+ }
46
+
47
+ &:active,
48
+ &:hover {
49
+ &,
50
+ &:visited {
51
+ color: var(--_bl-fc-hover);
52
+ }
53
+ }
54
+
55
+ &:visited {
56
+ color: var(--_bl-fc-visited);
57
+ }
58
+
59
+ &:focus-visible {
60
+ .focus-styles(true);
61
+ }
62
+
63
+ &:focus-visible,
64
+ &.focus-inset {
65
+ border-radius: var(--br-sm);
66
+ }
67
+
68
+ background-color: var(--_bl-bg); // [1]
69
+ color: var(--_bl-fc);
70
+
71
+ border-radius: 0; // [1]
72
+ border: none; // [1]
73
+ cursor: pointer; // [1]
74
+ display: block;
75
+ font-family: inherit; // [1]
76
+ line-height: inherit; // [1]
77
+ padding: var(--su6) var(--su12);
78
+ text-align: left; // [1]
79
+ width: 100%;
80
+ }
81
+
82
+ // [1] Normalize for when applying to a button
@@ -1,41 +1,41 @@
1
- .s-breadcrumbs {
2
- --_br-divider-px: var(--su4);
3
- --_br-link-fc: var(--fc-light);
4
-
5
- // CONTEXTUAL STYLES
6
- #stacks-internals #screen-sm({
7
- --_br-divider-px: var(--su2);
8
- });
9
-
10
- // CHILD ELEMENTS
11
- & &--divider {
12
- .highcontrast-mode({
13
- color: var(--fc-light);
14
- });
15
-
16
- margin-left: var(--_br-divider-px);
17
- margin-right: var(--_br-divider-px);
18
- }
19
-
20
- & &--item {
21
- align-items: center;
22
- display: flex;
23
- flex-wrap: nowrap;
24
- margin-bottom: var(--su2);
25
- margin-top: var(--su2);
26
- }
27
-
28
- & &--link {
29
- color: var(--_br-link-fc);
30
-
31
- &:hover {
32
- --_br-link-fc: var(--fc-medium);
33
- }
34
- }
35
-
36
- align-items: flex-start;
37
- color: var(--black-300);
38
- display: flex;
39
- flex-wrap: wrap;
40
- font-size: var(--fs-caption);
41
- }
1
+ .s-breadcrumbs {
2
+ --_br-divider-px: var(--su4);
3
+ --_br-link-fc: var(--fc-light);
4
+
5
+ // CONTEXTUAL STYLES
6
+ #stacks-internals #screen-sm({
7
+ --_br-divider-px: var(--su2);
8
+ });
9
+
10
+ // CHILD ELEMENTS
11
+ & &--divider {
12
+ .highcontrast-mode({
13
+ color: var(--fc-light);
14
+ });
15
+
16
+ margin-left: var(--_br-divider-px);
17
+ margin-right: var(--_br-divider-px);
18
+ }
19
+
20
+ & &--item {
21
+ align-items: center;
22
+ display: flex;
23
+ flex-wrap: nowrap;
24
+ margin-bottom: var(--su2);
25
+ margin-top: var(--su2);
26
+ }
27
+
28
+ & &--link {
29
+ color: var(--_br-link-fc);
30
+
31
+ &:hover {
32
+ --_br-link-fc: var(--fc-medium);
33
+ }
34
+ }
35
+
36
+ align-items: flex-start;
37
+ color: var(--black-300);
38
+ display: flex;
39
+ flex-wrap: wrap;
40
+ font-size: var(--fs-caption);
41
+ }