@jupyterlab/ui-components 4.4.0-alpha.2 → 4.4.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.
Files changed (38) hide show
  1. package/lib/FormRendererRegistry.js.map +1 -1
  2. package/lib/components/accordiontoolbar.js.map +1 -1
  3. package/lib/components/collapser.js.map +1 -1
  4. package/lib/components/form.js.map +1 -1
  5. package/lib/components/iframe.js.map +1 -1
  6. package/lib/components/menu.js.map +1 -1
  7. package/lib/components/search.d.ts +10 -3
  8. package/lib/components/search.js +42 -8
  9. package/lib/components/search.js.map +1 -1
  10. package/lib/components/sidepanel.js.map +1 -1
  11. package/lib/components/styling.js.map +1 -1
  12. package/lib/components/switch.js.map +1 -1
  13. package/lib/components/table.js.map +1 -1
  14. package/lib/components/toolbar.js.map +1 -1
  15. package/lib/components/vdom.js.map +1 -1
  16. package/lib/components/windowedlist.js +4 -2
  17. package/lib/components/windowedlist.js.map +1 -1
  18. package/lib/hoverbox.js.map +1 -1
  19. package/lib/icon/iconimports.d.ts +5 -0
  20. package/lib/icon/iconimports.js +10 -0
  21. package/lib/icon/iconimports.js.map +1 -1
  22. package/lib/icon/labicon.js.map +1 -1
  23. package/lib/icon/widgets/commandpalettesvg.js.map +1 -1
  24. package/lib/icon/widgets/menusvg.js.map +1 -1
  25. package/lib/style/icon.js.map +1 -1
  26. package/lib/utils.js.map +1 -1
  27. package/package.json +8 -8
  28. package/src/components/search.tsx +68 -15
  29. package/src/components/windowedlist.ts +4 -2
  30. package/src/icon/iconimports.ts +10 -0
  31. package/style/deprecated.css +25 -0
  32. package/style/icons/filetype/r-kernel.svg +3 -2
  33. package/style/icons/toolbar/dock-bottom.svg +3 -0
  34. package/style/icons/toolbar/dock-left.svg +3 -0
  35. package/style/icons/toolbar/dock-right.svg +3 -0
  36. package/style/icons/toolbar/dock-top.svg +3 -0
  37. package/style/icons/toolbar/dots.svg +8 -0
  38. package/style/windowedlist.css +1 -0
@@ -2,9 +2,10 @@
2
2
  // Distributed under the terms of the Modified BSD License.
3
3
  import { ReactWidget } from './vdom';
4
4
  import { StringExt } from '@lumino/algorithm';
5
- import React, { useCallback, useEffect, useState } from 'react';
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
9
 
9
10
  /**
10
11
  * The class name added to the filebrowser crumbs node.
@@ -56,7 +57,15 @@ export interface IFilterBoxProps {
56
57
  /**
57
58
  * Whether to use the fuzzy filter.
58
59
  */
59
- useFuzzyFilter: boolean;
60
+ useFuzzyFilter?: boolean;
61
+
62
+ /**
63
+ * Signal emitted when filter settings change
64
+ */
65
+ filterSettingsChanged?: ISignal<
66
+ unknown,
67
+ { [P in keyof IFilterBoxProps]?: IFilterBoxProps[P] }
68
+ >;
60
69
  }
61
70
 
