@stackoverflow/stacks 0.76.0 → 1.0.0-beta.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.
- package/LICENSE.MD +9 -9
- package/README.md +47 -47
- 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 +4321 -2635
- 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} +378 -378
- package/lib/css/atomic/{_stacks-colors.less → colors.less} +209 -209
- package/lib/css/atomic/{_stacks-flex.less → flex.less} +375 -374
- package/lib/css/atomic/{_stacks-grid.less → grid.less} +174 -174
- package/lib/css/atomic/{_stacks-misc.less → misc.less} +343 -343
- package/lib/css/atomic/spacing.less +314 -0
- package/lib/css/atomic/{_stacks-typography.less → typography.less} +273 -273
- package/lib/css/atomic/width-height.less +194 -0
- package/lib/css/base/{_stacks-body.less → body.less} +44 -44
- package/lib/css/base/{_stacks-configuration-static.less → configuration-static.less} +61 -59
- package/lib/css/base/{_stacks-icons.less → icons.less} +20 -20
- package/lib/css/base/{_stacks-internals.less → internals.less} +220 -220
- package/lib/css/base/{_stacks-reset-meyer.less → reset-meyer.less} +64 -64
- package/lib/css/base/{_stacks-reset-normalize.less → reset-normalize.less} +449 -449
- package/lib/css/base/{_stacks-reset.less → reset.less} +20 -20
- package/lib/css/components/{_stacks-activity-indicator.less → activity-indicator.less} +45 -45
- package/lib/css/components/{_stacks-avatars.less → avatars.less} +189 -189
- package/lib/css/components/{_stacks-badges.less → badges.less} +209 -209
- package/lib/css/components/{_stacks-banners.less → banners.less} +80 -80
- package/lib/css/components/{_stacks-blank-states.less → blank-states.less} +26 -26
- package/lib/css/components/{_stacks-breadcrumbs.less → breadcrumbs.less} +44 -44
- package/lib/css/components/{_stacks-button-groups.less → button-groups.less} +104 -104
- package/lib/css/components/{_stacks-buttons.less → buttons.less} +665 -658
- package/lib/css/components/{_stacks-cards.less → cards.less} +44 -44
- package/lib/css/components/{_stacks-code-blocks.less → code-blocks.less} +130 -130
- package/lib/css/components/{_stacks-collapsible.less → collapsible.less} +104 -104
- package/lib/css/components/{_stacks-inputs.less → inputs.less} +728 -728
- package/lib/css/components/{_stacks-link-previews.less → link-previews.less} +136 -136
- package/lib/css/components/{_stacks-links.less → links.less} +218 -218
- package/lib/css/components/{_stacks-menu.less → menu.less} +47 -47
- package/lib/css/components/{_stacks-modals.less → modals.less} +133 -133
- package/lib/css/components/{_stacks-navigation.less → navigation.less} +146 -146
- package/lib/css/components/{_stacks-notices.less → notices.less} +233 -233
- package/lib/css/components/{_stacks-page-titles.less → page-titles.less} +60 -60
- package/lib/css/components/{_stacks-pagination.less → pagination.less} +55 -55
- package/lib/css/components/{_stacks-popovers.less → popovers.less} +197 -197
- package/lib/css/components/{_stacks-post-summary.less → post-summary.less} +425 -425
- package/lib/css/components/{_stacks-progress-bars.less → progress-bars.less} +330 -331
- package/lib/css/components/{_stacks-prose.less → prose.less} +503 -503
- package/lib/css/components/{_stacks-spinner.less → spinner.less} +107 -107
- package/lib/css/components/{_stacks-tables.less → tables.less} +341 -341
- package/lib/css/components/{_stacks-tags.less → tags.less} +236 -236
- package/lib/css/components/{_stacks-toggle-switches.less → toggle-switches.less} +144 -144
- package/lib/css/components/{_stacks-topbar.less → topbar.less} +427 -425
- package/lib/css/components/{_stacks-uploader.less → uploader.less} +210 -210
- package/lib/css/components/{_stacks-user-cards.less → user-cards.less} +169 -169
- package/lib/css/components/{_stacks-widget-dynamic.less → widget-dynamic.less} +33 -33
- package/lib/css/components/{_stacks-widget-static.less → widget-static.less} +273 -272
- package/lib/css/exports/{_stacks-constants-colors.less → constants-colors.less} +1092 -1112
- package/lib/css/exports/constants-helpers.less +108 -0
- package/lib/css/exports/{_stacks-constants-type.less → constants-type.less} +153 -152
- package/lib/css/exports/{_stacks-exports.less → exports.less} +15 -15
- package/lib/css/exports/{_stacks-mixins.less → mixins.less} +237 -220
- package/lib/css/stacks-dynamic.less +35 -35
- package/lib/css/stacks-static.less +86 -86
- package/lib/ts/controllers/index.ts +7 -7
- package/lib/ts/controllers/s-expandable-control.ts +188 -188
- package/lib/ts/controllers/s-modal.ts +321 -321
- package/lib/ts/controllers/s-navigation-tablist.ts +117 -117
- package/lib/ts/controllers/s-popover.ts +547 -547
- package/lib/ts/controllers/s-table.ts +220 -220
- package/lib/ts/controllers/s-tooltip.ts +246 -246
- package/lib/ts/controllers/s-uploader.ts +172 -172
- package/lib/ts/index.ts +20 -20
- package/lib/ts/stacks.ts +88 -88
- package/lib/tsconfig.json +13 -13
- package/package.json +87 -87
- 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
|
@@ -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;
|
|
@@ -1,8 +1,8 @@
|
|
|
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
|
+
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,82 +1,82 @@
|
|
|
1
|
-
import { BasePopoverController } from "./s-popover";
|
|
2
|
-
export interface TooltipOptions {
|
|
3
|
-
placement: string;
|
|
4
|
-
}
|
|
5
|
-
export declare class TooltipController extends BasePopoverController {
|
|
6
|
-
static targets: never[];
|
|
7
|
-
protected popoverSelectorAttribute: string;
|
|
8
|
-
private boundScheduleShow;
|
|
9
|
-
private boundHide;
|
|
10
|
-
private boundHideIfWithin;
|
|
11
|
-
private activeTimeout;
|
|
12
|
-
/**
|
|
13
|
-
* Binds mouseover and mouseout events in addition to BasePopoverController.connect
|
|
14
|
-
*/
|
|
15
|
-
connect(): void;
|
|
16
|
-
/**
|
|
17
|
-
* Unbinds mouse events in addition to BasePopoverController.disconnect
|
|
18
|
-
*/
|
|
19
|
-
disconnect(): void;
|
|
20
|
-
/**
|
|
21
|
-
* Attempts to show the tooltip popover so long as no other Stacks-managed popover is
|
|
22
|
-
* present on the page.
|
|
23
|
-
*/
|
|
24
|
-
show(dispatcher?: Event | Element | null): void;
|
|
25
|
-
/**
|
|
26
|
-
* Sets up a tooltip popover show after a delay.
|
|
27
|
-
*/
|
|
28
|
-
scheduleShow(dispatcher?: Event | Element | null): void;
|
|
29
|
-
/**
|
|
30
|
-
* Cancels the scheduled tooltip popover display and hides it if already displayed
|
|
31
|
-
*/
|
|
32
|
-
hide(dispatcher?: Event | Element | null): void;
|
|
33
|
-
/**
|
|
34
|
-
* Applies data-s-tooltip-html-title and title attributes.
|
|
35
|
-
*/
|
|
36
|
-
applyTitleAttributes(): HTMLElement | null;
|
|
37
|
-
/**
|
|
38
|
-
* Automatically hides the tooltip popover when a Stacks popover is shown anywhere on
|
|
39
|
-
* the page.
|
|
40
|
-
*/
|
|
41
|
-
protected bindDocumentEvents(): void;
|
|
42
|
-
/**
|
|
43
|
-
* Unbinds all mouse events
|
|
44
|
-
*/
|
|
45
|
-
protected unbindDocumentEvents(): void;
|
|
46
|
-
/**
|
|
47
|
-
* Attempts to generate a new tooltip popover from the title attribute if no popover
|
|
48
|
-
* was present when requested, otherwise throws an error.
|
|
49
|
-
*/
|
|
50
|
-
protected generatePopover(): HTMLElement | null;
|
|
51
|
-
/**
|
|
52
|
-
* Hides the tooltip if is or is within the event's target.
|
|
53
|
-
* @param event An event object from s-popover:shown
|
|
54
|
-
*/
|
|
55
|
-
private hideIfWithin;
|
|
56
|
-
/**
|
|
57
|
-
* Binds mouse events to show/hide on reference element hover
|
|
58
|
-
*/
|
|
59
|
-
private bindMouseEvents;
|
|
60
|
-
/**
|
|
61
|
-
* Unbinds all mouse events
|
|
62
|
-
*/
|
|
63
|
-
private unbindMouseEvents;
|
|
64
|
-
/**
|
|
65
|
-
* Generates an ID for tooltips created with setTooltip.
|
|
66
|
-
*/
|
|
67
|
-
private static generateId;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Adds or updates a Stacks tooltip on a given element, initializing the controller if necessary
|
|
71
|
-
* @param element The element to add a tooltip to.
|
|
72
|
-
* @param html An HTML string to populate the tooltip with.
|
|
73
|
-
* @param options Options for rendering the tooltip.
|
|
74
|
-
*/
|
|
75
|
-
export declare function setTooltipHtml(element: Element, html: string, options?: TooltipOptions): void;
|
|
76
|
-
/**
|
|
77
|
-
* Adds or updates a Stacks tooltip on a given element, initializing the controller if necessary
|
|
78
|
-
* @param element The element to add a tooltip to.
|
|
79
|
-
* @param text A plain text string to populate the tooltip with.
|
|
80
|
-
* @param options Options for rendering the tooltip.
|
|
81
|
-
*/
|
|
82
|
-
export declare function setTooltipText(element: Element, text: string, options?: TooltipOptions): void;
|
|
1
|
+
import { BasePopoverController } from "./s-popover";
|
|
2
|
+
export interface TooltipOptions {
|
|
3
|
+
placement: string;
|
|
4
|
+
}
|
|
5
|
+
export declare class TooltipController extends BasePopoverController {
|
|
6
|
+
static targets: never[];
|
|
7
|
+
protected popoverSelectorAttribute: string;
|
|
8
|
+
private boundScheduleShow;
|
|
9
|
+
private boundHide;
|
|
10
|
+
private boundHideIfWithin;
|
|
11
|
+
private activeTimeout;
|
|
12
|
+
/**
|
|
13
|
+
* Binds mouseover and mouseout events in addition to BasePopoverController.connect
|
|
14
|
+
*/
|
|
15
|
+
connect(): void;
|
|
16
|
+
/**
|
|
17
|
+
* Unbinds mouse events in addition to BasePopoverController.disconnect
|
|
18
|
+
*/
|
|
19
|
+
disconnect(): void;
|
|
20
|
+
/**
|
|
21
|
+
* Attempts to show the tooltip popover so long as no other Stacks-managed popover is
|
|
22
|
+
* present on the page.
|
|
23
|
+
*/
|
|
24
|
+
show(dispatcher?: Event | Element | null): void;
|
|
25
|
+
/**
|
|
26
|
+
* Sets up a tooltip popover show after a delay.
|
|
27
|
+
*/
|
|
28
|
+
scheduleShow(dispatcher?: Event | Element | null): void;
|
|
29
|
+
/**
|
|
30
|
+
* Cancels the scheduled tooltip popover display and hides it if already displayed
|
|
31
|
+
*/
|
|
32
|
+
hide(dispatcher?: Event | Element | null): void;
|
|
33
|
+
/**
|
|
34
|
+
* Applies data-s-tooltip-html-title and title attributes.
|
|
35
|
+
*/
|
|
36
|
+
applyTitleAttributes(): HTMLElement | null;
|
|
37
|
+
/**
|
|
38
|
+
* Automatically hides the tooltip popover when a Stacks popover is shown anywhere on
|
|
39
|
+
* the page.
|
|
40
|
+
*/
|
|
41
|
+
protected bindDocumentEvents(): void;
|
|
42
|
+
/**
|
|
43
|
+
* Unbinds all mouse events
|
|
44
|
+
*/
|
|
45
|
+
protected unbindDocumentEvents(): void;
|
|
46
|
+
/**
|
|
47
|
+
* Attempts to generate a new tooltip popover from the title attribute if no popover
|
|
48
|
+
* was present when requested, otherwise throws an error.
|
|
49
|
+
*/
|
|
50
|
+
protected generatePopover(): HTMLElement | null;
|
|
51
|
+
/**
|
|
52
|
+
* Hides the tooltip if is or is within the event's target.
|
|
53
|
+
* @param event An event object from s-popover:shown
|
|
54
|
+
*/
|
|
55
|
+
private hideIfWithin;
|
|
56
|
+
/**
|
|
57
|
+
* Binds mouse events to show/hide on reference element hover
|
|
58
|
+
*/
|
|
59
|
+
private bindMouseEvents;
|
|
60
|
+
/**
|
|
61
|
+
* Unbinds all mouse events
|
|
62
|
+
*/
|
|
63
|
+
private unbindMouseEvents;
|
|
64
|
+
/**
|
|
65
|
+
* Generates an ID for tooltips created with setTooltip.
|
|
66
|
+
*/
|
|
67
|
+
private static generateId;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Adds or updates a Stacks tooltip on a given element, initializing the controller if necessary
|
|
71
|
+
* @param element The element to add a tooltip to.
|
|
72
|
+
* @param html An HTML string to populate the tooltip with.
|
|
73
|
+
* @param options Options for rendering the tooltip.
|
|
74
|
+
*/
|
|
75
|
+
export declare function setTooltipHtml(element: Element, html: string, options?: TooltipOptions): void;
|
|
76
|
+
/**
|
|
77
|
+
* Adds or updates a Stacks tooltip on a given element, initializing the controller if necessary
|
|
78
|
+
* @param element The element to add a tooltip to.
|
|
79
|
+
* @param text A plain text string to populate the tooltip with.
|
|
80
|
+
* @param options Options for rendering the tooltip.
|
|
81
|
+
*/
|
|
82
|
+
export declare function setTooltipText(element: Element, text: string, options?: TooltipOptions): void;
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import * as Stacks from "../stacks";
|
|
2
|
-
export declare class UploaderController extends Stacks.StacksController {
|
|
3
|
-
static targets: string[];
|
|
4
|
-
private inputTarget;
|
|
5
|
-
private previewsTarget;
|
|
6
|
-
private uploaderTarget;
|
|
7
|
-
private boundDragEnter;
|
|
8
|
-
private boundDragLeave;
|
|
9
|
-
private static readonly FILE_DISPLAY_LIMIT;
|
|
10
|
-
private static readonly MAX_FILE_SIZE;
|
|
11
|
-
connect(): void;
|
|
12
|
-
disconnect(): void;
|
|
13
|
-
/**
|
|
14
|
-
* Handles rendering the file preview state on input change
|
|
15
|
-
*/
|
|
16
|
-
handleInput(): void;
|
|
17
|
-
/**
|
|
18
|
-
* Resets the Uploader to initial state
|
|
19
|
-
*/
|
|
20
|
-
reset(): void;
|
|
21
|
-
/**
|
|
22
|
-
* Set hide/show and disabled state on elements depending on preview state
|
|
23
|
-
* @param {boolean} shouldPreview - Uploader is entering a preview state
|
|
24
|
-
*/
|
|
25
|
-
private handleVisible;
|
|
26
|
-
/**
|
|
27
|
-
* Adds a DOM element to preview a selected file
|
|
28
|
-
* @param {FilePreview} file
|
|
29
|
-
*/
|
|
30
|
-
private addFilePreview;
|
|
31
|
-
/**
|
|
32
|
-
* Toggles display and disabled state for select elements on valid input
|
|
33
|
-
* @param {boolean} active - Uploader is in active state (typically on 'dragenter')
|
|
34
|
-
*/
|
|
35
|
-
private handleUploaderActive;
|
|
36
|
-
/**
|
|
37
|
-
* Converts the file data into a data URL
|
|
38
|
-
* @param {File} file
|
|
39
|
-
* @returns an object containing a FilePreview object
|
|
40
|
-
*/
|
|
41
|
-
private fileToDataURL;
|
|
42
|
-
/**
|
|
43
|
-
* Gets an array of FilePreviews from a FileList
|
|
44
|
-
* @param {FileList|[]} files
|
|
45
|
-
* @returns an array of FilePreview objects from a FileList
|
|
46
|
-
*/
|
|
47
|
-
private getDataURLs;
|
|
48
|
-
}
|
|
1
|
+
import * as Stacks from "../stacks";
|
|
2
|
+
export declare class UploaderController extends Stacks.StacksController {
|
|
3
|
+
static targets: string[];
|
|
4
|
+
private inputTarget;
|
|
5
|
+
private previewsTarget;
|
|
6
|
+
private uploaderTarget;
|
|
7
|
+
private boundDragEnter;
|
|
8
|
+
private boundDragLeave;
|
|
9
|
+
private static readonly FILE_DISPLAY_LIMIT;
|
|
10
|
+
private static readonly MAX_FILE_SIZE;
|
|
11
|
+
connect(): void;
|
|
12
|
+
disconnect(): void;
|
|
13
|
+
/**
|
|
14
|
+
* Handles rendering the file preview state on input change
|
|
15
|
+
*/
|
|
16
|
+
handleInput(): void;
|
|
17
|
+
/**
|
|
18
|
+
* Resets the Uploader to initial state
|
|
19
|
+
*/
|
|
20
|
+
reset(): void;
|
|
21
|
+
/**
|
|
22
|
+
* Set hide/show and disabled state on elements depending on preview state
|
|
23
|
+
* @param {boolean} shouldPreview - Uploader is entering a preview state
|
|
24
|
+
*/
|
|
25
|
+
private handleVisible;
|
|
26
|
+
/**
|
|
27
|
+
* Adds a DOM element to preview a selected file
|
|
28
|
+
* @param {FilePreview} file
|
|
29
|
+
*/
|
|
30
|
+
private addFilePreview;
|
|
31
|
+
/**
|
|
32
|
+
* Toggles display and disabled state for select elements on valid input
|
|
33
|
+
* @param {boolean} active - Uploader is in active state (typically on 'dragenter')
|
|
34
|
+
*/
|
|
35
|
+
private handleUploaderActive;
|
|
36
|
+
/**
|
|
37
|
+
* Converts the file data into a data URL
|
|
38
|
+
* @param {File} file
|
|
39
|
+
* @returns an object containing a FilePreview object
|
|
40
|
+
*/
|
|
41
|
+
private fileToDataURL;
|
|
42
|
+
/**
|
|
43
|
+
* Gets an array of FilePreviews from a FileList
|
|
44
|
+
* @param {FileList|[]} files
|
|
45
|
+
* @returns an array of FilePreview objects from a FileList
|
|
46
|
+
*/
|
|
47
|
+
private getDataURLs;
|
|
48
|
+
}
|