@jupyterlab/ui-components 4.6.0-alpha.2 → 4.6.0-alpha.3

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 (69) hide show
  1. package/lib/FormRendererRegistry.d.ts +1 -1
  2. package/lib/components/accordiontoolbar.d.ts +2 -1
  3. package/lib/components/accordiontoolbar.js.map +1 -1
  4. package/lib/components/button.js.map +1 -1
  5. package/lib/components/collapser.d.ts +2 -2
  6. package/lib/components/collapser.js.map +1 -1
  7. package/lib/components/form.d.ts +4 -4
  8. package/lib/components/form.js.map +1 -1
  9. package/lib/components/htmlselect.d.ts +2 -2
  10. package/lib/components/htmlselect.js +1 -3
  11. package/lib/components/htmlselect.js.map +1 -1
  12. package/lib/components/inputgroup.js.map +1 -1
  13. package/lib/components/menu.d.ts +1 -1
  14. package/lib/components/menu.js.map +1 -1
  15. package/lib/components/search.d.ts +1 -1
  16. package/lib/components/search.js +1 -1
  17. package/lib/components/search.js.map +1 -1
  18. package/lib/components/sidepanel.d.ts +1 -1
  19. package/lib/components/sidepanel.js.map +1 -1
  20. package/lib/components/spinner.d.ts +1 -1
  21. package/lib/components/switch.d.ts +2 -2
  22. package/lib/components/switch.js.map +1 -1
  23. package/lib/components/table.d.ts +2 -1
  24. package/lib/components/table.js.map +1 -1
  25. package/lib/components/toolbar.d.ts +5 -4
  26. package/lib/components/toolbar.js +1 -1
  27. package/lib/components/toolbar.js.map +1 -1
  28. package/lib/components/vdom.d.ts +4 -3
  29. package/lib/components/vdom.js.map +1 -1
  30. package/lib/components/windowedlist.d.ts +6 -5
  31. package/lib/components/windowedlist.js +2 -0
  32. package/lib/components/windowedlist.js.map +1 -1
  33. package/lib/hoverbox.js.map +1 -1
  34. package/lib/icon/labicon.d.ts +2 -2
  35. package/lib/icon/labicon.js.map +1 -1
  36. package/lib/icon/widgets/commandpalettesvg.d.ts +1 -1
  37. package/lib/icon/widgets/commandpalettesvg.js +1 -3
  38. package/lib/icon/widgets/commandpalettesvg.js.map +1 -1
  39. package/lib/icon/widgets/menusvg.d.ts +4 -3
  40. package/lib/icon/widgets/menusvg.js.map +1 -1
  41. package/lib/icon/widgets/tabbarsvg.d.ts +4 -3
  42. package/lib/icon/widgets/tabbarsvg.js.map +1 -1
  43. package/lib/style/icon.d.ts +1 -1
  44. package/lib/utils.js.map +1 -1
  45. package/package.json +8 -8
  46. package/src/FormRendererRegistry.tsx +1 -1
  47. package/src/components/accordiontoolbar.ts +5 -8
  48. package/src/components/button.tsx +1 -2
  49. package/src/components/collapser.ts +5 -3
  50. package/src/components/form.tsx +15 -20
  51. package/src/components/htmlselect.tsx +7 -6
  52. package/src/components/inputgroup.tsx +1 -2
  53. package/src/components/menu.ts +5 -4
  54. package/src/components/search.tsx +2 -2
  55. package/src/components/sidepanel.ts +2 -5
  56. package/src/components/spinner.ts +1 -1
  57. package/src/components/switch.ts +3 -2
  58. package/src/components/table.tsx +2 -1
  59. package/src/components/toolbar.tsx +10 -7
  60. package/src/components/vdom.ts +7 -4
  61. package/src/components/windowedlist.ts +13 -9
  62. package/src/hoverbox.ts +8 -6
  63. package/src/icon/labicon.tsx +8 -3
  64. package/src/icon/widgets/commandpalettesvg.ts +3 -4
  65. package/src/icon/widgets/menusvg.ts +5 -3
  66. package/src/icon/widgets/tabbarsvg.ts +6 -3
  67. package/src/style/icon.ts +1 -1
  68. package/src/utils.ts +2 -2
  69. package/style/windowedlist.css +0 -1