62
71
  /**
@@ -125,7 +134,7 @@ export function fuzzySearch(source: string, query: string): IScore | null {
125
134
 
126
135
  export const updateFilterFunction = (
127
136
  value: string,
128
- useFuzzyFilter: boolean,
137
+ useFuzzyFilter?: boolean,
129
138
  caseSensitive?: boolean
130
139
  ) => {
131
140
  return (item: string): Partial<IScore> | null => {
@@ -144,7 +153,7 @@ export const updateFilterFunction = (
144
153
  return null;
145
154
  }
146
155
  return {
147
- indices: [...Array(item.length).keys()].map(x => x + 1)
156
+ indices: [...Array(value.length).keys()].map(x => x + i)
148
157
  };
149
158
  };
150
159
  };
@@ -159,20 +168,37 @@ export const FilterBox = (props: IFilterBoxProps): JSX.Element => {
159
168
  });
160
169
  }, []);
161
170
  }
171
+ const firstRender = useRef(true);
172
+ const inputRef = props.inputRef ?? useRef<HTMLInputElement>();
162
173
 
163
174
  useEffect(() => {
164
175
  // If there is an initial search value, pass the parent the initial filter function for that value.
165
- if (props.initialQuery !== undefined) {
166
- props.updateFilter(
167
- updateFilterFunction(
168
- props.initialQuery,
169
- props.useFuzzyFilter,
170
- props.caseSensitive
171
- ),
172
- props.initialQuery
173
- );
176
+ if (firstRender.current) {
177
+ firstRender.current = false;
178
+ if (props.initialQuery !== undefined) {
179
+ props.updateFilter(
180
+ updateFilterFunction(
181
+ props.initialQuery,
182
+ props.useFuzzyFilter,
183
+ props.caseSensitive
184
+ ),
185
+ props.initialQuery
186
+ );
187
+ }
188
+ } else {
189
+ if (inputRef.current) {
190
+ // If filter settings changed, update the filter
191
+ props.updateFilter(
192
+ updateFilterFunction(
193
+ inputRef.current.value,
194
+ props.useFuzzyFilter,
195
+ props.caseSensitive
196
+ ),
197
+ inputRef.current.value
198
+ );
199
+ }
174
200
  }
175
- }, []);
201
+ }, [props.updateFilter, props.useFuzzyFilter, props.caseSensitive]);
176
202
 
177
203
  /**
178
204
  * Handler for search input changes.
@@ -215,6 +241,33 @@ export const FilterBox = (props: IFilterBoxProps): JSX.Element => {
215
241
  /**
216
242
  * A widget which hosts a input textbox to filter on file names.
217
243
  */
244
+ class FilenameSearcherWidget extends ReactWidget {
245
+ constructor(props: IFilterBoxProps) {
246
+ super();
247
+ this._filterBoxProps = { ...props };
248
+ props?.filterSettingsChanged?.connect((_, args) => {
249
+ this._updateProps(args);
250
+ }, this);
251
+ }
252
+
253
+ render(): JSX.Element {
254
+ return <FilterBox {...this._filterBoxProps} />;
255
+ }
256
+
257
+ /**
258
+ * Update a specific prop.
259
+ */
260
+ private _updateProps(props: Partial<IFilterBoxProps>): void {
261
+ Object.assign(this._filterBoxProps, props);
262
+ this.update();
263
+ }
264
+
265
+ private _filterBoxProps: IFilterBoxProps;
266
+ }
267
+
268
+ /**
269
+ * Function which returns a widget that hosts an input textbox to filter on file names.
270
+ */
218
271
  export const FilenameSearcher = (props: IFilterBoxProps): ReactWidget => {
219
- return ReactWidget.create(<FilterBox {...props} />);
272
+ return new FilenameSearcherWidget(props);
220
273
  };
