@jupyterlab/ui-components 3.3.0-alpha.12 → 3.3.0-alpha.16

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.
@@ -1,89 +0,0 @@
1
- // Copyright (c) Jupyter Development Team.
2
- // Distributed under the terms of the Modified BSD License.
3
- import { Widget } from '@lumino/widgets';
4
- /**
5
- * A phosphor widget which wraps an IFrame.
6
- */
7
- export class IFrame extends Widget {
8
- /**
9
- * Create a new IFrame widget.
10
- */
11
- constructor(options = {}) {
12
- super({ node: Private.createNode() });
13
- this._sandbox = [];
14
- this.addClass('jp-IFrame');
15
- this.sandbox = options.sandbox || [];
16
- this.referrerPolicy = options.referrerPolicy || 'no-referrer';
17
- }
18
- /**
19
- * Referrer policy for the iframe.
20
- *
21
- * #### Notes
22
- * By default, `no-referrer` is chosen.
23
- *
24
- * For more information, see
25
- * https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/referrerPolicy
26
- */
27
- get referrerPolicy() {
28
- return this._referrerPolicy;
29
- }
30
- set referrerPolicy(value) {
31
- if (this._referrerPolicy === value) {
32
- return;
33
- }
34
- this._referrerPolicy = value;
35
- const iframe = this.node.querySelector('iframe');
36
- iframe.setAttribute('referrerpolicy', value);
37
- }
38
- /**
39
- * Exceptions to the sandboxing.
40
- *
41
- * #### Notes
42
- * By default, all sandboxing security policies are enabled.
43
- * This setting allows the user to selectively disable these
44
- * policies. This should be done with care, as it can
45
- * introduce security risks, and possibly allow malicious
46
- * sites to execute code in a JupyterLab session.
47
- *
48
- * For more information, see
49
- * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe
50
- */
51
- get sandbox() {
52
- return this._sandbox.slice();
53
- }
54
- set sandbox(values) {
55
- this._sandbox = values.slice();
56
- const iframe = this.node.querySelector('iframe');
57
- const exceptions = values.length ? values.join(' ') : '';
58
- iframe.setAttribute('sandbox', exceptions);
59
- }
60
- /**
61
- * The url of the IFrame.
62
- */
63
- get url() {
64
- return this.node.querySelector('iframe').getAttribute('src') || '';
65
- }
66
- set url(url) {
67
- this.node.querySelector('iframe').setAttribute('src', url);
68
- }
69
- }
70
- /**
71
- * A namespace for private data.
72
- */
73
- var Private;
74
- (function (Private) {
75
- /**
76
- * Create the main content node of an iframe widget.
77
- */
78
- function createNode() {
79
- const node = document.createElement('div');
80
- const iframe = document.createElement('iframe');
81
- iframe.setAttribute('sandbox', '');
82
- iframe.style.height = '100%';
83
- iframe.style.width = '100%';
84
- node.appendChild(iframe);
85
- return node;
86
- }
87
- Private.createNode = createNode;
88
- })(Private || (Private = {}));
89
- //# sourceMappingURL=iframe.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"iframe.js","sourceRoot":"","sources":["../../src/components/iframe.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC;;GAEG;AACH,MAAM,OAAO,MAAO,SAAQ,MAAM;IAChC;;OAEG;IACH,YAAY,UAA2B,EAAE;QACvC,KAAK,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;QA4DhC,aAAQ,GAA+B,EAAE,CAAC;QA3DhD,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;QACrC,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,aAAa,CAAC;IAChE,CAAC;IAED;;;;;;;;OAQG;IACH,IAAI,cAAc;QAChB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IACD,IAAI,cAAc,CAAC,KAA4B;QAC7C,IAAI,IAAI,CAAC,eAAe,KAAK,KAAK,EAAE;YAClC,OAAO;SACR;QACD,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;QAC7B,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAA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7B,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC;QAC5B,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IARe,kBAAU,aAQzB,CAAA;AACH,CAAC,EAbS,OAAO,KAAP,OAAO,QAahB"}
@@ -1,15 +0,0 @@
1
- import { Message } from '@lumino/messaging';
2
- import { Widget } from '@lumino/widgets';
3
- /**
4
- * The spinner class.
5
- */
6
- export declare class Spinner extends Widget {
7
- /**
8
- * Construct a spinner widget.
9
- */
10
- constructor();
11
- /**
12
- * Handle `'activate-request'` messages.
13
- */
14
- protected onActivateRequest(msg: Message): void;
15
- }
@@ -1,28 +0,0 @@
1
- /* -----------------------------------------------------------------------------
2
- | Copyright (c) Jupyter Development Team.
3
- | Distributed under the terms of the Modified BSD License.
4
- |----------------------------------------------------------------------------*/
5
- import { Widget } from '@lumino/widgets';
6
- /**
7
- * The spinner class.
8
- */
9
- export class Spinner extends Widget {
10
- /**
11
- * Construct a spinner widget.
12
- */
13
- constructor() {
14
- super();
15
- this.addClass('jp-Spinner');
16
- this.node.tabIndex = -1;
17
- const content = document.createElement('div');
18
- content.className = 'jp-SpinnerContent';
19
- this.node.appendChild(content);
20
- }
21
- /**
22
- * Handle `'activate-request'` messages.
23
- */
24
- onActivateRequest(msg) {
25
- this.node.focus();
26
- }
27
- }
28
- //# sourceMappingURL=spinner.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"spinner.js","sourceRoot":"","sources":["../../src/components/spinner.ts"],"names":[],"mappings":"AAAA;;;+EAG+E;AAG/E,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC;;GAEG;AACH,MAAM,OAAO,OAAQ,SAAQ,MAAM;IACjC;;OAEG;IACH;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;QAC5B,IAAI,CAAC,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC;QACxB,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC9C,OAAO,CAAC,SAAS,GAAG,mBAAmB,CAAC;QACxC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC;IAED;;OAEG;IACO,iBAAiB,CAAC,GAAY;QACtC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IACpB,CAAC;CACF"}
@@ -1,27 +0,0 @@
1
- /**
2
- * A namespace for node styling.
3
- */
4
- export declare namespace Styling {
5
- /**
6
- * Style a node and its child elements with the default tag names.
7
- *
8
- * @param node - The base node.
9
- *
10
- * @param className - The optional CSS class to add to styled nodes.
11
- */
12
- function styleNode(node: HTMLElement, className?: string): void;
13
- /**
14
- * Style a node and its elements that have a given tag name.
15
- *
16
- * @param node - The base node.
17
- *
18
- * @param tagName - The html tag name to style.
19
- *
20
- * @param className - The optional CSS class to add to styled nodes.
21
- */
22
- function styleNodeByTag(node: HTMLElement, tagName: string, className?: string): void;
23
- /**
24
- * Wrap a select node.
25
- */
26
- function wrapSelect(node: HTMLSelectElement): HTMLElement;
27
- }
@@ -1,100 +0,0 @@
1
- // Copyright (c) Jupyter Development Team.
2
- // Distributed under the terms of the Modified BSD License.
3
- import { caretDownEmptyIcon } from '../icon';
4
- /**
5
- * A namespace for node styling.
6
- */
7
- export var Styling;
8
- (function (Styling) {
9
- /**
10
- * Style a node and its child elements with the default tag names.
11
- *
12
- * @param node - The base node.
13
- *
14
- * @param className - The optional CSS class to add to styled nodes.
15
- */
16
- function styleNode(node, className = '') {
17
- styleNodeByTag(node, 'select', className);
18
- styleNodeByTag(node, 'textarea', className);
19
- styleNodeByTag(node, 'input', className);
20
- styleNodeByTag(node, 'button', className);
21
- }
22
- Styling.styleNode = styleNode;
23
- /**
24
- * Style a node and its elements that have a given tag name.
25
- *
26
- * @param node - The base node.
27
- *
28
- * @param tagName - The html tag name to style.
29
- *
30
- * @param className - The optional CSS class to add to styled nodes.
31
- */
32
- function styleNodeByTag(node, tagName, className = '') {
33
- if (node.localName === tagName) {
34
- node.classList.add('jp-mod-styled');
35
- }
36
- if (node.localName === 'select') {
37
- wrapSelect(node);
38
- }
39
- const nodes = node.getElementsByTagName(tagName);
40
- for (let i = 0; i < nodes.length; i++) {
41
- const child = nodes[i];
42
- child.classList.add('jp-mod-styled');
43
- if (className) {
44
- child.classList.add(className);
45
- }
46
- if (tagName === 'select') {
47
- wrapSelect(child);
48
- }
49
- }
50
- }
51
- Styling.styleNodeByTag = styleNodeByTag;
52
- /**
53
- * Wrap a select node.
54
- */
55
- function wrapSelect(node) {
56
- const wrapper = document.createElement('div');
57
- wrapper.classList.add('jp-select-wrapper');
58
- node.addEventListener('focus', Private.onFocus);
59
- node.addEventListener('blur', Private.onFocus);
60
- node.classList.add('jp-mod-styled');
61
- if (node.parentElement) {
62
- node.parentElement.replaceChild(wrapper, node);
63
- }
64
- wrapper.appendChild(node);
65
- // add the icon node
66
- wrapper.appendChild(caretDownEmptyIcon.element({
67
- tag: 'span',
68
- stylesheet: 'select',
69
- right: '8px',
70
- top: '5px',
71
- width: '18px'
72
- }));
73
- return wrapper;
74
- }
75
- Styling.wrapSelect = wrapSelect;
76
- })(Styling || (Styling = {}));
77
- /**
78
- * The namespace for module private data.
79
- */
80
- var Private;
81
- (function (Private) {
82
- /**
83
- * Handle a focus event on a styled select.
84
- */
85
- function onFocus(event) {
86
- const target = event.target;
87
- const parent = target.parentElement;
88
- if (!parent) {
89
- return;
90
- }
91
- if (event.type === 'focus') {
92
- parent.classList.add('jp-mod-focused');
93
- }
94
- else {
95
- parent.classList.remove('jp-mod-focused');
96
- }
97
- }
98
- Private.onFocus = onFocus;
99
- })(Private || (Private = {}));
100
- //# sourceMappingURL=styling.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"styling.js","sourceRoot":"","sources":["../../src/components/styling.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,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,GAAG,CAAC,gBAAgB,CAAC,CAAC;SACxC;aAAM;YACL,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;SAC3C;IACH,CAAC;IAXe,eAAO,UAWtB,CAAA;AACH,CAAC,EAhBS,OAAO,KAAP,OAAO,QAgBhB"}
@@ -1,419 +0,0 @@
1
- /// <reference types="react" />
2
- import { ITranslator } from '@jupyterlab/translation';
3
- import { IIterator } from '@lumino/algorithm';
4
- import { CommandRegistry } from '@lumino/commands';
5
- import { ReadonlyJSONObject } from '@lumino/coreutils';
6
- import { Message } from '@lumino/messaging';
7
- import { Widget } from '@lumino/widgets';
8
- import { LabIcon } from '../icon';
9
- import { ReactWidget } from './vdom';
10
- /**
11
- * A class which provides a toolbar widget.
12
- */
13
- export declare class Toolbar<T extends Widget = Widget> extends Widget {
14
- /**
15
- * Construct a new toolbar widget.
16
- */
17
- constructor();
18
- /**
19
- * Get an iterator over the ordered toolbar item names.
20
- *
21
- * @returns An iterator over the toolbar item names.
22
- */
23
- names(): IIterator<string>;
24
- /**
25
- * Add an item to the end of the toolbar.
26
- *
27
- * @param name - The name of the widget to add to the toolbar.
28
- *
29
- * @param widget - The widget to add to the toolbar.
30
- *
31
- * @param index - The optional name of the item to insert after.
32
- *
33
- * @returns Whether the item was added to toolbar. Returns false if
34
- * an item of the same name is already in the toolbar.
35
- *
36
- * #### Notes
37
- * The item can be removed from the toolbar by setting its parent to `null`.
38
- */
39
- addItem(name: string, widget: T): boolean;
40
- /**
41
- * Insert an item into the toolbar at the specified index.
42
- *
43
- * @param index - The index at which to insert the item.
44
- *
45
- * @param name - The name of the item.
46
- *
47
- * @param widget - The widget to add.
48
- *
49
- * @returns Whether the item was added to the toolbar. Returns false if
50
- * an item of the same name is already in the toolbar.
51
- *
52
- * #### Notes
53
- * The index will be clamped to the bounds of the items.
54
- * The item can be removed from the toolbar by setting its parent to `null`.
55
- */
56
- insertItem(index: number, name: string, widget: T): boolean;
57
- /**
58
- * Insert an item into the toolbar at the after a target item.
59
- *
60
- * @param at - The target item to insert after.
61
- *
62
- * @param name - The name of the item.
63
- *
64
- * @param widget - The widget to add.
65
- *
66
- * @returns Whether the item was added to the toolbar. Returns false if
67
- * an item of the same name is already in the toolbar.
68
- *
69
- * #### Notes
70
- * The index will be clamped to the bounds of the items.
71
- * The item can be removed from the toolbar by setting its parent to `null`.
72
- */
73
- insertAfter(at: string, name: string, widget: T): boolean;
74
- /**
75
- * Insert an item into the toolbar at the before a target item.
76
- *
77
- * @param at - The target item to insert before.
78
- *
79
- * @param name - The name of the item.
80
- *
81
- * @param widget - The widget to add.
82
- *
83
- * @returns Whether the item was added to the toolbar. Returns false if
84
- * an item of the same name is already in the toolbar.
85
- *
86
- * #### Notes
87
- * The index will be clamped to the bounds of the items.
88
- * The item can be removed from the toolbar by setting its parent to `null`.
89
- */
90
- insertBefore(at: string, name: string, widget: T): boolean;
91
- private _insertRelative;
92
- /**
93
- * Handle the DOM events for the widget.
94
- *
95
- * @param event - The DOM event sent to the widget.
96
- *
97
- * #### Notes
98
- * This method implements the DOM `EventListener` interface and is
99
- * called in response to events on the dock panel's node. It should
100
- * not be called directly by user code.
101
- */
102
- handleEvent(event: Event): void;
103
- /**
104
- * Handle a DOM click event.
105
- */
106
- protected handleClick(event: Event): void;
107
- /**
108
- * Handle `after-attach` messages for the widget.
109
- */
110
- protected onAfterAttach(msg: Message): void;
111
- /**
112
- * Handle `before-detach` messages for the widget.
113
- */
114
- protected onBeforeDetach(msg: Message): void;
115
- }
116
- /**
117
- * A class which provides a toolbar widget.
118
- */
119
- export declare class ReactiveToolbar extends Toolbar<Widget> {
120
- /**
121
- * Construct a new toolbar widget.
122
- */
123
- constructor();
124
- /**
125
- * Dispose of the widget and its descendant widgets.
126
- */
127
- dispose(): void;
128
- /**
129
- * Insert an item into the toolbar at the after a target item.
130
- *
131
- * @param at - The target item to insert after.
132
- *
133
- * @param name - The name of the item.
134
- *
135
- * @param widget - The widget to add.
136
- *
137
- * @returns Whether the item was added to the toolbar. Returns false if
138
- * an item of the same name is already in the toolbar or if the target
139
- * is the toolbar pop-up opener.
140
- *
141
- * #### Notes
142
- * The index will be clamped to the bounds of the items.
143
- * The item can be removed from the toolbar by setting its parent to `null`.
144
- */
145
- insertAfter(at: string, name: string, widget: Widget): boolean;
146
- /**
147
- * Insert an item into the toolbar at the specified index.
148
- *
149
- * @param index - The index at which to insert the item.
150
- *
151
- * @param name - The name of the item.
152
- *
153
- * @param widget - The widget to add.
154
- *
155
- * @returns Whether the item was added to the toolbar. Returns false if
156
- * an item of the same name is already in the toolbar.
157
- *
158
- * #### Notes
159
- * The index will be clamped to the bounds of the items.
160
- * The item can be removed from the toolbar by setting its parent to `null`.
161
- */
162
- insertItem(index: number, name: string, widget: Widget): boolean;
163
- /**
164
- * A message handler invoked on a `'before-hide'` message.
165
- *
166
- * It will hide the pop-up panel
167
- */
168
- onBeforeHide(msg: Message): void;
169
- protected onResize(msg: Widget.ResizeMessage): void;
170
- private _onResize;
171
- private _saveWidgetWidth;
172
- private _getWidgetWidth;
173
- protected readonly popupOpener: ToolbarPopupOpener;
174
- private readonly _widgetWidths;
175
- private readonly _resizer;
176
- }
177
- /**
178
- * The namespace for Toolbar class statics.
179
- */
180
- export declare namespace Toolbar {
181
- /**
182
- * Create a toolbar spacer item.
183
- *
184
- * #### Notes
185
- * It is a flex spacer that separates the left toolbar items
186
- * from the right toolbar items.
187
- */
188
- function createSpacerItem(): Widget;
189
- }
190
- /**
191
- * Namespace for ToolbarButtonComponent.
192
- */
193
- export declare namespace ToolbarButtonComponent {
194
- /**
195
- * Interface for ToolbarButtonComponent props.
196
- */
197
- interface IProps {
198
- className?: string;
199
- label?: string;
200
- icon?: LabIcon.IMaybeResolvable;
201
- iconClass?: string;
202
- iconLabel?: string;
203
- tooltip?: string;
204
- onClick?: () => void;
205
- enabled?: boolean;
206
- pressed?: boolean;
207
- pressedIcon?: LabIcon.IMaybeResolvable;
208
- pressedTooltip?: string;
209
- disabledTooltip?: string;
210
- /**
211
- * Trigger the button on the actual onClick event rather than onMouseDown.
212
- *
213
- * See note in ToolbarButtonComponent below as to why the default is to
214
- * trigger on onMouseDown.
215
- */
216
- actualOnClick?: boolean;
217
- /**
218
- * The application language translator.
219
- */
220
- translator?: ITranslator;
221
- }
222
- }
223
- /**
224
- * React component for a toolbar button.
225
- *
226
- * @param props - The props for ToolbarButtonComponent.
227
- */
228
- export declare function ToolbarButtonComponent(props: ToolbarButtonComponent.IProps): JSX.Element;
229
- /**
230
- * Adds the toolbar button class to the toolbar widget.
231
- * @param w Toolbar button widget.
232
- */
233
- export declare function addToolbarButtonClass(w: Widget): Widget;
234
- /**
235
- * Phosphor Widget version of static ToolbarButtonComponent.
236
- */
237
- export declare class ToolbarButton extends ReactWidget {
238
- private props;
239
- /**
240
- * Creates a toolbar button
241
- * @param props props for underlying `ToolbarButton` component
242
- */
243
- constructor(props?: ToolbarButtonComponent.IProps);
244
- /**
245
- * Sets the pressed state for the button
246
- * @param value true if button is pressed, false otherwise
247
- */
248
- set pressed(value: boolean);
249
- /**
250
- * Returns true if button is pressed, false otherwise
251
- */
252
- get pressed(): boolean;
253
- /**
254
- * Sets the enabled state for the button
255
- * @param value true to enable the button, false otherwise
256
- */
257
- set enabled(value: boolean);
258
- /**
259
- * Returns true if button is enabled, false otherwise
260
- */
261
- get enabled(): boolean;
262
- /**
263
- * Sets the click handler for the button
264
- * @param value click handler
265
- */
266
- set onClick(value: () => void);
267
- /**
268
- * Returns the click handler for the button
269
- */
270
- get onClick(): () => void;
271
- render(): JSX.Element;
272
- private _pressed;
273
- private _enabled;
274
- private _onClick;
275
- }
276
- /**
277
- * Namespace for CommandToolbarButtonComponent.
278
- */
279
- export declare namespace CommandToolbarButtonComponent {
280
- /**
281
- * Interface for CommandToolbarButtonComponent props.
282
- */
283
- interface IProps {
284
- /**
285
- * Application commands registry
286
- */
287
- commands: CommandRegistry;
288
- /**
289
- * Command unique id
290
- */
291
- id: string;
292
- /**
293
- * Command arguments
294
- */
295
- args?: ReadonlyJSONObject;
296
- /**
297
- * Overrides command icon
298
- */
299
- icon?: LabIcon;
300
- /**
301
- * Overrides command label
302
- */
303
- label?: string;
304
- }
305
- }
306
- /**
307
- * React component for a toolbar button that wraps a command.
308
- *
309
- * This wraps the ToolbarButtonComponent and watches the command registry
310
- * for changes to the command.
311
- */
312
- export declare function CommandToolbarButtonComponent(props: CommandToolbarButtonComponent.IProps): JSX.Element;
313
- export declare function addCommandToolbarButtonClass(w: Widget): Widget;
314
- /**
315
- * Phosphor Widget version of CommandToolbarButtonComponent.
316
- */
317
- export declare class CommandToolbarButton extends ReactWidget {
318
- private props;
319
- /**
320
- * Creates a command toolbar button
321
- * @param props props for underlying `CommandToolbarButtonComponent` component
322
- */
323
- constructor(props: CommandToolbarButtonComponent.IProps);
324
- render(): JSX.Element;
325
- }
326
- /**
327
- * A class which provides a toolbar popup
328
- * used to store widgets that don't fit
329
- * in the toolbar when it is resized
330
- */
331
- declare class ToolbarPopup extends Widget {
332
- width: number;
333
- /**
334
- * Construct a new ToolbarPopup
335
- */
336
- constructor();
337
- /**
338
- * Updates the width of the popup, this
339
- * should match with the toolbar width
340
- *
341
- * @param width - The width to resize to
342
- * @protected
343
- */
344
- updateWidth(width: number): void;
345
- /**
346
- * Aligns the popup to left bottom of widget
347
- *
348
- * @param widget the widget to align to
349
- * @private
350
- */
351
- alignTo(widget: Widget): void;
352
- /**
353
- * Inserts the widget at specified index
354
- * @param index the index
355
- * @param widget widget to add
356
- */
357
- insertWidget(index: number, widget: Widget): void;
358
- /**
359
- * Total number of widgets in the popup
360
- */
361
- widgetCount(): number;
362
- /**
363
- * Returns the widget at index
364
- * @param index the index
365
- */
366
- widgetAt(index: number): Widget;
367
- }
368
- /**
369
- * A class that provides a ToolbarPopupOpener,
370
- * which is a button added to toolbar when
371
- * the toolbar items overflow toolbar width
372
- */
373
- declare class ToolbarPopupOpener extends ToolbarButton {
374
- /**
375
- * Create a new popup opener
376
- */
377
- constructor();
378
- /**
379
- * Add widget to the popup, prepends widgets
380
- * @param widget the widget to add
381
- */
382
- addWidget(widget: Widget): void;
383
- /**
384
- * Dispose of the widget and its descendant widgets.
385
- *
386
- * #### Notes
387
- * It is unsafe to use the widget after it has been disposed.
388
- *
389
- * All calls made to this method after the first are a no-op.
390
- */
391
- dispose(): void;
392
- /**
393
- * Hides the opener and the popup
394
- */
395
- hide(): void;
396
- /**
397
- * Hides the popup
398
- */
399
- hidePopup(): void;
400
- /**
401
- * Updates width and position of the popup
402
- * to align with the toolbar
403
- */
404
- updatePopup(): void;
405
- /**
406
- * Returns widget at index in the popup
407
- * @param index
408
- */
409
- widgetAt(index: number): Widget;
410
- /**
411
- * Returns total number of widgets in the popup
412
- *
413
- * @returns Number of widgets
414
- */
415
- widgetCount(): number;
416
- protected handleClick(): void;
417
- protected popup: ToolbarPopup;
418
- }
419
- export {};