@jupyterlab/ui-components 3.3.0-alpha.6 → 4.0.0-alpha.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/lib/components/button.d.ts +21 -0
  2. package/lib/components/button.js +24 -0
  3. package/lib/components/button.js.map +1 -0
  4. package/lib/components/collapse.d.ts +13 -58
  5. package/lib/components/collapse.js +20 -141
  6. package/lib/components/collapse.js.map +1 -1
  7. package/lib/components/collapser.d.ts +64 -0
  8. package/lib/components/collapser.js +145 -0
  9. package/lib/components/collapser.js.map +1 -0
  10. package/lib/components/index.d.ts +4 -1
  11. package/lib/components/index.js +4 -1
  12. package/lib/components/index.js.map +1 -1
  13. package/lib/components/inputgroup.d.ts +18 -0
  14. package/lib/components/inputgroup.js +27 -0
  15. package/lib/components/inputgroup.js.map +1 -0
  16. package/lib/components/menu.d.ts +18 -13
  17. package/lib/components/menu.js +138 -3
  18. package/lib/components/menu.js.map +1 -1
  19. package/lib/components/toolbar.d.ts +115 -17
  20. package/lib/components/toolbar.js +209 -53
  21. package/lib/components/toolbar.js.map +1 -1
  22. package/lib/icon/iconimports.d.ts +1 -0
  23. package/lib/icon/iconimports.js +2 -0
  24. package/lib/icon/iconimports.js.map +1 -1
  25. package/lib/index.d.ts +0 -1
  26. package/lib/index.js +0 -1
  27. package/lib/index.js.map +1 -1
  28. package/lib/style/icon.js +0 -1
  29. package/lib/style/icon.js.map +1 -1
  30. package/package.json +14 -24
  31. package/style/base.css +88 -17
  32. package/style/deprecated.css +4 -0
  33. package/style/icons/toolbar/bug-dot.svg +6 -0
  34. package/style/index.css +0 -2
  35. package/style/index.js +0 -2
  36. package/lib/blueprint.d.ts +0 -20
  37. package/lib/blueprint.js +0 -23
  38. package/lib/blueprint.js.map +0 -1
@@ -1,5 +1,10 @@
1
1
  import { IDisposable } from '@lumino/disposable';
2
2
  import { Menu } from '@lumino/widgets';
3
+ /**
4
+ * Interface for disposable item menu
5
+ */
6
+ export interface IDisposableMenuItem extends IDisposable, Menu.IItem {
7
+ }
3
8
  /**
4
9
  * A common interface for extensible JupyterLab application menus.
5
10
  *
@@ -8,10 +13,17 @@ import { Menu } from '@lumino/widgets';
8
13
  * application menus that may be extended by plugins as well,
9
14
  * such as "Edit" and "View"
10
15
  */