@@ -989,9 +989,11 @@ export class WindowedList<
989
989
  handleEvent(event: Event): void {
990
990
  switch (event.type) {
991
991
  case 'pointerdown':
992
- event.preventDefault();
993
- event.stopPropagation();
994
992
  this._evtPointerDown(event as PointerEvent);
993
+ // Stop propagation of this event; a `mousedown` event will still
994
+ // be automatically dispatched and handled by the parent notebook
995
+ // (which will close any open context menu, etc.)
996
+ event.stopPropagation();
995
997
  break;
996
998
  case 'scroll':
997
999
  this.onScroll(event);
@@ -39,6 +39,11 @@ import copySvgstr from '../../style/icons/toolbar/copy.svg';
39
39
  import copyrightSvgstr from '../../style/icons/licenses/copyright.svg';
40
40
  import cutSvgstr from '../../style/icons/toolbar/cut.svg';
41
41
  import deleteSvgstr from '../../style/icons/toolbar/delete.svg';
42
+ import dockBottomSvgstr from '../../style/icons/toolbar/dock-bottom.svg';
43
+ import dockLeftSvgstr from '../../style/icons/toolbar/dock-left.svg';
44
+ import dockRightSvgstr from '../../style/icons/toolbar/dock-right.svg';
45
+ import dockTopSvgstr from '../../style/icons/toolbar/dock-top.svg';
46
+ import dotsSvgstr from '../../style/icons/toolbar/dots.svg';
42
47
  import downloadSvgstr from '../../style/icons/toolbar/download.svg';
43
48
  import duplicateSvgstr from '../../style/icons/toolbar/duplicate.svg';
44
49
  import editSvgstr from '../../style/icons/toolbar/edit.svg';
@@ -155,6 +160,11 @@ export const copyIcon = new LabIcon({ name: 'ui-components:copy', svgstr: copySv
155
160
  export const copyrightIcon = new LabIcon({ name: 'ui-components:copyright', svgstr: copyrightSvgstr });
156
161
  export const cutIcon = new LabIcon({ name: 'ui-components:cut', svgstr: cutSvgstr });
157
162
  export const deleteIcon = new LabIcon({ name: 'ui-components:delete', svgstr: deleteSvgstr });
163
+ export const dockBottomIcon = new LabIcon({ name: 'ui-components:dock-bottom', svgstr: dockBottomSvgstr });
164
+ export const dockLeftIcon = new LabIcon({ name: 'ui-components:dock-left', svgstr: dockLeftSvgstr });
165
+ export const dockRightIcon = new LabIcon({ name: 'ui-components:dock-right', svgstr: dockRightSvgstr });
166
+ export const dockTopIcon = new LabIcon({ name: 'ui-components:dock-top', svgstr: dockTopSvgstr });
167
+ export const dotsIcon = new LabIcon({ name: 'ui-components:dots', svgstr: dotsSvgstr });
158
168
  export const downloadIcon = new LabIcon({ name: 'ui-components:download', svgstr: downloadSvgstr });
159
169
  export const duplicateIcon = new LabIcon({ name: 'ui-components:duplicate', svgstr: duplicateSvgstr });
160
170
  export const editIcon = new LabIcon({ name: 'ui-components:edit', svgstr: editSvgstr });
@@ -43,6 +43,11 @@
43
43
  --jp-icon-copyright: url('icons/licenses/copyright.svg');
44
44
  --jp-icon-cut: url('icons/toolbar/cut.svg');
45
45
  --jp-icon-delete: url('icons/toolbar/delete.svg');
46
+ --jp-icon-dock-bottom: url('icons/toolbar/dock-bottom.svg');
47
+ --jp-icon-dock-left: url('icons/toolbar/dock-left.svg');
48
+ --jp-icon-dock-right: url('icons/toolbar/dock-right.svg');
49
+ --jp-icon-dock-top: url('icons/toolbar/dock-top.svg');
50
+ --jp-icon-dots: url('icons/toolbar/dots.svg');
46
51
  --jp-icon-download: url('icons/toolbar/download.svg');
47
52
  --jp-icon-duplicate: url('icons/toolbar/duplicate.svg');
48
53
  --jp-icon-edit: url('icons/toolbar/edit.svg');
@@ -254,6 +259,26 @@
254
259
  background-image: var(--jp-icon-delete);
255
260
  }
256
261
 
262
+ .jp-DockBottomIcon {
263
+ background-image: var(--jp-icon-dock-bottom);
264
+ }
265
+
266
+ .jp-DockLeftIcon {
267
+ background-image: var(--jp-icon-dock-left);
268
+ }
269
+
270
+ .jp-DockRightIcon {
271
+ background-image: var(--jp-icon-dock-right);
272
+ }
273
+
274
+ .jp-DockTopIcon {
275
+ background-image: var(--jp-icon-dock-top);
276
+ }
277
+
278
+ .jp-DotsIcon {
279
+ background-image: var(--jp-icon-dots);
280
+ }
281
+
257
282
  .jp-DownloadIcon {
258
283
  background-image: var(--jp-icon-download);
259
284
  }
@@ -1,3 +1,4 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="16" viewBox="0 0 22 22">
2
- <path fill="#2196F3" d="M4.4 2.5c1.2-.1 2.9-.3 4.9-.3 2.5 0 4.1.4 5.2 1.3 1 .7 1.5 1.9 1.5 3.5 0 2-1.4 3.5-2.9 4.1 1.2.4 1.7 1.6 2.2 3 .6 1.9 1 3.9 1.3 4.6h-3.8c-.3-.4-.8-1.7-1.2-3.7s-1.2-2.6-2.6-2.6h-.9v6.4H4.4zm3.7 6.9h1.4c1.9 0 2.9-.9 2.9-2.3s-1-2.3-2.8-2.3c-.7 0-1.3 0-1.6.2v4.5h.1z" class="jp-icon-contrast3 jp-icon-selectable"/>
1
+ <svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid" width="16" height="16" viewBox="0 0 724 561">
2
+ <path class="jp-icon-selectable" d="M361.453,485.937 C162.329,485.937 0.906,377.828 0.906,244.469 C0.906,111.109 162.329,3.000 361.453,3.000 C560.578,3.000 722.000,111.109 722.000,244.469 C722.000,377.828 560.578,485.937 361.453,485.937 ZM416.641,97.406 C265.289,97.406 142.594,171.314 142.594,262.484 C142.594,353.654 265.289,427.562 416.641,427.562 C567.992,427.562 679.687,377.033 679.687,262.484 C679.687,147.971 567.992,97.406 416.641,97.406 Z" fill="rgb(179,179,179)" fill-rule="evenodd"/>
3
+ <path class="jp-icon-selectable" d="M550.000,377.000 C550.000,377.000 571.822,383.585 584.500,390.000 C588.899,392.226 596.510,396.668 602.000,402.500 C607.378,408.212 610.000,414.000 610.000,414.000 L696.000,559.000 L557.000,559.062 L492.000,437.000 C492.000,437.000 478.690,414.131 470.500,407.500 C463.668,401.969 460.755,400.000 454.000,400.000 C449.298,400.000 420.974,400.000 420.974,400.000 L421.000,558.974 L298.000,559.026 L298.000,152.938 L545.000,152.938 C545.000,152.938 657.500,154.967 657.500,262.000 C657.500,369.033 550.000,377.000 550.000,377.000 ZM496.500,241.024 L422.037,240.976 L422.000,310.026 L496.500,310.002 C496.500,310.002 531.000,309.895 531.000,274.877 C531.000,239.155 496.500,241.024 496.500,241.024 Z" fill="rgb(52,101,176)" fill-rule="evenodd"/>
3
4
  </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="16" version="1.1" viewBox="0 0 22 22" xmlns="http://www.w3.org/2000/svg">
2
+ <path class="jp-icon3" d="m19.8 19.8v-17.6h-17.6v17.6zm-15.408-2.2v-3.8027h13.208v3.8027zm13.208-5.5301h-13.218v-7.6699h13.218z" fill="#616161"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="16" version="1.1" viewBox="0 0 22 22" xmlns="http://www.w3.org/2000/svg">
2
+ <path class="jp-icon3" d="m2.2 19.8h17.6v-17.6h-17.6zm2.2-15.408h3.8027v13.208h-3.8027zm5.5301 13.208v-13.218h7.6699v13.218z" fill="#616161"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="16" version="1.1" viewBox="0 0 22 22" xmlns="http://www.w3.org/2000/svg">
2
+ <path class="jp-icon3" d="m19.8 2.2h-17.6v17.6h17.6zm-2.2 15.408h-3.8027v-13.208h3.8027zm-5.5301-13.208v13.218h-7.6699v-13.218z" fill="#616161"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="16" version="1.1" viewBox="0 0 22 22" xmlns="http://www.w3.org/2000/svg">
2
+ <path class="jp-icon3" d="m2.2 2.2v17.6h17.6v-17.6zm15.408 2.2v3.8027h-13.208v-3.8027zm-13.208 5.5301h13.218v7.6699h-13.218z" fill="#616161"/>
3
+ </svg>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="16" version="1.1" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
3
+ <g class="jp-icon3" transform="rotate(90,12,12)" fill="#616161">
4
+ <circle cx="5" cy="12" r="2"/>
5
+ <circle cx="12" cy="12" r="2"/>
6
+ <circle cx="19" cy="12" r="2"/>
7
+ </g>
8
+ </svg>
@@ -23,6 +23,7 @@
23
23
  .jp-WindowedPanel-scrollbar {
24
24
  display: none;
25
25
  position: relative;
26
+ user-select: none;
26
27
  }
27
28
 
28
29
  .jp-WindowedPanel.jp-mod-virtual-scrollbar > .jp-WindowedPanel-scrollbar {