@stackoverflow/stacks 1.6.7 → 1.7.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 CHANGED
@@ -24,6 +24,7 @@ Stacks documentation can be found at https://stackoverflow.design/
24
24
  - [Building Stacks](#building-stacks)
25
25
  - [Linting Stacks](#linting-stacks)
26
26
  - [Testing Stacks](#testing-stacks)
27
+ - [Releasing Stacks](#release-a-new-version-of-stacks)
27
28
  - [Bugs and feature requests](#bugs-and-feature-requests)
28
29
  - [Contributing](#contributing)
29
30
  - [License](#license)
@@ -99,6 +100,44 @@ npm run test:visual:update
99
100
 
100
101
  Failing tests (including diffs) can be found under `screenshots/[browser]/failed/` folders.
101
102
 
103
+ ## Releasing a new version of Stacks
104
+ Stacks uses [Semantic Versioning](https://semver.org/), is distributed via [npm](https://www.npmjs.com/package/@stackoverflow/stacks), and publishes [release notes on Github](https://github.com/StackExchange/Stacks/releases). Follow the steps below to release a new version of Stacks.
105
+
106
+ ### Bump the version number
107
+ ```sh
108
+ npm version [major | minor | patch]
109
+ ```
110
+
111
+ ### Push the new tag
112
+ ```sh
113
+ git push && git push --tags
114
+ ```
115
+
116
+ ### Create release notes [on Github](https://github.com/StackExchange/Stacks/releases/new)
117
+
118
+ 1. Visit https://github.com/StackExchange/Stacks/releases/new
119
+ 1. Choose your new version from the "Choose a tag" dropdown
120
+ 1. Click "Generate release notes"
121
+ 1. Cleanup and complete the release notes
122
+ - Prominently mention any breaking changes, if applicable
123
+ - Include a "What's Changed" section in the release notes
124
+ - Mention significant bug fixes
125
+ - Mention new features
126
+ - Mention significant under-the-hood changes that could impact consumers
127
+
128
+ ### Ship your newly created version to [npm](https://www.npmjs.com/package/@stackoverflow/stacks)
129
+ ```sh
130
+ npm publish
131
+ ```
132
+
133
+ ### Merge `develop` into `production` and push
134
+ ```sh
135
+ git checkout production && git merge develop && git push
136
+ ```
137
+
138
+ ### Push the updated docs site
139
+ Head to [Netlify](https://app.netlify.com), navigate to the Stacks overview, click on "Production deploys", and select "Deploy site" from the "Trigger deploy" dropdown.
140
+
102
141
  ## Bugs and feature requests
103
142
  Have a bug or feature request? First search existing or closed issues to make sure the issue hasn’t been noted yet. If not, review our [issue guidelines](/CONTRIBUTING.md#open-an-issue) for submitting [a bug report](/CONTRIBUTING.md#reporting-bugs) or [feature request](/CONTRIBUTING.md#feature-requests).
104
143
 
@@ -1,5 +1,7 @@
1
1
  export { ExpandableController } from "./s-expandable-control";
2
2
  export { hideModal, ModalController, showModal } from "./s-modal";
3
+ export { hideBanner, BannerController, showBanner } from "./s-banner";
4
+ export { hideToast, ToastController, showToast } from "./s-toast";
3
5
  export { TabListController } from "./s-navigation-tablist";
4
6
  export { attachPopover, detachPopover, hidePopover, BasePopoverController, PopoverController, showPopover, } from "./s-popover";
5
7
  export { TableController } from "./s-table";
@@ -0,0 +1,41 @@
1
+ import * as Stacks from "../stacks";
2
+ export declare class BannerController extends Stacks.StacksController {
3
+ static targets: string[];
4
+ readonly bannerTarget: HTMLElement;
5
+ /**
6
+ * Toggles the visibility of the banner
7
+ */
8
+ toggle(dispatcher?: Event | Element | null): void;
9
+ /**
10
+ * Shows the banner
11
+ */
12
+ show(dispatcher?: Event | Element | null): void;
13
+ /**
14
+ * Hides the banner
15
+ */
16
+ hide(dispatcher?: Event | Element | null): void;
17
+ /**
18
+ * Toggles the visibility of the banner element
19
+ * @param show Optional parameter that force shows/hides the element or toggles it if left undefined
20
+ */
21
+ private _toggle;
22
+ /**
23
+ * Remove the element on hide if the `remove-when-hidden` flag is set
24
+ */
25
+ private removeBannerOnHide;
26
+ /**
27
+ * Determines the correct dispatching element from a potential input
28
+ * @param dispatcher The event or element to get the dispatcher from
29
+ */
30
+ private getDispatcher;
31
+ }
32
+ /**
33
+ * Helper to manually show an s-banner element via external JS
34
+ * @param element the element the `data-controller="s-banner"` attribute is on
35
+ */
36
+ export declare function showBanner(element: HTMLElement): void;
37
+ /**
38
+ * Helper to manually hide an s-banner element via external JS
39
+ * @param element the element the `data-controller="s-banner"` attribute is on
40
+ */
41
+ export declare function hideBanner(element: HTMLElement): void;
@@ -0,0 +1,97 @@
1
+ import * as Stacks from "../stacks";
2
+ export declare class ToastController extends Stacks.StacksController {
3
+ static targets: string[];
4
+ readonly toastTarget: HTMLElement;
5
+ readonly initialFocusTargets: HTMLElement[];
6
+ private _boundClickFn;
7
+ private _boundKeypressFn;
8
+ private activeTimeout;
9
+ private returnElement;
10
+ connect(): void;
11
+ /**
12
+ * Disconnects all added event listeners on controller disconnect
13
+ */
14
+ disconnect(): void;
15
+ /**
16
+ * Toggles the visibility of the toast
17
+ */
18
+ toggle(dispatcher?: Event | Element | null): void;
19
+ /**
20
+ * Shows the toast
21
+ */
22
+ show(dispatcher?: Event | Element | null): void;
23
+ /**
24
+ * Hides the toast
25
+ */
26
+ hide(dispatcher?: Event | Element | null): void;
27
+ /**
28
+ * Validates the toast settings and attempts to set necessary internal variables
29
+ */
30
+ private validate;
31
+ /**
32
+ * Toggles the visibility of the toast element
33
+ * @param show Optional parameter that force shows/hides the element or toggles it if left undefined
34
+ */
35
+ private _toggle;
36
+ /**
37
+ * Listens for the s-toast:hidden event and focuses the returnElement when it is fired
38
+ */
39
+ private focusReturnElement;
40
+ /**
41
+ * Remove the element on hide if the `remove-when-hidden` flag is set
42
+ */
43
+ private removeToastOnHide;
44
+ /**
45
+ * Hide the element after a delay
46
+ */
47
+ private hideAfterTimeout;
48
+ /**
49
+ * Cancels the activeTimeout
50
+ */
51
+ clearActiveTimeout(): void;
52
+ /**
53
+ * Gets all elements within the toast that could receive keyboard focus.
54
+ */
55
+ private getAllTabbables;
56
+ /**
57
+ * Returns the first visible element in an array or `undefined` if no elements are visible.
58
+ */
59
+ private firstVisible;
60
+ /**
61
+ * Attempts to shift keyboard focus into the toast.
62
+ * If elements with `data-s-toast-target="initialFocus"` are present and visible, one of those will be selected.
63
+ * Otherwise, the first visible focusable element will receive focus.
64
+ */
65
+ private focusInsideToast;
66
+ /**
67
+ * Binds global events to the document for hiding toasts on user interaction
68
+ */
69
+ private bindDocumentEvents;
70
+ /**
71
+ * Unbinds global events to the document for hiding toasts on user interaction
72
+ */
73
+ private unbindDocumentEvents;
74
+ /**
75
+ * Forces the toast to hide if a user clicks outside of it or its reference element
76
+ */
77
+ private hideOnOutsideClick;
78
+ /**
79
+ * Forces the toast to hide if the user presses escape while it, one of its childen, or the reference element are focused
80
+ */
81
+ private hideOnEscapePress;
82
+ /**
83
+ * Determines the correct dispatching element from a potential input
84
+ * @param dispatcher The event or element to get the dispatcher from
85
+ */
86
+ private getDispatcher;
87
+ }
88
+ /**
89
+ * Helper to manually show an s-toast element via external JS
90
+ * @param element the element the `data-controller="s-toast"` attribute is on
91
+ */
92
+ export declare function showToast(element: HTMLElement): void;
93
+ /**
94
+ * Helper to manually hide an s-toast element via external JS
95
+ * @param element the element the `data-controller="s-toast"` attribute is on
96
+ */
97
+ export declare function hideToast(element: HTMLElement): void;