11
- export interface IRankedMenu extends Menu {
16
+ export interface IRankedMenu extends IDisposable {
12
17
  /**
13
18
  * Add a group of menu items specific to a particular
14
19
  * plugin.
20
+ *
21
+ * The rank can be set for all items in the group using the
22
+ * function argument or per item.
23
+ *
24
+ * @param items - the list of menu items to add.
25
+ * @param rank - the default rank in the menu in which to insert the group.
26
+ * @returns Disposable of the group
15
27
  */
16
28
  addGroup(items: Menu.IItemOptions[], rank?: number): IDisposable;
17
29
  /**
@@ -19,20 +31,13 @@ export interface IRankedMenu extends Menu {
19
31
  *
20
32
  * @param options - The options for creating the menu item.
21
33
  *
22
- * @returns The menu item added to the menu.
34
+ * @returns The disposable menu item added to the menu.
23
35
  */
24
- addItem(options: IRankedMenu.IItemOptions): Menu.IItem;
36
+ addItem(options: IRankedMenu.IItemOptions): IDisposable;
25
37
  /**
26
38
  * A read-only array of the menu items in the menu.
27
39
  */
28
40
  readonly items: ReadonlyArray<Menu.IItem>;
29
- /**
30
- * The underlying Lumino menu.
31
- *
32
- * @deprecated since v3.1
33
- * RankMenu inherits from Menu since v3.1
34
- */
35
- readonly menu: Menu;
36
41
  /**
37
42
  * Menu rank
38
43
  */
@@ -101,8 +106,8 @@ export declare class RankedMenu extends Menu implements IRankedMenu {
101
106
  * function argument or per item.
102
107
  *
103
108
  * @param items - the list of menu items to add.
104
- *
105
109
  * @param rank - the default rank in the menu in which to insert the group.
110
+ * @returns Disposable of the group
106
111
  */
107
112
  addGroup(items: IRankedMenu.IItemOptions[], rank?: number): IDisposable;
108
113
  /**
@@ -112,7 +117,7 @@ export declare class RankedMenu extends Menu implements IRankedMenu {
112
117
  *
113
118
  * @returns The menu item added to the menu.
114
119
  */
115
- addItem(options: IRankedMenu.IItemOptions): Menu.IItem;
120
+ addItem(options: IRankedMenu.IItemOptions): IDisposableMenuItem;
116
121
  /**
117
122
  * Remove all menu items from the menu.
118
123
  */
@@ -140,7 +145,7 @@ export declare class RankedMenu extends Menu implements IRankedMenu {
140
145
  * #### Notes
141
146
  * The index will be clamped to the bounds of the items.
142
147
  */
143
- insertItem(index: number, options: IRankedMenu.IItemOptions): Menu.IItem;
148
+ insertItem(index: number, options: IRankedMenu.IItemOptions): IDisposableMenuItem;
144
149
  /**
145
150
  * Remove the item at a given index from the menu.
146
151
  *
@@ -52,8 +52,8 @@ export class RankedMenu extends Menu {
52
52
  * function argument or per item.
53
53
  *
54
54
  * @param items - the list of menu items to add.
55
- *
56
55
  * @param rank - the default rank in the menu in which to insert the group.
56
+ * @returns Disposable of the group
57
57
  */
58
58
  addGroup(items, rank) {
59
59
  if (items.length === 0) {
@@ -88,7 +88,7 @@ export class RankedMenu extends Menu {
88
88
  added.push(this.insertItem(insertIndex++, { type: 'separator', rank: defaultRank }));
89
89
  }
90
90
  return new DisposableDelegate(() => {
91
- added.forEach(i => this.removeItem(i));
91
+ added.forEach(i => i.dispose());
92
92
  });
93
93
  }
94
94
  /**
@@ -147,7 +147,8 @@ export class RankedMenu extends Menu {
147
147
  var _a, _b;
148
148
  const clampedIndex = Math.max(0, Math.min(index, this._ranks.length));
149
149
  ArrayExt.insert(this._ranks, clampedIndex, (_a = options.rank) !== null && _a !== void 0 ? _a : Math.max(IRankedMenu.DEFAULT_RANK, (_b = this._ranks[this._ranks.length - 1]) !== null && _b !== void 0 ? _b : IRankedMenu.DEFAULT_RANK));
150
- return super.insertItem(clampedIndex, options);
150
+ const item = super.insertItem(clampedIndex, options);
151
+ return new DisposableMenuItem(item, this);
151
152
  }
152
153
  /**
153
154
  * Remove the item at a given index from the menu.
@@ -162,4 +163,138 @@ export class RankedMenu extends Menu {
162
163
  super.removeItemAt(index);
163
164
  }
164
165
  }
166
+ /**
167
+ * Disposable Menu Item
168
+ */
169
+ class DisposableMenuItem {
170
+ /**
171
+ * Create a disposable menu item from an item and the menu it belongs to
172
+ *
173
+ * @param item Menu item
174
+ * @param menu Menu
175
+ */
176
+ constructor(item, menu) {
177
+ this._item = item;
178
+ this._menu = menu;
179
+ // dispose this item if the parent menu is disposed
180
+ const dispose = (menu) => {
181
+ menu.disposed.disconnect(dispose);
182
+ this.dispose();
183
+ };
184
+ this._menu.disposed.connect(dispose);
185
+ }
186
+ /**
187
+ * Whether the menu item is disposed or not.
188
+ */
189
+ get isDisposed() {
190
+ return this._isDisposed;
191
+ }
192
+ /**
193
+ * The type of the menu item.
194
+ */
195
+ get type() {
196
+ return this._item.type;
197
+ }
198
+ /**
199
+ * The command to execute when the item is triggered.
200
+ */
201
+ get command() {
202
+ return this._item.command;
203
+ }
204
+ /**
205
+ * The arguments for the command.
206
+ */
207
+ get args() {
208
+ return this._item.args;
209
+ }
210
+ /**
211
+ * The submenu for a `'submenu'` type item.
212
+ */
213
+ get submenu() {
214
+ return this._item.submenu;
215
+ }
216
+ /**
217
+ * The display label for the menu item.
218
+ */
219
+ get label() {
220
+ return this._item.label;
221
+ }
222
+ /**
223
+ * The mnemonic index for the menu item.
224
+ */
225
+ get mnemonic() {
226
+ return this._item.mnemonic;
227
+ }
228
+ /**
229
+ * The icon renderer for the menu item.
230
+ */
231
+ get icon() {
232
+ return this._item.icon;
233
+ }
234
+ /**
235
+ * The icon class for the menu item.
236
+ */
237
+ get iconClass() {
238
+ return this._item.iconClass;
239
+ }
240
+ /**
241
+ * The icon label for the menu item.
242
+ */
243
+ get iconLabel() {
244
+ return this._item.iconLabel;
245
+ }
246
+ /**
247
+ * The display caption for the menu item.
248
+ */
249
+ get caption() {
250
+ return this._item.caption;
251
+ }
252
+ /**
253
+ * The extra class name for the menu item.
254
+ */
255
+ get className() {
256
+ return this._item.className;
257
+ }
258
+ /**
259
+ * The dataset for the menu item.
260
+ */
261
+ get dataset() {
262
+ return this._item.dataset;
263
+ }
264
+ /**
265
+ * Whether the menu item is enabled.
266
+ */
267
+ get isEnabled() {
268
+ return this._item.isEnabled;
269
+ }
270
+ /**
271
+ * Whether the menu item is toggled.
272
+ */
273
+ get isToggled() {
274
+ return this._item.isToggled;
275
+ }
276
+ /**
277
+ * Whether the menu item is visible.
278
+ */
279
+ get isVisible() {
280
+ return this.isVisible;
281
+ }
282
+ /**
283
+ * The key binding for the menu item.
284
+ */
285
+ get keyBinding() {
286
+ return this._item.keyBinding;
287
+ }
288
+ /**
289
+ * Dispose the menu item by removing it from its menu.
290
+ */
291
+ dispose() {
292
+ this._isDisposed = true;
293
+ if (this._menu.isDisposed) {
294
+ // Bail early
295
+ return;
296
+ }
297
+ this._menu.removeItem(this._item);
298
+ }
299
+ }
165
300
  //# sourceMappingURL=menu.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"menu.js","sourceRoot":"","sources":["../../src/components/menu.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAe,MAAM,oBAAoB,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AA6CvC;;GAEG;AACH,MAAM,KAAW,WAAW,CAgC3B;AAhCD,WAAiB,WAAW;IAC1B;;OAEG;IACU,wBAAY,GAAG,GAAG,CAAC;AA4BlC,CAAC,EAhCgB,WAAW,KAAX,WAAW,QAgC3B;AAED;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,IAAI;IAClC;;;;OAIG;IACH,YAAY,OAA6B;;QACvC,KAAK,CAAC,OAAO,CAAC,CAAC;QAwKT,WAAM,GAAa,EAAE,CAAC;QAvK5B,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC;QAC1B,IAAI,CAAC,kBAAkB,SAAG,OAAO,CAAC,iBAAiB,mCAAI,IAAI,CAAC;IAC9D,CAAC;IAED;;;;;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C;IAED;;OAEG;IACH,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,OAAO;QACL,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE;YACzB,aAAa;YACb,OAAO;SACR;QACD,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;CAKF"}
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { ITranslator } from '@jupyterlab/translation';
3
2
  import { IIterator } from '@lumino/algorithm';
4
3
  import { CommandRegistry } from '@lumino/commands';
@@ -37,10 +36,6 @@ export declare class Toolbar<T extends Widget = Widget> extends Widget {
37
36
  * The item can be removed from the toolbar by setting its parent to `null`.
38
37
  */
39
38
  addItem(name: string, widget: T): boolean;
40
- /**
41
- * Dispose of the widget and its descendant widgets.
42
- */
43
- dispose(): void;
44
39
  /**
45
40
  * Insert an item into the toolbar at the specified index.
46
41
  *
@@ -116,11 +111,65 @@ export declare class Toolbar<T extends Widget = Widget> extends Widget {
116
111
  * Handle `before-detach` messages for the widget.
117
112
  */
118
113
  protected onBeforeDetach(msg: Message): void;
114
+ }
115
+ /**
116
+ * A class which provides a toolbar widget.
117
+ */
118
+ export declare class ReactiveToolbar extends Toolbar<Widget> {
119
+ /**
120
+ * Construct a new toolbar widget.
121
+ */
122
+ constructor();
123
+ /**
124
+ * Dispose of the widget and its descendant widgets.
125
+ */
126
+ dispose(): void;
127
+ /**
128
+ * Insert an item into the toolbar at the after a target item.
129
+ *
130
+ * @param at - The target item to insert after.
131
+ *
132
+ * @param name - The name of the item.
133
+ *
134
+ * @param widget - The widget to add.
135
+ *
136
+ * @returns Whether the item was added to the toolbar. Returns false if
137
+ * an item of the same name is already in the toolbar or if the target
138
+ * is the toolbar pop-up opener.
139
+ *
140
+ * #### Notes
141
+ * The index will be clamped to the bounds of the items.
142
+ * The item can be removed from the toolbar by setting its parent to `null`.
143
+ */
144
+ insertAfter(at: string, name: string, widget: Widget): boolean;
145
+ /**
146
+ * Insert an item into the toolbar at the specified index.
147
+ *
148
+ * @param index - The index at which to insert the item.
149
+ *
150
+ * @param name - The name of the item.
151
+ *
152
+ * @param widget - The widget to add.
153
+ *
154
+ * @returns Whether the item was added to the toolbar. Returns false if
155
+ * an item of the same name is already in the toolbar.
156
+ *
157
+ * #### Notes
158
+ * The index will be clamped to the bounds of the items.
159
+ * The item can be removed from the toolbar by setting its parent to `null`.
160
+ */
161
+ insertItem(index: number, name: string, widget: Widget): boolean;
162
+ /**
163
+ * A message handler invoked on a `'before-hide'` message.
164
+ *
165
+ * It will hide the pop-up panel
166
+ */
167
+ onBeforeHide(msg: Message): void;
119
168
  protected onResize(msg: Widget.ResizeMessage): void;
120
169
  private _onResize;
121
170
  private _saveWidgetWidth;
122
171
  private _getWidgetWidth;
123
- readonly popupOpener: ToolbarPopupOpener;
172
+ protected readonly popupOpener: ToolbarPopupOpener;
124
173
  private readonly _widgetWidths;
125
174
  private readonly _resizer;
126
175
  }
@@ -153,6 +202,10 @@ export declare namespace ToolbarButtonComponent {
153
202
  tooltip?: string;
154
203
  onClick?: () => void;
155
204
  enabled?: boolean;
205
+ pressed?: boolean;
206
+ pressedIcon?: LabIcon.IMaybeResolvable;
207
+ pressedTooltip?: string;
208
+ disabledTooltip?: string;
156
209
  /**
157
210
  * Trigger the button on the actual onClick event rather than onMouseDown.
158
211
  *
@@ -187,7 +240,37 @@ export declare class ToolbarButton extends ReactWidget {
187
240
  * @param props props for underlying `ToolbarButton` component
188
241
  */
189
242
  constructor(props?: ToolbarButtonComponent.IProps);
243
+ /**
244
+ * Sets the pressed state for the button
245
+ * @param value true if button is pressed, false otherwise
246
+ */
247
+ set pressed(value: boolean);
248
+ /**
249
+ * Returns true if button is pressed, false otherwise
250
+ */
251
+ get pressed(): boolean;
252
+ /**
253
+ * Sets the enabled state for the button
254
+ * @param value true to enable the button, false otherwise
255
+ */
256
+ set enabled(value: boolean);
257
+ /**
258
+ * Returns true if button is enabled, false otherwise
259
+ */
260
+ get enabled(): boolean;
261
+ /**
262
+ * Sets the click handler for the button
263
+ * @param value click handler
264
+ */
265
+ set onClick(value: () => void);
266
+ /**
267
+ * Returns the click handler for the button
268
+ */
269
+ get onClick(): () => void;
190
270
  render(): JSX.Element;
271
+ private _pressed;
272
+ private _enabled;
273
+ private _onClick;
191
274
  }
192
275
  /**
193
276
  * Namespace for CommandToolbarButtonComponent.
@@ -287,34 +370,49 @@ declare class ToolbarPopup extends Widget {
287
370
  * the toolbar items overflow toolbar width
288
371
  */
289
372
  declare class ToolbarPopupOpener extends ToolbarButton {
290
- readonly _popup: ToolbarPopup;
291
373
  /**
292
374
  * Create a new popup opener
293
375
  */
294
376
  constructor();
295
- protected handleClick(): void;
296
- /**
297
- * Updates width and position of the popup
298
- * to align with the toolbar
299
- */
300
- updatePopup(): void;
301
377
  /**
302
378
  * Add widget to the popup, prepends widgets
303
379
  * @param widget the widget to add
304
380
  */
305
381
  addWidget(widget: Widget): void;
306
382
  /**
307
- * Returns total no of widgets in the popup
383
+ * Dispose of the widget and its descendant widgets.
384
+ *
385
+ * #### Notes
386
+ * It is unsafe to use the widget after it has been disposed.
387
+ *
388
+ * All calls made to this method after the first are a no-op.
308
389
  */
309
- widgetCount(): number;
390
+ dispose(): void;
391
+ /**
392
+ * Hides the opener and the popup
393
+ */
394
+ hide(): void;
395
+ /**
396
+ * Hides the popup
397
+ */
398
+ hidePopup(): void;
399
+ /**
400
+ * Updates width and position of the popup
401
+ * to align with the toolbar
402
+ */
403
+ updatePopup(): void;
310
404
  /**
311
405
  * Returns widget at index in the popup
312
406
  * @param index
313
407
  */
314
408
  widgetAt(index: number): Widget;
315
409
  /**
316
- * Hides the opener and the popup
410
+ * Returns total number of widgets in the popup
411
+ *
412
+ * @returns Number of widgets
317
413
  */
318
- hide(): void;
414
+ widgetCount(): number;
415
+ protected handleClick(): void;
416
+ protected popup: ToolbarPopup;
319
417
  }
320
418
  export {};