@@ -2,9 +2,11 @@
2
2
  // Distributed under the terms of the Modified BSD License.
3
3
 
4
4
  import * as React from 'react';
5
- import { caretDownEmptyIcon, LabIcon } from '../icon';
5
+ import type { LabIcon } from '../icon';
6
+ import { caretDownEmptyIcon } from '../icon';
6
7
  import { classes } from '../utils';
7
- import { DEFAULT_STYLE_CLASS, IElementRefProps } from './interface';
8
+ import type { IElementRefProps } from './interface';
9
+ import { DEFAULT_STYLE_CLASS } from './interface';
8
10
 
9
11
  export const HTML_SELECT_CLASS = 'jp-HTMLSelect';
10
12
 
@@ -31,7 +33,8 @@ export interface IOptionProps {
31
33
  }
32
34
 
33
35
  export interface IHTMLSelectProps
34
- extends IElementRefProps<HTMLSelectElement>,
36
+ extends
37
+ IElementRefProps<HTMLSelectElement>,
35
38
  React.SelectHTMLAttributes<HTMLSelectElement> {
36
39
  defaultStyle?: boolean;
37
40
 
@@ -57,9 +60,7 @@ export class HTMLSelect extends React.Component<IHTMLSelectProps> {
57
60
 
58
61
  const cls = classes(
59
62
  HTML_SELECT_CLASS,
60
- {
61
- [DEFAULT_STYLE_CLASS]: defaultStyle
62
- },
63
+ { [DEFAULT_STYLE_CLASS]: defaultStyle },
63
64
  className
64
65
  );
65
66
 
@@ -10,8 +10,7 @@ import { classes } from '../utils';
10
10
  /**
11
11
  * InputGroup component properties
12
12
  */
13
- export interface IInputGroupProps
14
- extends React.InputHTMLAttributes<HTMLInputElement> {
13
+ export interface IInputGroupProps extends React.InputHTMLAttributes<HTMLInputElement> {
15
14
  /**
16
15
  * Pass a ref to the input element
17
16
  */
@@ -4,11 +4,12 @@
4
4
  /* global WeakRef */
5
5
 
6
6
  import { ArrayExt } from '@lumino/algorithm';
7
- import { CommandRegistry } from '@lumino/commands';
8
- import { ReadonlyJSONObject } from '@lumino/coreutils';
9
- import { DisposableDelegate, IDisposable } from '@lumino/disposable';
7
+ import type { CommandRegistry } from '@lumino/commands';
8
+ import type { ReadonlyJSONObject } from '@lumino/coreutils';
9
+ import type { IDisposable } from '@lumino/disposable';
10
+ import { DisposableDelegate } from '@lumino/disposable';
10
11
  import { Signal } from '@lumino/signaling';
11
- import { VirtualElement } from '@lumino/virtualdom';
12
+ import type { VirtualElement } from '@lumino/virtualdom';
12
13
  import { Menu } from '@lumino/widgets';
13
14
 
14
15
  /**
@@ -5,7 +5,7 @@ import { StringExt } from '@lumino/algorithm';
5
5
  import React, { useCallback, useEffect, useRef, useState } from 'react';
6
6
  import { Search } from '@jupyter/react-components';
7
7
  import { searchIcon } from '../icon';
8
- import { ISignal } from '@lumino/signaling';
8
+ import type { ISignal } from '@lumino/signaling';
9
9
 
10
10
  /**
11
11
  * The class name added to the filebrowser crumbs node.
@@ -114,7 +114,7 @@ export function fuzzySearch(source: string, query: string): IScore | null {
114
114
  }
115
115
 
116
116
  // Update the match if the score is better.
117
- if (match && match.score <= score) {
117
+ if (match.score <= score) {
118
118
  score = match.score;
119
119
  indices = match.indices;
120
120
  }
@@ -1,11 +1,8 @@
1
1
  // Copyright (c) Jupyter Development Team.
2
2
  // Distributed under the terms of the Modified BSD License.
3
3
 
4
- import {
5
- ITranslator,
6
- nullTranslator,
7
- TranslationBundle
8
- } from '@jupyterlab/translation';
4
+ import type { ITranslator, TranslationBundle } from '@jupyterlab/translation';
5
+ import { nullTranslator } from '@jupyterlab/translation';
9
6
  import { AccordionPanel, Panel, PanelLayout, Widget } from '@lumino/widgets';
10
7
  import { AccordionToolbar } from './accordiontoolbar';
11
8
  import { Toolbar } from './toolbar';
@@ -3,7 +3,7 @@
3
3
  | Distributed under the terms of the Modified BSD License.
4
4
  |----------------------------------------------------------------------------*/
5
5
 
6
- import { Message } from '@lumino/messaging';
6
+ import type { Message } from '@lumino/messaging';
7
7
  import { Widget } from '@lumino/widgets';
8
8
 
9
9
  /**
@@ -1,8 +1,9 @@
1
1
  // Copyright (c) Jupyter Development Team.
2
2
  // Distributed under the terms of the Modified BSD License.
3
3
 
4
- import { IChangedArgs } from '@jupyterlab/coreutils';
5
- import { ISignal, Signal } from '@lumino/signaling';
4
+ import type { IChangedArgs } from '@jupyterlab/coreutils';
5
+ import type { ISignal } from '@lumino/signaling';
6
+ import { Signal } from '@lumino/signaling';
6
7
  import { Widget } from '@lumino/widgets';
7
8
 
8
9
  /**
@@ -3,7 +3,8 @@
3
3
  * Distributed under the terms of the Modified BSD License.
4
4
  */
5
5
 
6
- import React, { ReactElement, ReactNode, useState } from 'react';
6
+ import type { ReactElement, ReactNode } from 'react';
7
+ import React, { useState } from 'react';
7
8
  import { caretDownIcon, caretUpIcon } from '../icon';
8
9
 
9
10
  export const TABLE_CLASS = 'jp-sortable-table';
@@ -8,13 +8,16 @@ import {
8
8
  jpToolbar,
9
9
  provideJupyterDesignSystem
10
10
  } from '@jupyter/web-components';
11
- import { ITranslator, nullTranslator } from '@jupyterlab/translation';
11
+ import type { ITranslator } from '@jupyterlab/translation';
12
+ import { nullTranslator } from '@jupyterlab/translation';
12
13
  import { find, map, some } from '@lumino/algorithm';
13
14
  import { CommandRegistry } from '@lumino/commands';
14
- import { ReadonlyJSONObject } from '@lumino/coreutils';
15
- import { Message, MessageLoop } from '@lumino/messaging';
15
+ import type { ReadonlyJSONObject } from '@lumino/coreutils';
16
+ import type { Message } from '@lumino/messaging';
17
+ import { MessageLoop } from '@lumino/messaging';
16
18
  import { AttachedProperty } from '@lumino/properties';
17
- import { Layout, PanelLayout, Widget } from '@lumino/widgets';
19
+ import type { Layout } from '@lumino/widgets';
20
+ import { PanelLayout, Widget } from '@lumino/widgets';
18
21
  import { Throttler } from '@lumino/polling';
19
22
  import * as React from 'react';
20
23
  import { ellipsesIcon, LabIcon } from '../icon';
@@ -821,7 +824,7 @@ export function ToolbarButtonComponent(
821
824
  // In some browsers, a button click event moves the focus from the main
822
825
  // content to the button (see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus).
823
826
  const handleClick =
824
- props.noFocusOnClick ?? false
827
+ (props.noFocusOnClick ?? false)
825
828
  ? undefined
826
829
  : (event: React.MouseEvent) => {
827
830
  if (event.button === 0) {
@@ -837,7 +840,7 @@ export function ToolbarButtonComponent(
837
840
  // Currently this is mostly useful for the notebook panel, to retrieve the focused
838
841
  // cell before the click event.
839
842
  const handleMouseDown =
840
- props.noFocusOnClick ?? false
843
+ (props.noFocusOnClick ?? false)
841
844
  ? (event: React.MouseEvent) => {
842
845
  // Fire action only when left button is pressed.
843
846
  if (event.button === 0) {
@@ -890,7 +893,7 @@ export function ToolbarButtonComponent(
890
893
  >
891
894
  {(props.icon || props.iconClass) && (
892
895
  <LabIcon.resolveReact
893
- icon={props.pressed ? props.pressedIcon ?? props.icon : props.icon}
896
+ icon={props.pressed ? (props.pressedIcon ?? props.icon) : props.icon}
894
897
  iconClass={
895
898
  // add some extra classes for proper support of icons-as-css-background
896
899
  classes(props.iconClass, 'jp-Icon')
@@ -1,12 +1,15 @@
1
1
  // Copyright (c) Jupyter Development Team.
2
2
  // Distributed under the terms of the Modified BSD License.
3
3
 
4
- import { IDisposable } from '@lumino/disposable';
5
- import { Message, MessageLoop } from '@lumino/messaging';
6
- import { ISignal, Signal } from '@lumino/signaling';
4
+ import type { IDisposable } from '@lumino/disposable';
5
+ import type { Message } from '@lumino/messaging';
6
+ import { MessageLoop } from '@lumino/messaging';
7
+ import type { ISignal } from '@lumino/signaling';
8
+ import { Signal } from '@lumino/signaling';
7
9
  import { Widget } from '@lumino/widgets';
8
10
  import * as React from 'react';
9
- import { createRoot, Root } from 'react-dom/client';
11
+ import type { Root } from 'react-dom/client';
12
+ import { createRoot } from 'react-dom/client';
10
13
 
11
14
  type ReactRenderElement =
12
15
  | Array<React.ReactElement<any>>
@@ -10,14 +10,16 @@
10
10
  * - https://github.com/WICG/virtual-scroller/
11
11
  * Licensed by Contributors under the [W3C Software and Document License](http://www.w3.org/Consortium/Legal/2015/copyright-software-and-document)
12
12
  */
13
- import { IChangedArgs } from '@jupyterlab/coreutils';
14
- import { IObservableList } from '@jupyterlab/observables';
13
+ import type { IChangedArgs } from '@jupyterlab/coreutils';
14
+ import type { IObservableList } from '@jupyterlab/observables';
15
15
  import { ArrayExt } from '@lumino/algorithm';
16
16
  import { PromiseDelegate } from '@lumino/coreutils';
17
- import { IDisposable } from '@lumino/disposable';
18
- import { Message, MessageLoop } from '@lumino/messaging';
17
+ import type { IDisposable } from '@lumino/disposable';
18
+ import type { Message } from '@lumino/messaging';
19
+ import { MessageLoop } from '@lumino/messaging';
19
20
  import { Throttler } from '@lumino/polling';
20
- import { ISignal, Signal } from '@lumino/signaling';
21
+ import type { ISignal } from '@lumino/signaling';
22
+ import { Signal } from '@lumino/signaling';
21
23
  import { PanelLayout, Widget } from '@lumino/widgets';
22
24
 
23
25
  /**
@@ -1352,8 +1354,8 @@ export class WindowedList<
1352
1354
  }
1353
1355
  for (const widget of this.layout.widgets) {
1354
1356
  this._itemsResizeObserver.observe(widget.node);
1355
- widget.disposed.connect(
1356
- () => this._itemsResizeObserver?.unobserve(widget.node)
1357
+ widget.disposed.connect(() =>
1358
+ this._itemsResizeObserver?.unobserve(widget.node)
1357
1359
  );
1358
1360
  }
1359
1361
  if (!this._areaResizeObserver) {
@@ -1369,6 +1371,7 @@ export class WindowedList<
1369
1371
  * Turn off windowing related styles in the viewport.
1370
1372
  */
1371
1373
  private _applyNoWindowingStyles() {
1374
+ this._outerElement.style.removeProperty('overflow-anchor');
1372
1375
  this._viewport.style.position = 'relative';
1373
1376
  this._viewport.style.contain = '';
1374
1377
  this._viewport.style.top = '0px';
@@ -1379,6 +1382,7 @@ export class WindowedList<
1379
1382
  * Turn on windowing related styles in the viewport.
1380
1383
  */
1381
1384
  private _applyWindowingStyles() {
1385
+ this._outerElement.style.setProperty('overflow-anchor', 'none');
1382
1386
  this._viewport.style.position = 'absolute';
1383
1387
  this._viewport.style.contain = 'layout';
1384
1388
  }
@@ -1434,8 +1438,8 @@ export class WindowedList<
1434
1438
  const item = toAdd[index];
1435
1439
  if (this._itemsResizeObserver && !this.layout.widgets.includes(item)) {
1436
1440
  this._itemsResizeObserver.observe(item.node);
1437
- item.disposed.connect(
1438
- () => this._itemsResizeObserver?.unobserve(item.node)
1441
+ item.disposed.connect(() =>
1442
+ this._itemsResizeObserver?.unobserve(item.node)
1439
1443
  );
1440
1444
  }
1441
1445
 
package/src/hoverbox.ts CHANGED
@@ -126,8 +126,10 @@ export namespace HoverBox {
126
126
  /**
127
127
  * An interface describing anchor coordinates.
128
128
  */
129
- export interface IAnchor
130
- extends Pick<DOMRect, 'left' | 'right' | 'top' | 'bottom'> {}
129
+ export interface IAnchor extends Pick<
130
+ DOMRect,
131
+ 'left' | 'right' | 'top' | 'bottom'
132
+ > {}
131
133
 
132
134
  /**
133
135
  * Set the visible dimensions of a hovering box anchored to an editor cursor.
@@ -173,10 +175,10 @@ export namespace HoverBox {
173
175
  privilege === 'forceAbove'
174
176
  ? false
175
177
  : privilege === 'forceBelow'
176
- ? true
177
- : privilege === 'above'
178
- ? spaceAbove < maxHeight && spaceAbove < spaceBelow
179
- : spaceBelow >= maxHeight || spaceBelow >= spaceAbove;
178
+ ? true
179
+ : privilege === 'above'
180
+ ? spaceAbove < maxHeight && spaceAbove < spaceBelow
181
+ : spaceBelow >= maxHeight || spaceBelow >= spaceAbove;
180
182
 
181
183
  if (renderBelow) {
182
184
  maxHeight = Math.min(spaceBelow - marginTop, maxHeight);
@@ -1,12 +1,17 @@
1
1
  // Copyright (c) Jupyter Development Team.
2
2
  // Distributed under the terms of the Modified BSD License.
3
3
 
4
- import { IRenderMime } from '@jupyterlab/rendermime-interfaces';
4
+ import type { IRenderMime } from '@jupyterlab/rendermime-interfaces';
5
5
  import { UUID } from '@lumino/coreutils';
6
6
  import { Signal } from '@lumino/signaling';
7
- import { ElementAttrs, VirtualElement, VirtualNode } from '@lumino/virtualdom';
7
+ import type {
8
+ ElementAttrs,
9
+ VirtualElement,
10
+ VirtualNode
11
+ } from '@lumino/virtualdom';
8
12
  import React from 'react';
9
- import { createRoot, Root } from 'react-dom/client';
13
+ import type { Root } from 'react-dom/client';
14
+ import { createRoot } from 'react-dom/client';
10
15
  import badSvgstr from '../../style/debug/bad.svg';
11
16
  import blankSvgstr from '../../style/debug/blank.svg';
12
17
  import refreshSvgstr from '../../style/icons/toolbar/refresh.svg';
@@ -1,7 +1,8 @@
1
1
  // Copyright (c) Jupyter Development Team.
2
2
  // Distributed under the terms of the Modified BSD License.
3
3
 
4
- import { h, VirtualElement } from '@lumino/virtualdom';
4
+ import type { VirtualElement } from '@lumino/virtualdom';
5
+ import { h } from '@lumino/virtualdom';
5
6
  import { CommandPalette } from '@lumino/widgets';
6
7
  import { LabIconStyle } from '../../style';
7
8
  import { classes } from '../../utils';
@@ -27,9 +28,7 @@ export namespace CommandPaletteSvg {
27
28
  renderHeader(data: CommandPalette.IHeaderRenderData): VirtualElement {
28
29
  const content = this.formatHeader(data);
29
30
  return h.li(
30
- {
31
- className: classes('lm-CommandPalette-header', 'jp-icon-hoverShow')
32
- },
31
+ { className: classes('lm-CommandPalette-header', 'jp-icon-hoverShow') },
33
32
  content,
34
33
  h.span(searchHeaderIcon)
35
34
  );
@@ -1,9 +1,11 @@
1
1
  // Copyright (c) Jupyter Development Team.
2
2
  // Distributed under the terms of the Modified BSD License.
3
3
 
4
- import { IDisposable } from '@lumino/disposable';
5
- import { ISignal, Signal } from '@lumino/signaling';
6
- import { h, VirtualElement } from '@lumino/virtualdom';
4
+ import type { IDisposable } from '@lumino/disposable';
5
+ import type { ISignal } from '@lumino/signaling';
6
+ import { Signal } from '@lumino/signaling';
7
+ import type { VirtualElement } from '@lumino/virtualdom';
8
+ import { h } from '@lumino/virtualdom';
7
9
  import { ContextMenu, Menu } from '@lumino/widgets';
8
10
  import { LabIconStyle } from '../../style';
9
11
  import { classes } from '../../utils';
@@ -1,9 +1,12 @@
1
1
  // Copyright (c) Jupyter Development Team.
2
2
  // Distributed under the terms of the Modified BSD License.
3
3
 
4
- import { ITranslator, nullTranslator } from '@jupyterlab/translation';
5
- import { hpass, VirtualElement } from '@lumino/virtualdom';
6
- import { DockPanel, TabBar, TabPanel, Widget } from '@lumino/widgets';
4
+ import type { ITranslator } from '@jupyterlab/translation';
5
+ import { nullTranslator } from '@jupyterlab/translation';
6
+ import type { VirtualElement } from '@lumino/virtualdom';
7
+ import { hpass } from '@lumino/virtualdom';
8
+ import type { Widget } from '@lumino/widgets';
9
+ import { DockPanel, TabBar, TabPanel } from '@lumino/widgets';
7
10
  import { LabIconStyle } from '../../style';
8
11
  import { classes } from '../../utils';
9
12
  import { addIcon, closeIcon } from '../iconimports';
package/src/style/icon.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  // Distributed under the terms of the Modified BSD License.
3
3
 
4
4
  import { style as typestyleClass } from 'typestyle/lib';
5
- import { NestedCSSProperties } from 'typestyle/lib/types';
5
+ import type { NestedCSSProperties } from 'typestyle/lib/types';
6
6
 
7
7
  export namespace LabIconStyle {
8
8
  /**
package/src/utils.ts CHANGED
@@ -14,8 +14,8 @@ function _classes(
14
14
  c && typeof c === 'object'
15
15
  ? Object.keys(c).map(key => !!c[key] && key)
16
16
  : typeof c === 'string'
17
- ? c.split(/\s+/)
18
- : []
17
+ ? c.split(/\s+/)
18
+ : []
19
19
  )
20
20
  .reduce((flattened, c) => flattened.concat(c), [] as string[])
21
21
  .filter(c => !!c) as string[];
@@ -7,7 +7,6 @@
7
7
  height: 100%;
8
8
  position: relative;
9
9
  overflow: auto;
10
- overflow-anchor: none;
11
10
  }
12
11
 
13
12
  .jp-WindowedPanel-inner {