@stackoverflow/stacks 0.76.0 → 1.0.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/LICENSE.MD +9 -9
- package/README.md +0 -0
- package/dist/controllers/index.d.ts +7 -7
- package/dist/controllers/s-expandable-control.d.ts +17 -17
- package/dist/controllers/s-modal.d.ts +97 -97
- package/dist/controllers/s-navigation-tablist.d.ts +36 -36
- package/dist/controllers/s-popover.d.ts +155 -155
- package/dist/controllers/s-table.d.ts +8 -8
- package/dist/controllers/s-tooltip.d.ts +82 -82
- package/dist/controllers/s-uploader.d.ts +48 -48
- package/dist/css/stacks.css +4354 -2560
- package/dist/css/stacks.min.css +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/js/stacks.js +1978 -1978
- package/dist/js/stacks.min.js +1 -1
- package/dist/stacks.d.ts +21 -21
- package/lib/css/atomic/{_stacks-borders.less → borders.less} +30 -30
- package/lib/css/atomic/{_stacks-colors.less → colors.less} +0 -0
- package/lib/css/atomic/{_stacks-flex.less → flex.less} +14 -13
- package/lib/css/atomic/{_stacks-grid.less → grid.less} +11 -11
- package/lib/css/atomic/{_stacks-misc.less → misc.less} +22 -22
- package/lib/css/atomic/spacing.less +332 -0
- package/lib/css/atomic/{_stacks-typography.less → typography.less} +29 -29
- package/lib/css/atomic/width-height.less +194 -0
- package/lib/css/base/{_stacks-body.less → body.less} +2 -2
- package/lib/css/base/{_stacks-configuration-static.less → configuration-static.less} +3 -1
- package/lib/css/base/{_stacks-icons.less → icons.less} +0 -0
- package/lib/css/base/{_stacks-internals.less → internals.less} +0 -0
- package/lib/css/base/{_stacks-reset-meyer.less → reset-meyer.less} +0 -0
- package/lib/css/base/{_stacks-reset-normalize.less → reset-normalize.less} +0 -0
- package/lib/css/base/{_stacks-reset.less → reset.less} +2 -2
- package/lib/css/components/{_stacks-activity-indicator.less → activity-indicator.less} +9 -9
- package/lib/css/components/{_stacks-avatars.less → avatars.less} +40 -40
- package/lib/css/components/{_stacks-badges.less → badges.less} +11 -11
- package/lib/css/components/{_stacks-banners.less → banners.less} +5 -5
- package/lib/css/components/{_stacks-blank-states.less → blank-states.less} +2 -2
- package/lib/css/components/{_stacks-breadcrumbs.less → breadcrumbs.less} +7 -7
- package/lib/css/components/{_stacks-button-groups.less → button-groups.less} +2 -2
- package/lib/css/components/{_stacks-buttons.less → buttons.less} +46 -39
- package/lib/css/components/{_stacks-cards.less → cards.less} +2 -2
- package/lib/css/components/{_stacks-code-blocks.less → code-blocks.less} +8 -8
- package/lib/css/components/{_stacks-collapsible.less → collapsible.less} +0 -0
- package/lib/css/components/{_stacks-inputs.less → inputs.less} +41 -41
- package/lib/css/components/{_stacks-link-previews.less → link-previews.less} +17 -17
- package/lib/css/components/{_stacks-links.less → links.less} +4 -4
- package/lib/css/components/{_stacks-menu.less → menu.less} +5 -5
- package/lib/css/components/{_stacks-modals.less → modals.less} +20 -20
- package/lib/css/components/{_stacks-navigation.less → navigation.less} +12 -12
- package/lib/css/components/{_stacks-notices.less → notices.less} +12 -12
- package/lib/css/components/{_stacks-page-titles.less → page-titles.less} +9 -9
- package/lib/css/components/{_stacks-pagination.less → pagination.less} +8 -8
- package/lib/css/components/{_stacks-popovers.less → popovers.less} +17 -17
- package/lib/css/components/{_stacks-post-summary.less → post-summary.less} +35 -35
- package/lib/css/components/{_stacks-progress-bars.less → progress-bars.less} +29 -30
- package/lib/css/components/{_stacks-prose.less → prose.less} +31 -31
- package/lib/css/components/{_stacks-spinner.less → spinner.less} +14 -14
- package/lib/css/components/{_stacks-tables.less → tables.less} +10 -10
- package/lib/css/components/{_stacks-tags.less → tags.less} +24 -24
- package/lib/css/components/{_stacks-toggle-switches.less → toggle-switches.less} +5 -5
- package/lib/css/components/{_stacks-topbar.less → topbar.less} +22 -20
- package/lib/css/components/{_stacks-uploader.less → uploader.less} +18 -18
- package/lib/css/components/{_stacks-user-cards.less → user-cards.less} +14 -14
- package/lib/css/components/{_stacks-widget-dynamic.less → widget-dynamic.less} +1 -1
- package/lib/css/components/{_stacks-widget-static.less → widget-static.less} +39 -38
- package/lib/css/exports/{_stacks-constants-colors.less → constants-colors.less} +9 -29
- package/lib/css/exports/constants-helpers.less +108 -0
- package/lib/css/exports/constants-type.less +153 -0
- package/lib/css/exports/{_stacks-exports.less → exports.less} +4 -4
- package/lib/css/exports/{_stacks-mixins.less → mixins.less} +18 -1
- package/lib/css/stacks-dynamic.less +12 -12
- package/lib/css/stacks-static.less +38 -38
- package/lib/css/stacks.less +13 -13
- package/package.json +9 -9
- package/lib/css/atomic/_stacks-spacing.less +0 -168
- package/lib/css/atomic/_stacks-width-height.less +0 -195
- package/lib/css/exports/_stacks-constants-helpers.less +0 -139
- package/lib/css/exports/_stacks-constants-type.less +0 -152
package/LICENSE.MD
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright 2017-2020 Stack Exchange Inc.
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
-
|
|
7
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
-
|
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright 2017-2020 Stack Exchange Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { ExpandableController } from './s-expandable-control';
|
|
2
|
-
export { hideModal, ModalController, showModal } from './s-modal';
|
|
3
|
-
export { TabListController } from './s-navigation-tablist';
|
|
4
|
-
export { attachPopover, detachPopover, hidePopover, BasePopoverController, PopoverController, showPopover } from './s-popover';
|
|
5
|
-
export { TableController } from './s-table';
|
|
6
|
-
export { setTooltipHtml, setTooltipText, TooltipController } from './s-tooltip';
|
|
7
|
-
export { UploaderController } from './s-uploader';
|
|
1
|
+
export { ExpandableController } from './s-expandable-control';
|
|
2
|
+
export { hideModal, ModalController, showModal } from './s-modal';
|
|
3
|
+
export { TabListController } from './s-navigation-tablist';
|
|
4
|
+
export { attachPopover, detachPopover, hidePopover, BasePopoverController, PopoverController, showPopover } from './s-popover';
|
|
5
|
+
export { TableController } from './s-table';
|
|
6
|
+
export { setTooltipHtml, setTooltipText, TooltipController } from './s-tooltip';
|
|
7
|
+
export { UploaderController } from './s-uploader';
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import * as Stacks from '../stacks';
|
|
2
|
-
export declare class ExpandableController extends Stacks.StacksController {
|
|
3
|
-
private isCollapsed;
|
|
4
|
-
private events;
|
|
5
|
-
private isCheckable;
|
|
6
|
-
private isRadio;
|
|
7
|
-
private lastKeydownClickTimestamp;
|
|
8
|
-
initialize(): void;
|
|
9
|
-
_isCollapsedForClickable(): boolean;
|
|
10
|
-
_isCollapsedForCheckable(): boolean;
|
|
11
|
-
get controlledCollapsibles(): HTMLElement[];
|
|
12
|
-
_dispatchShowHideEvent(isShow: boolean): void;
|
|
13
|
-
_toggleClass(doAdd: boolean): void;
|
|
14
|
-
listener(e: Event): void;
|
|
15
|
-
connect(): void;
|
|
16
|
-
disconnect(): void;
|
|
17
|
-
}
|
|
1
|
+
import * as Stacks from '../stacks';
|
|
2
|
+
export declare class ExpandableController extends Stacks.StacksController {
|
|
3
|
+
private isCollapsed;
|
|
4
|
+
private events;
|
|
5
|
+
private isCheckable;
|
|
6
|
+
private isRadio;
|
|
7
|
+
private lastKeydownClickTimestamp;
|
|
8
|
+
initialize(): void;
|
|
9
|
+
_isCollapsedForClickable(): boolean;
|
|
10
|
+
_isCollapsedForCheckable(): boolean;
|
|
11
|
+
get controlledCollapsibles(): HTMLElement[];
|
|
12
|
+
_dispatchShowHideEvent(isShow: boolean): void;
|
|
13
|
+
_toggleClass(doAdd: boolean): void;
|
|
14
|
+
listener(e: Event): void;
|
|
15
|
+
connect(): void;
|
|
16
|
+
disconnect(): void;
|
|
17
|
+
}
|
|
@@ -1,97 +1,97 @@
|
|
|
1
|
-
import * as Stacks from "../stacks";
|
|
2
|
-
export declare class ModalController extends Stacks.StacksController {
|
|
3
|
-
static targets: string[];
|
|
4
|
-
private modalTarget;
|
|
5
|
-
private initialFocusTargets;
|
|
6
|
-
private _boundClickFn;
|
|
7
|
-
private _boundKeypressFn;
|
|
8
|
-
private returnElement;
|
|
9
|
-
private _boundTabTrap;
|
|
10
|
-
connect(): void;
|
|
11
|
-
/**
|
|
12
|
-
* Disconnects all added event listeners on controller disconnect
|
|
13
|
-
*/
|
|
14
|
-
disconnect(): void;
|
|
15
|
-
/**
|
|
16
|
-
* Toggles the visibility of the modal
|
|
17
|
-
*/
|
|
18
|
-
toggle(dispatcher?: Event | Element | null): void;
|
|
19
|
-
/**
|
|
20
|
-
* Shows the modal
|
|
21
|
-
*/
|
|
22
|
-
show(dispatcher?: Event | Element | null): void;
|
|
23
|
-
/**
|
|
24
|
-
* Hides the modal
|
|
25
|
-
*/
|
|
26
|
-
hide(dispatcher?: Event | Element | null): void;
|
|
27
|
-
/**
|
|
28
|
-
* Validates the modal settings and attempts to set necessary internal variables
|
|
29
|
-
*/
|
|
30
|
-
private validate;
|
|
31
|
-
/**
|
|
32
|
-
* Toggles the visibility of the modal 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-modal: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 removeModalOnHide;
|
|
44
|
-
/**
|
|
45
|
-
* Gets all elements within the modal that could receive keyboard focus.
|
|
46
|
-
*/
|
|
47
|
-
private getAllTabbables;
|
|
48
|
-
/**
|
|
49
|
-
* Returns the first visible element in an array or `undefined` if no elements are visible.
|
|
50
|
-
*/
|
|
51
|
-
private firstVisible;
|
|
52
|
-
/**
|
|
53
|
-
* Returns the last visible element in an array or `undefined` if no elements are visible.
|
|
54
|
-
*/
|
|
55
|
-
private lastVisible;
|
|
56
|
-
/**
|
|
57
|
-
* Attempts to shift keyboard focus into the modal.
|
|
58
|
-
* If elements with `data-s-modal-target="initialFocus"` are present and visible, one of those will be selected.
|
|
59
|
-
* Otherwise, the first visible focusable element will receive focus.
|
|
60
|
-
*/
|
|
61
|
-
private focusInsideModal;
|
|
62
|
-
/**
|
|
63
|
-
* Returns keyboard focus to the modal if it has left or is about to leave.
|
|
64
|
-
*/
|
|
65
|
-
private keepFocusWithinModal;
|
|
66
|
-
/**
|
|
67
|
-
* Binds global events to the document for hiding popovers on user interaction
|
|
68
|
-
*/
|
|
69
|
-
private bindDocumentEvents;
|
|
70
|
-
/**
|
|
71
|
-
* Unbinds global events to the document for hiding popovers on user interaction
|
|
72
|
-
*/
|
|
73
|
-
private unbindDocumentEvents;
|
|
74
|
-
/**
|
|
75
|
-
* Forces the popover to hide if a user clicks outside of it or its reference element
|
|
76
|
-
*/
|
|
77
|
-
private hideOnOutsideClick;
|
|
78
|
-
/**
|
|
79
|
-
* Forces the popover 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-modal element via external JS
|
|
90
|
-
* @param element the element the `data-controller="s-modal"` attribute is on
|
|
91
|
-
*/
|
|
92
|
-
export declare function showModal(element: HTMLElement): void;
|
|
93
|
-
/**
|
|
94
|
-
* Helper to manually hide an s-modal element via external JS
|
|
95
|
-
* @param element the element the `data-controller="s-modal"` attribute is on
|
|
96
|
-
*/
|
|
97
|
-
export declare function hideModal(element: HTMLElement): void;
|
|
1
|
+
import * as Stacks from "../stacks";
|
|
2
|
+
export declare class ModalController extends Stacks.StacksController {
|
|
3
|
+
static targets: string[];
|
|
4
|
+
private modalTarget;
|
|
5
|
+
private initialFocusTargets;
|
|
6
|
+
private _boundClickFn;
|
|
7
|
+
private _boundKeypressFn;
|
|
8
|
+
private returnElement;
|
|
9
|
+
private _boundTabTrap;
|
|
10
|
+
connect(): void;
|
|
11
|
+
/**
|
|
12
|
+
* Disconnects all added event listeners on controller disconnect
|
|
13
|
+
*/
|
|
14
|
+
disconnect(): void;
|
|
15
|
+
/**
|
|
16
|
+
* Toggles the visibility of the modal
|
|
17
|
+
*/
|
|
18
|
+
toggle(dispatcher?: Event | Element | null): void;
|
|
19
|
+
/**
|
|
20
|
+
* Shows the modal
|
|
21
|
+
*/
|
|
22
|
+
show(dispatcher?: Event | Element | null): void;
|
|
23
|
+
/**
|
|
24
|
+
* Hides the modal
|
|
25
|
+
*/
|
|
26
|
+
hide(dispatcher?: Event | Element | null): void;
|
|
27
|
+
/**
|
|
28
|
+
* Validates the modal settings and attempts to set necessary internal variables
|
|
29
|
+
*/
|
|
30
|
+
private validate;
|
|
31
|
+
/**
|
|
32
|
+
* Toggles the visibility of the modal 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-modal: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 removeModalOnHide;
|
|
44
|
+
/**
|
|
45
|
+
* Gets all elements within the modal that could receive keyboard focus.
|
|
46
|
+
*/
|
|
47
|
+
private getAllTabbables;
|
|
48
|
+
/**
|
|
49
|
+
* Returns the first visible element in an array or `undefined` if no elements are visible.
|
|
50
|
+
*/
|
|
51
|
+
private firstVisible;
|
|
52
|
+
/**
|
|
53
|
+
* Returns the last visible element in an array or `undefined` if no elements are visible.
|
|
54
|
+
*/
|
|
55
|
+
private lastVisible;
|
|
56
|
+
/**
|
|
57
|
+
* Attempts to shift keyboard focus into the modal.
|
|
58
|
+
* If elements with `data-s-modal-target="initialFocus"` are present and visible, one of those will be selected.
|
|
59
|
+
* Otherwise, the first visible focusable element will receive focus.
|
|
60
|
+
*/
|
|
61
|
+
private focusInsideModal;
|
|
62
|
+
/**
|
|
63
|
+
* Returns keyboard focus to the modal if it has left or is about to leave.
|
|
64
|
+
*/
|
|
65
|
+
private keepFocusWithinModal;
|
|
66
|
+
/**
|
|
67
|
+
* Binds global events to the document for hiding popovers on user interaction
|
|
68
|
+
*/
|
|
69
|
+
private bindDocumentEvents;
|
|
70
|
+
/**
|
|
71
|
+
* Unbinds global events to the document for hiding popovers on user interaction
|
|
72
|
+
*/
|
|
73
|
+
private unbindDocumentEvents;
|
|
74
|
+
/**
|
|
75
|
+
* Forces the popover to hide if a user clicks outside of it or its reference element
|
|
76
|
+
*/
|
|
77
|
+
private hideOnOutsideClick;
|
|
78
|
+
/**
|
|
79
|
+
* Forces the popover 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-modal element via external JS
|
|
90
|
+
* @param element the element the `data-controller="s-modal"` attribute is on
|
|
91
|
+
*/
|
|
92
|
+
export declare function showModal(element: HTMLElement): void;
|
|
93
|
+
/**
|
|
94
|
+
* Helper to manually hide an s-modal element via external JS
|
|
95
|
+
* @param element the element the `data-controller="s-modal"` attribute is on
|
|
96
|
+
*/
|
|
97
|
+
export declare function hideModal(element: HTMLElement): void;
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import * as Stacks from "../stacks";
|
|
2
|
-
export declare class TabListController extends Stacks.StacksController {
|
|
3
|
-
private boundSelectTab;
|
|
4
|
-
private boundHandleKeydown;
|
|
5
|
-
connect(): void;
|
|
6
|
-
disconnect(): void;
|
|
7
|
-
/**
|
|
8
|
-
* Gets all tabs within the controller.
|
|
9
|
-
*/
|
|
10
|
-
get tabTargets(): HTMLElement[];
|
|
11
|
-
/**
|
|
12
|
-
* Handles click events on individual tabs, causing them to be selected.
|
|
13
|
-
*/
|
|
14
|
-
selectTab(event: MouseEvent): void;
|
|
15
|
-
/**
|
|
16
|
-
* Handles left and right arrow keydown events on individual tabs,
|
|
17
|
-
* selecting the adjacent tab corresponding to the event.
|
|
18
|
-
*/
|
|
19
|
-
handleKeydown(event: KeyboardEvent): void;
|
|
20
|
-
/**
|
|
21
|
-
* Attempts to switch to a new tab, doing nothing if the tab is already selected or
|
|
22
|
-
* the s-navigation-tablist:select event is prevented.
|
|
23
|
-
*/
|
|
24
|
-
private switchToTab;
|
|
25
|
-
/**
|
|
26
|
-
* Returns the currently selected tab or null if no tabs are selected.
|
|
27
|
-
*/
|
|
28
|
-
get selectedTab(): HTMLElement | null;
|
|
29
|
-
/**
|
|
30
|
-
* Switches the tablist to the provided tab, updating the tabs and panels
|
|
31
|
-
* to reflect the change.
|
|
32
|
-
* @param selectedTab The tab to select. If `null` is provided or the element
|
|
33
|
-
* is not a valid tab, all tabs will be unselected.
|
|
34
|
-
*/
|
|
35
|
-
set selectedTab(selectedTab: HTMLElement | null);
|
|
36
|
-
}
|
|
1
|
+
import * as Stacks from "../stacks";
|
|
2
|
+
export declare class TabListController extends Stacks.StacksController {
|
|
3
|
+
private boundSelectTab;
|
|
4
|
+
private boundHandleKeydown;
|
|
5
|
+
connect(): void;
|
|
6
|
+
disconnect(): void;
|
|
7
|
+
/**
|
|
8
|
+
* Gets all tabs within the controller.
|
|
9
|
+
*/
|
|
10
|
+
get tabTargets(): HTMLElement[];
|
|
11
|
+
/**
|
|
12
|
+
* Handles click events on individual tabs, causing them to be selected.
|
|
13
|
+
*/
|
|
14
|
+
selectTab(event: MouseEvent): void;
|
|
15
|
+
/**
|
|
16
|
+
* Handles left and right arrow keydown events on individual tabs,
|
|
17
|
+
* selecting the adjacent tab corresponding to the event.
|
|
18
|
+
*/
|
|
19
|
+
handleKeydown(event: KeyboardEvent): void;
|
|
20
|
+
/**
|
|
21
|
+
* Attempts to switch to a new tab, doing nothing if the tab is already selected or
|
|
22
|
+
* the s-navigation-tablist:select event is prevented.
|
|
23
|
+
*/
|
|
24
|
+
private switchToTab;
|
|
25
|
+
/**
|
|
26
|
+
* Returns the currently selected tab or null if no tabs are selected.
|
|
27
|
+
*/
|
|
28
|
+
get selectedTab(): HTMLElement | null;
|
|
29
|
+
/**
|
|
30
|
+
* Switches the tablist to the provided tab, updating the tabs and panels
|
|
31
|
+
* to reflect the change.
|
|
32
|
+
* @param selectedTab The tab to select. If `null` is provided or the element
|
|
33
|
+
* is not a valid tab, all tabs will be unselected.
|
|
34
|
+
*/
|
|
35
|
+
set selectedTab(selectedTab: HTMLElement | null);
|
|
36
|
+
}
|
|
@@ -1,155 +1,155 @@
|
|
|
1
|
-
import * as Stacks from "../stacks";
|
|
2
|
-
export declare abstract class BasePopoverController extends Stacks.StacksController {
|
|
3
|
-
private popper;
|
|
4
|
-
protected popoverElement: HTMLElement;
|
|
5
|
-
protected referenceElement: HTMLElement;
|
|
6
|
-
/**
|
|
7
|
-
* An attribute containing the ID of the popover element to render, e.g. aria-controls or aria-describedby.
|
|
8
|
-
*/
|
|
9
|
-
protected abstract popoverSelectorAttribute: string;
|
|
10
|
-
/**
|
|
11
|
-
* Binds events to the document on element show
|
|
12
|
-
*/
|
|
13
|
-
protected abstract bindDocumentEvents(): void;
|
|
14
|
-
/**
|
|
15
|
-
* Unbinds events on the document on element hide
|
|
16
|
-
*/
|
|
17
|
-
protected abstract unbindDocumentEvents(): void;
|
|
18
|
-
/**
|
|
19
|
-
* Returns true if the if the popover is currently visible.
|
|
20
|
-
*/
|
|
21
|
-
get isVisible(): boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Gets whether the element is visible in the browser's viewport.
|
|
24
|
-
*/
|
|
25
|
-
get isInViewport(): boolean;
|
|
26
|
-
protected get shouldHideOnOutsideClick(): boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Initializes and validates controller variables
|
|
29
|
-
*/
|
|
30
|
-
connect(): void;
|
|
31
|
-
/**
|
|
32
|
-
* Cleans up popper.js elements and disconnects all added event listeners
|
|
33
|
-
*/
|
|
34
|
-
disconnect(): void;
|
|
35
|
-
/**
|
|
36
|
-
* Toggles the visibility of the popover
|
|
37
|
-
*/
|
|
38
|
-
toggle(dispatcher?: Event | Element | null): void;
|
|
39
|
-
/**
|
|
40
|
-
* Shows the popover if not already visible
|
|
41
|
-
*/
|
|
42
|
-
show(dispatcher?: Event | Element | null): void;
|
|
43
|
-
/**
|
|
44
|
-
* Hides the popover if not already hidden
|
|
45
|
-
*/
|
|
46
|
-
hide(dispatcher?: Event | Element | null): void;
|
|
47
|
-
/**
|
|
48
|
-
* Binds document events for this popover and fires the shown event
|
|
49
|
-
*/
|
|
50
|
-
protected shown(dispatcher?: Element | null): void;
|
|
51
|
-
/**
|
|
52
|
-
* Unbinds document events for this popover and fires the hidden event
|
|
53
|
-
*/
|
|
54
|
-
protected hidden(dispatcher?: Element | null): void;
|
|
55
|
-
/**
|
|
56
|
-
* Generates the popover if not found during initialization
|
|
57
|
-
*/
|
|
58
|
-
protected generatePopover(): HTMLElement | null;
|
|
59
|
-
/**
|
|
60
|
-
* Initializes the Popper for this instance
|
|
61
|
-
*/
|
|
62
|
-
private initializePopper;
|
|
63
|
-
/**
|
|
64
|
-
* Validates the popover settings and attempts to set necessary internal variables
|
|
65
|
-
*/
|
|
66
|
-
private validate;
|
|
67
|
-
/**
|
|
68
|
-
* Determines the correct dispatching element from a potential input
|
|
69
|
-
* @param dispatcher The event or element to get the dispatcher from
|
|
70
|
-
*/
|
|
71
|
-
protected getDispatcher(dispatcher?: Event | Element | null): Element;
|
|
72
|
-
/**
|
|
73
|
-
* Schedules the popover to update on the next animation frame if visible
|
|
74
|
-
*/
|
|
75
|
-
protected scheduleUpdate(): void;
|
|
76
|
-
}
|
|
77
|
-
export declare class PopoverController extends BasePopoverController {
|
|
78
|
-
static targets: never[];
|
|
79
|
-
protected popoverSelectorAttribute: string;
|
|
80
|
-
private boundHideOnOutsideClick;
|
|
81
|
-
private boundHideOnEscapePress;
|
|
82
|
-
/**
|
|
83
|
-
* Toggles optional classes in addition to BasePopoverController.shown
|
|
84
|
-
*/
|
|
85
|
-
protected shown(dispatcher?: Element | null): void;
|
|
86
|
-
/**
|
|
87
|
-
* Toggles optional classes in addition to BasePopoverController.hidden
|
|
88
|
-
*/
|
|
89
|
-
protected hidden(dispatcher?: Element | null): void;
|
|
90
|
-
/**
|
|
91
|
-
* Binds global events to the document for hiding popovers on user interaction
|
|
92
|
-
*/
|
|
93
|
-
protected bindDocumentEvents(): void;
|
|
94
|
-
/**
|
|
95
|
-
* Unbinds global events to the document for hiding popovers on user interaction
|
|
96
|
-
*/
|
|
97
|
-
protected unbindDocumentEvents(): void;
|
|
98
|
-
/**
|
|
99
|
-
* Forces the popover to hide if a user clicks outside of it or its reference element
|
|
100
|
-
* @param {Event} e - The document click event
|
|
101
|
-
*/
|
|
102
|
-
private hideOnOutsideClick;
|
|
103
|
-
/**
|
|
104
|
-
* Forces the popover to hide if the user presses escape while it, one of its childen, or the reference element are focused
|
|
105
|
-
* @param {Event} e - The document keyup event
|
|
106
|
-
*/
|
|
107
|
-
private hideOnEscapePress;
|
|
108
|
-
/**
|
|
109
|
-
* Toggles all classes on the originating element based on the `class-toggle` data
|
|
110
|
-
* @param {boolean=} show - A boolean indicating whether this is being triggered by a show or hide.
|
|
111
|
-
*/
|
|
112
|
-
private toggleOptionalClasses;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Helper to manually show an s-popover element via external JS
|
|
116
|
-
* @param element the element the `data-controller="s-popover"` attribute is on
|
|
117
|
-
*/
|
|
118
|
-
export declare function showPopover(element: HTMLElement): void;
|
|
119
|
-
/**
|
|
120
|
-
* Helper to manually hide an s-popover element via external JS
|
|
121
|
-
* @param element the element the `data-controller="s-popover"` attribute is on
|
|
122
|
-
*/
|
|
123
|
-
export declare function hidePopover(element: Element): void;
|
|
124
|
-
/**
|
|
125
|
-
* Options to use when attaching a popover via `Stacks.attachPopover`.
|
|
126
|
-
* @see Stacks.attachPopover
|
|
127
|
-
*/
|
|
128
|
-
export interface PopoverOptions {
|
|
129
|
-
/**
|
|
130
|
-
* When true, the `click->s-popover#toggle` action will be attached to the controller element or reference element.
|
|
131
|
-
*/
|
|
132
|
-
toggleOnClick?: boolean;
|
|
133
|
-
/**
|
|
134
|
-
* When set, `data-s-popover-placement` will be set to this value on the controller element.
|
|
135
|
-
*/
|
|
136
|
-
placement?: string;
|
|
137
|
-
/**
|
|
138
|
-
* When true, the popover will appear immediately when the controller connects.
|
|
139
|
-
*/
|
|
140
|
-
autoShow?: boolean;
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Attaches a popover to an element and performs additional configuration.
|
|
144
|
-
* @param element the element that will receive the `data-controller="s-popover"` attribute.
|
|
145
|
-
* @param popover an element with the `.s-popover` class or HTML string containing a single element with the `.s-popover` class.
|
|
146
|
-
* If the popover does not have a parent element, it will be inserted as a immediately after the reference element.
|
|
147
|
-
* @param options an optional collection of options to use when configuring the popover.
|
|
148
|
-
*/
|
|
149
|
-
export declare function attachPopover(element: Element, popover: Element | string, options?: PopoverOptions): void;
|
|
150
|
-
/**
|
|
151
|
-
* Removes the popover controller from an element and removes the popover from the DOM.
|
|
152
|
-
* @param element the element that has the `data-controller="s-popover"` attribute.
|
|
153
|
-
* @returns The popover that was attached to the element.
|
|
154
|
-
*/
|
|
155
|
-
export declare function detachPopover(element: Element): HTMLElement | null;
|
|
1
|
+
import * as Stacks from "../stacks";
|
|
2
|
+
export declare abstract class BasePopoverController extends Stacks.StacksController {
|
|
3
|
+
private popper;
|
|
4
|
+
protected popoverElement: HTMLElement;
|
|
5
|
+
protected referenceElement: HTMLElement;
|
|
6
|
+
/**
|
|
7
|
+
* An attribute containing the ID of the popover element to render, e.g. aria-controls or aria-describedby.
|
|
8
|
+
*/
|
|
9
|
+
protected abstract popoverSelectorAttribute: string;
|
|
10
|
+
/**
|
|
11
|
+
* Binds events to the document on element show
|
|
12
|
+
*/
|
|
13
|
+
protected abstract bindDocumentEvents(): void;
|
|
14
|
+
/**
|
|
15
|
+
* Unbinds events on the document on element hide
|
|
16
|
+
*/
|
|
17
|
+
protected abstract unbindDocumentEvents(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Returns true if the if the popover is currently visible.
|
|
20
|
+
*/
|
|
21
|
+
get isVisible(): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Gets whether the element is visible in the browser's viewport.
|
|
24
|
+
*/
|
|
25
|
+
get isInViewport(): boolean;
|
|
26
|
+
protected get shouldHideOnOutsideClick(): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Initializes and validates controller variables
|
|
29
|
+
*/
|
|
30
|
+
connect(): void;
|
|
31
|
+
/**
|
|
32
|
+
* Cleans up popper.js elements and disconnects all added event listeners
|
|
33
|
+
*/
|
|
34
|
+
disconnect(): void;
|
|
35
|
+
/**
|
|
36
|
+
* Toggles the visibility of the popover
|
|
37
|
+
*/
|
|
38
|
+
toggle(dispatcher?: Event | Element | null): void;
|
|
39
|
+
/**
|
|
40
|
+
* Shows the popover if not already visible
|
|
41
|
+
*/
|
|
42
|
+
show(dispatcher?: Event | Element | null): void;
|
|
43
|
+
/**
|
|
44
|
+
* Hides the popover if not already hidden
|
|
45
|
+
*/
|
|
46
|
+
hide(dispatcher?: Event | Element | null): void;
|
|
47
|
+
/**
|
|
48
|
+
* Binds document events for this popover and fires the shown event
|
|
49
|
+
*/
|
|
50
|
+
protected shown(dispatcher?: Element | null): void;
|
|
51
|
+
/**
|
|
52
|
+
* Unbinds document events for this popover and fires the hidden event
|
|
53
|
+
*/
|
|
54
|
+
protected hidden(dispatcher?: Element | null): void;
|
|
55
|
+
/**
|
|
56
|
+
* Generates the popover if not found during initialization
|
|
57
|
+
*/
|
|
58
|
+
protected generatePopover(): HTMLElement | null;
|
|
59
|
+
/**
|
|
60
|
+
* Initializes the Popper for this instance
|
|
61
|
+
*/
|
|
62
|
+
private initializePopper;
|
|
63
|
+
/**
|
|
64
|
+
* Validates the popover settings and attempts to set necessary internal variables
|
|
65
|
+
*/
|
|
66
|
+
private validate;
|
|
67
|
+
/**
|
|
68
|
+
* Determines the correct dispatching element from a potential input
|
|
69
|
+
* @param dispatcher The event or element to get the dispatcher from
|
|
70
|
+
*/
|
|
71
|
+
protected getDispatcher(dispatcher?: Event | Element | null): Element;
|
|
72
|
+
/**
|
|
73
|
+
* Schedules the popover to update on the next animation frame if visible
|
|
74
|
+
*/
|
|
75
|
+
protected scheduleUpdate(): void;
|
|
76
|
+
}
|
|
77
|
+
export declare class PopoverController extends BasePopoverController {
|
|
78
|
+
static targets: never[];
|
|
79
|
+
protected popoverSelectorAttribute: string;
|
|
80
|
+
private boundHideOnOutsideClick;
|
|
81
|
+
private boundHideOnEscapePress;
|
|
82
|
+
/**
|
|
83
|
+
* Toggles optional classes in addition to BasePopoverController.shown
|
|
84
|
+
*/
|
|
85
|
+
protected shown(dispatcher?: Element | null): void;
|
|
86
|
+
/**
|
|
87
|
+
* Toggles optional classes in addition to BasePopoverController.hidden
|
|
88
|
+
*/
|
|
89
|
+
protected hidden(dispatcher?: Element | null): void;
|
|
90
|
+
/**
|
|
91
|
+
* Binds global events to the document for hiding popovers on user interaction
|
|
92
|
+
*/
|
|
93
|
+
protected bindDocumentEvents(): void;
|
|
94
|
+
/**
|
|
95
|
+
* Unbinds global events to the document for hiding popovers on user interaction
|
|
96
|
+
*/
|
|
97
|
+
protected unbindDocumentEvents(): void;
|
|
98
|
+
/**
|
|
99
|
+
* Forces the popover to hide if a user clicks outside of it or its reference element
|
|
100
|
+
* @param {Event} e - The document click event
|
|
101
|
+
*/
|
|
102
|
+
private hideOnOutsideClick;
|
|
103
|
+
/**
|
|
104
|
+
* Forces the popover to hide if the user presses escape while it, one of its childen, or the reference element are focused
|
|
105
|
+
* @param {Event} e - The document keyup event
|
|
106
|
+
*/
|
|
107
|
+
private hideOnEscapePress;
|
|
108
|
+
/**
|
|
109
|
+
* Toggles all classes on the originating element based on the `class-toggle` data
|
|
110
|
+
* @param {boolean=} show - A boolean indicating whether this is being triggered by a show or hide.
|
|
111
|
+
*/
|
|
112
|
+
private toggleOptionalClasses;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Helper to manually show an s-popover element via external JS
|
|
116
|
+
* @param element the element the `data-controller="s-popover"` attribute is on
|
|
117
|
+
*/
|
|
118
|
+
export declare function showPopover(element: HTMLElement): void;
|
|
119
|
+
/**
|
|
120
|
+
* Helper to manually hide an s-popover element via external JS
|
|
121
|
+
* @param element the element the `data-controller="s-popover"` attribute is on
|
|
122
|
+
*/
|
|
123
|
+
export declare function hidePopover(element: Element): void;
|
|
124
|
+
/**
|
|
125
|
+
* Options to use when attaching a popover via `Stacks.attachPopover`.
|
|
126
|
+
* @see Stacks.attachPopover
|
|
127
|
+
*/
|
|
128
|
+
export interface PopoverOptions {
|
|
129
|
+
/**
|
|
130
|
+
* When true, the `click->s-popover#toggle` action will be attached to the controller element or reference element.
|
|
131
|
+
*/
|
|
132
|
+
toggleOnClick?: boolean;
|
|
133
|
+
/**
|
|
134
|
+
* When set, `data-s-popover-placement` will be set to this value on the controller element.
|
|
135
|
+
*/
|
|
136
|
+
placement?: string;
|
|
137
|
+
/**
|
|
138
|
+
* When true, the popover will appear immediately when the controller connects.
|
|
139
|
+
*/
|
|
140
|
+
autoShow?: boolean;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Attaches a popover to an element and performs additional configuration.
|
|
144
|
+
* @param element the element that will receive the `data-controller="s-popover"` attribute.
|
|
145
|
+
* @param popover an element with the `.s-popover` class or HTML string containing a single element with the `.s-popover` class.
|
|
146
|
+
* If the popover does not have a parent element, it will be inserted as a immediately after the reference element.
|
|
147
|
+
* @param options an optional collection of options to use when configuring the popover.
|
|
148
|
+
*/
|
|
149
|
+
export declare function attachPopover(element: Element, popover: Element | string, options?: PopoverOptions): void;
|
|
150
|
+
/**
|
|
151
|
+
* Removes the popover controller from an element and removes the popover from the DOM.
|
|
152
|
+
* @param element the element that has the `data-controller="s-popover"` attribute.
|
|
153
|
+
* @returns The popover that was attached to the element.
|
|
154
|
+
*/
|
|
155
|
+
export declare function detachPopover(element: Element): HTMLElement | null;
|