@refinitiv-ui/elements 6.14.0 → 6.14.2

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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [6.14.2](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.14.1...@refinitiv-ui/elements@6.14.2) (2023-11-06)
7
+
8
+ **Note:** Version bump only for package @refinitiv-ui/elements
9
+
10
+ ## [6.14.1](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.14.0...@refinitiv-ui/elements@6.14.1) (2023-10-31)
11
+
12
+ ### Bug Fixes
13
+
14
+ - **list:** selectItem() should always require a param ([#1010](https://github.com/Refinitiv/refinitiv-ui/issues/1010)) ([3ac0c7b](https://github.com/Refinitiv/refinitiv-ui/commit/3ac0c7b5bde4361ee5dd8dabef06adc1ce2be2d7))
15
+ - update `@trivago/prettier-plugin-sort-imports` to fix babel vulnerable to arbitrary code execution ([#1003](https://github.com/Refinitiv/refinitiv-ui/issues/1003)) ([11ce611](https://github.com/Refinitiv/refinitiv-ui/commit/11ce6112f96d11c9c6618ac577dc6ba933c0d126))
16
+
6
17
  # [6.14.0](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.13.2...@refinitiv-ui/elements@6.14.0) (2023-10-24)
7
18
 
8
19
  ### Bug Fixes
@@ -6,9 +6,9 @@ import '../item/index.js';
6
6
  import '../loader/index.js';
7
7
  import { Overlay } from '../overlay/index.js';
8
8
  import { renderer } from './helpers/renderer.js';
9
- import { escapeRegExp, itemHighlightable, queryWordSelect } from './helpers/utils.js';
10
9
  import type { AutosuggestHighlightItemEvent, AutosuggestHighlightable, AutosuggestItem, AutosuggestMethodType, AutosuggestQuery, AutosuggestReason, AutosuggestRenderer, AutosuggestSelectItemEvent, AutosuggestTargetElement } from './helpers/types';
11
10
  import type { AddAttachTargetEventsEvent, ItemHighlightEvent, ItemSelectEvent, RemoveAttachTargetEventsEvent, SuggestionsChangedEvent, SuggestionsClearRequestedEvent, SuggestionsFetchRequestedEvent, SuggestionsQueryEvent } from './helpers/types';
11
+ import { escapeRegExp, itemHighlightable, queryWordSelect } from './helpers/utils.js';
12
12
  export type { AutosuggestTargetElement, AutosuggestHighlightable, AutosuggestMethodType, AutosuggestQuery, AutosuggestRenderer, AutosuggestReason, AutosuggestItem, ItemHighlightEvent, AddAttachTargetEventsEvent, RemoveAttachTargetEventsEvent, ItemSelectEvent, SuggestionsFetchRequestedEvent, SuggestionsClearRequestedEvent, SuggestionsQueryEvent, SuggestionsChangedEvent };
13
13
  export { updateElementContent } from './helpers/utils.js';
14
14
  export { itemHighlightable, escapeRegExp, queryWordSelect, renderer, renderer as itemRenderer };
@@ -2,9 +2,9 @@ import { JSXInterface } from '../jsx';
2
2
  /// <reference types="chart.js" />
3
3
  import 'chart.js/dist/Chart.bundle.min.js';
4
4
  import { BasicElement, CSSResultGroup, PropertyValues, TemplateResult } from '@refinitiv-ui/core';
5
+ import type { Header } from '../header';
5
6
  import '../header/index.js';
6
7
  import '../layout/index.js';
7
- import type { Header } from '../header';
8
8
  import type { ChartConfig, ChartJS, ChartUpdateProps, DatasetColors } from './helpers/types';
9
9
  declare global {
10
10
  interface Window {
@@ -1,7 +1,7 @@
1
+ import type { DataItem } from '@refinitiv-ui/utils/collection.js';
1
2
  import type { ItemData } from '../../item';
2
3
  import type { ComboBox } from '../index';
3
4
  import type { ComboBoxFilter } from './types';
4
- import type { DataItem } from '@refinitiv-ui/utils/collection.js';
5
5
  /**
6
6
  * Default filter used by combo box
7
7
  * @param el ComboBox instance to filter
@@ -1,3 +1,4 @@
1
+ import escapeStringRegexp from 'escape-string-regexp';
1
2
  /**
2
3
  * Default filter used by combo box
3
4
  * @param el ComboBox instance to filter
@@ -14,7 +15,7 @@ export const defaultFilter = (el) => {
14
15
  const getRegularExpressionOfQuery = () => {
15
16
  if (el.query !== query || !queryRegExp) {
16
17
  query = el.query || '';
17
- queryRegExp = new RegExp(query.replace(/(\W)/g, '\\$1'), 'i');
18
+ queryRegExp = new RegExp(escapeStringRegexp(query), 'i');
18
19
  }
19
20
  return queryRegExp;
20
21
  };
@@ -1,5 +1,5 @@
1
- import type { ItemData } from '../../item';
2
1
  import type { DataItem } from '@refinitiv-ui/utils/collection.js';
2
+ import type { ItemData } from '../../item';
3
3
  /**
4
4
  * Predicate callback
5
5
  * Matches item against filter function
@@ -7,12 +7,12 @@ import { AnimationTaskRunner } from '@refinitiv-ui/utils/async.js';
7
7
  import { CollectionComposer, DataItem } from '@refinitiv-ui/utils/collection.js';
8
8
  import '../counter/index.js';
9
9
  import '../icon/index.js';
10
+ import type { ItemData } from '../item';
11
+ import type { List } from '../list';
10
12
  import '../list/index.js';
11
13
  import '../overlay/index.js';
12
14
  import { CustomKeyboardEvent } from './helpers/keyboard-event.js';
13
15
  import { ComboBoxRenderer } from './helpers/renderer.js';
14
- import type { ItemData } from '../item';
15
- import type { List } from '../list';
16
16
  import type { ComboBoxData, ComboBoxFilter } from './helpers/types';
17
17
  export type { ComboBoxFilter, ComboBoxData };
18
18
  export { ComboBoxRenderer };
@@ -1,5 +1,5 @@
1
- import type { HSLColor, RGBColor } from '@refinitiv-ui/utils/color.js';
2
1
  import type { AreaSeriesPartialOptions, AreaStyleOptions, BarData, BarSeriesPartialOptions, BarStyleOptions, CandlestickSeriesPartialOptions, CandlestickStyleOptions, ChartOptions, DeepPartial, HistogramData, HistogramSeriesPartialOptions, HistogramStyleOptions, ISeriesApi, LineData, LineSeriesPartialOptions, LineStyleOptions, SeriesPartialOptions, SeriesType } from 'lightweight-charts';
2
+ import type { HSLColor, RGBColor } from '@refinitiv-ui/utils/color.js';
3
3
  type SeriesOptions = AreaSeriesPartialOptions | BarSeriesPartialOptions | CandlestickSeriesPartialOptions | HistogramSeriesPartialOptions | LineSeriesPartialOptions;
4
4
  type SeriesStyleOptions = LineStyleOptions & AreaStyleOptions & BarStyleOptions & CandlestickStyleOptions & HistogramStyleOptions;
5
5
  type SeriesData = LineData[] | BarData[] | HistogramData[];
@@ -16,14 +16,14 @@ Provides listing and immutable selection
16
16
 
17
17
  ## Methods
18
18
 
19
- | Method | Type | Description |
20
- |----------------|--------------------------------------|--------------------------------------------------|
21
- | `down` | `(): void` | Navigate down through the list items |
22
- | `first` | `(): void` | Navigate to first focusable item of the list |
23
- | `last` | `(): void` | Navigate to first focusable item of the list |
24
- | `scrollToItem` | `(item: T): void` | Scroll to list item element<br /><br />**item**: Data item to scroll to |
25
- | `selectItem` | `(item?: T \| HTMLElement): boolean` | Selects an item in the list<br /><br />**item**: Data Item or Item Element |
26
- | `up` | `(): void` | Navigate up through the list items |
19
+ | Method | Type | Description |
20
+ |----------------|-------------------------------------|--------------------------------------------------|
21
+ | `down` | `(): void` | Navigate down through the list items |
22
+ | `first` | `(): void` | Navigate to first focusable item of the list |
23
+ | `last` | `(): void` | Navigate to first focusable item of the list |
24
+ | `scrollToItem` | `(item: T): void` | Scroll to list item element<br /><br />**item**: Data item to scroll to |
25
+ | `selectItem` | `(item: T \| HTMLElement): boolean` | Selects an item in the list<br /><br />**item**: Data Item or Item Element |
26
+ | `up` | `(): void` | Navigate up through the list items |
27
27
 
28
28
  ## Events
29
29
 
@@ -1,10 +1,10 @@
1
1
  import { JSXInterface } from '../../jsx';
2
2
  import { CSSResultGroup, ControlElement, PropertyValues, TapEvent, TemplateResult, WarningNotice } from '@refinitiv-ui/core';
3
3
  import { CollectionComposer, DataItem } from '@refinitiv-ui/utils/collection.js';
4
- import { ListRenderer } from '../helpers/renderer.js';
5
- import './list-item.js';
6
4
  import type { ItemData } from '../../item';
5
+ import { ListRenderer } from '../helpers/renderer.js';
7
6
  import type { ListData } from '../helpers/types';
7
+ import './list-item.js';
8
8
  /**
9
9
  * Key direction
10
10
  */
@@ -93,7 +93,7 @@ export declare class List<T extends DataItem = ItemData> extends ControlElement
93
93
  * @param {T | HTMLElement} item Data Item or Item Element
94
94
  * @returns If a selection has been made or not
95
95
  */
96
- selectItem(item?: T | HTMLElement): boolean;
96
+ selectItem(item: T | HTMLElement): boolean;
97
97
  /**
98
98
  * Navigate up through the list items
99
99
  * @returns {void}
@@ -164,21 +164,28 @@ let List = class List extends ControlElement {
164
164
  * @returns If a selection has been made or not
165
165
  */
166
166
  selectItem(item) {
167
- if (!this.stateless) {
168
- if (item instanceof HTMLElement) {
169
- item = this.itemFromElement(item);
170
- }
171
- if (item && this.multiple) {
172
- const value = this.composer.getItemPropertyValue(item, 'selected');
173
- this.composer.setItemPropertyValue(item, 'selected', !value);
174
- return true;
167
+ if (this.stateless) {
168
+ return false;
169
+ }
170
+ if (item instanceof HTMLElement) {
171
+ const itemFromElement = this.itemFromElement(item);
172
+ if (itemFromElement) {
173
+ item = itemFromElement;
175
174
  }
176
- if (item && this.composer.getItemPropertyValue(item, 'selected') !== true) {
177
- this.clearSelection();
178
- this.composer.setItemPropertyValue(item, 'selected', true);
179
- return true;
175
+ else {
176
+ return false;
180
177
  }
181
178
  }
179
+ if (this.multiple) {
180
+ const value = this.composer.getItemPropertyValue(item, 'selected');
181
+ this.composer.setItemPropertyValue(item, 'selected', !value);
182
+ return true;
183
+ }
184
+ if (this.composer.getItemPropertyValue(item, 'selected') !== true) {
185
+ this.clearSelection();
186
+ this.composer.setItemPropertyValue(item, 'selected', true);
187
+ return true;
188
+ }
182
189
  return false;
183
190
  }
184
191
  /**
@@ -1,3 +1,3 @@
1
- import type { ItemData } from '../../item';
2
1
  import type { CollectionComposer, DataItem } from '@refinitiv-ui/utils/collection.js';
2
+ import type { ItemData } from '../../item';
3
3
  export type ListData<T extends DataItem = ItemData> = T[] | CollectionComposer<T> | null;
@@ -1,5 +1,5 @@
1
- import { ExtensibleFunction } from './extensible-function.js';
2
1
  import type { CollectionComposer, DataItem } from '@refinitiv-ui/utils/collection.js';
2
+ import { ExtensibleFunction } from './extensible-function.js';
3
3
  /**
4
4
  * Render function interface
5
5
  * TODO: Move this to @refinitiv-ui/utils
@@ -1,5 +1,5 @@
1
- import '../elements/overlay-backdrop.js';
2
1
  import type { Overlay } from '../elements/overlay';
2
+ import '../elements/overlay-backdrop.js';
3
3
  /**
4
4
  * Backdrop manager adds a backdrop to the body
5
5
  * @returns {void}
@@ -1,5 +1,5 @@
1
- import '../elements/overlay-viewport.js';
2
1
  import type { Overlay } from '../elements/overlay';
2
+ import '../elements/overlay-viewport.js';
3
3
  import type { ViewAreaInfo } from '../helpers/types';
4
4
  /**
5
5
  * Viewport manager singleton is responsible for getting
@@ -92,6 +92,7 @@ export class ViewportManager {
92
92
  // Kept here for compatibility with old apps
93
93
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
94
94
  // @ts-ignore
95
+ // TODO: Remove @ts-ignore and re-test again when standardized zoom is implemented across major browsers and TypeScript, https://github.com/w3c/csswg-drafts/issues/5623
95
96
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
96
97
  const zoom = parseFloat(window.getComputedStyle(document.body).zoom);
97
98
  const screenHeight = screenRect.height / zoom;
@@ -1,6 +1,6 @@
1
+ import type { CollectionComposer } from '@refinitiv-ui/utils/collection.js';
1
2
  import type { Item, ItemData } from '../../item';
2
3
  import type { OverlayMenu } from '../index';
3
- import type { CollectionComposer } from '@refinitiv-ui/utils/collection.js';
4
4
  export type NestedMenu = {
5
5
  menu: OverlayMenu;
6
6
  item: Item;
@@ -1,5 +1,5 @@
1
- import { OverlayMenu } from '../index.js';
2
1
  import type { Item } from '../../item';
2
+ import { OverlayMenu } from '../index.js';
3
3
  /**
4
4
  * Overlay menu manager monitors menu nesting and ensures
5
5
  * that only a single menu tree can be opened
@@ -1,7 +1,7 @@
1
1
  import { JSXInterface } from '../jsx';
2
2
  import { BasicElement, CSSResultGroup, PropertyValues, TemplateResult } from '@refinitiv-ui/core';
3
- import '../layout/index.js';
4
3
  import type { Layout } from '../layout';
4
+ import '../layout/index.js';
5
5
  /**
6
6
  * Provides an app layout with sidebar.
7
7
  * There are 4 sections that can be slotted a component in.
@@ -1,10 +1,10 @@
1
1
  import { JSXInterface } from '../jsx';
2
2
  import { BasicElement, CSSResultGroup, PropertyValues, TemplateResult } from '@refinitiv-ui/core';
3
+ import type { OverlayTransitionStyle as TooltipTransitionStyle } from '../overlay';
3
4
  import '../overlay/index.js';
4
5
  import './elements/title-tooltip.js';
5
6
  import { deregister as deregisterOverflowTooltip, register as registerOverflowTooltip } from './helpers/overflow-tooltip.js';
6
7
  import { TooltipCondition, TooltipPosition, TooltipRenderer } from './helpers/types.js';
7
- import type { OverlayTransitionStyle as TooltipTransitionStyle } from '../overlay';
8
8
  /**
9
9
  * Tooltip displays extra information when the
10
10
  * user hovers the pointer over an item.
@@ -2,8 +2,8 @@ import { JSXInterface } from '../../jsx';
2
2
  import { ControlElement, PropertyValues, TemplateResult } from '@refinitiv-ui/core';
3
3
  import '../../checkbox/index.js';
4
4
  import '../../icon/index.js';
5
- import { CheckedState } from '../managers/tree-manager.js';
6
5
  import type { TreeDataItem } from '../helpers/types';
6
+ import { CheckedState } from '../managers/tree-manager.js';
7
7
  /**
8
8
  * Displays a tree list item.
9
9
  * Groups display expansion arrows.
@@ -3,9 +3,9 @@ import { PropertyValues, TapEvent } from '@refinitiv-ui/core';
3
3
  import { CollectionComposer } from '@refinitiv-ui/utils/collection.js';
4
4
  import { List } from '../../list/index.js';
5
5
  import { TreeRenderer } from '../helpers/renderer.js';
6
+ import type { TreeData, TreeDataItem, TreeFilter } from '../helpers/types';
6
7
  import { TreeManagerMode } from '../managers/tree-manager.js';
7
8
  import './tree-item.js';
8
- import type { TreeData, TreeDataItem, TreeFilter } from '../helpers/types';
9
9
  /**
10
10
  * Displays a tree structure
11
11
  * to be used for menus and group selections
@@ -1,3 +1,4 @@
1
+ import escapeStringRegexp from 'escape-string-regexp';
1
2
  /**
2
3
  * Default filter used by tree
3
4
  * @param el Tree instance to filter
@@ -14,7 +15,7 @@ export const defaultFilter = (el) => {
14
15
  const getRegularExpressionOfQuery = () => {
15
16
  if (el.query !== query || !queryRegExp) {
16
17
  query = el.query || '';
17
- queryRegExp = new RegExp(query.replace(/(\W)/g, '\\$1'), 'i');
18
+ queryRegExp = new RegExp(escapeStringRegexp(query), 'i');
18
19
  }
19
20
  return queryRegExp;
20
21
  };
@@ -1,5 +1,5 @@
1
- import type { TreeDataItem } from '../helpers/types';
2
1
  import type { CollectionComposer } from '@refinitiv-ui/utils/collection.js';
2
+ import type { TreeDataItem } from '../helpers/types';
3
3
  export declare enum CheckedState {
4
4
  CHECKED = 1,
5
5
  UNCHECKED = 0,
@@ -7,14 +7,14 @@ import { CollectionComposer } from '@refinitiv-ui/utils/collection.js';
7
7
  import '../button/index.js';
8
8
  import '../checkbox/index.js';
9
9
  import { ComboBox, ComboBoxFilter as TreeSelectFilter } from '../combo-box/index.js';
10
+ import type { CheckChangedEvent } from '../events';
10
11
  import '../icon/index.js';
12
+ import type { Overlay } from '../overlay';
11
13
  import '../pill/index.js';
12
14
  import '../tree/index.js';
13
15
  import { TreeRenderer as TreeSelectRenderer } from '../tree/index.js';
14
- import { TreeManager, TreeManagerMode } from '../tree/managers/tree-manager.js';
15
- import type { CheckChangedEvent } from '../events';
16
- import type { Overlay } from '../overlay';
17
16
  import type { Tree } from '../tree/index.js';
17
+ import { TreeManager, TreeManagerMode } from '../tree/managers/tree-manager.js';
18
18
  import type { TreeSelectData, TreeSelectDataItem } from './helpers/types';
19
19
  export { TreeSelectRenderer };
20
20
  export type { TreeSelectFilter, TreeSelectDataItem, TreeSelectData };
package/lib/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '6.14.0';
1
+ export const VERSION = '6.14.2';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@refinitiv-ui/elements",
3
- "version": "6.14.0",
3
+ "version": "6.14.2",
4
4
  "description": "Element Framework Elements",
5
5
  "author": "LSEG",
6
6
  "license": "Apache-2.0",
@@ -345,29 +345,30 @@
345
345
  "chart.js": "~2.9.4",
346
346
  "d3-interpolate": "^3.0.1",
347
347
  "date-fns": "^2.22.1",
348
+ "escape-string-regexp": "^5.0.0",
348
349
  "lightweight-charts": "^3.8.0",
349
350
  "tslib": "^2.3.1"
350
351
  },
351
352
  "devDependencies": {
352
- "@refinitiv-ui/core": "^6.5.3",
353
- "@refinitiv-ui/demo-block": "^6.1.15",
354
- "@refinitiv-ui/i18n": "^6.0.19",
353
+ "@refinitiv-ui/core": "^6.5.4",
354
+ "@refinitiv-ui/demo-block": "^6.1.16",
355
+ "@refinitiv-ui/i18n": "^6.0.20",
355
356
  "@refinitiv-ui/phrasebook": "^6.3.8",
356
357
  "@refinitiv-ui/test-helpers": "^6.0.15",
357
- "@refinitiv-ui/translate": "^6.0.29",
358
+ "@refinitiv-ui/translate": "^6.0.30",
358
359
  "@refinitiv-ui/utils": "^6.3.2",
359
360
  "@types/d3-interpolate": "^3.0.1"
360
361
  },
361
362
  "peerDependencies": {
362
363
  "@refinitiv-ui/browser-sparkline": "^1.0.0 || ^2.0.0",
363
- "@refinitiv-ui/core": "^6.5.3",
364
- "@refinitiv-ui/i18n": "^6.0.19",
364
+ "@refinitiv-ui/core": "^6.5.4",
365
+ "@refinitiv-ui/i18n": "^6.0.20",
365
366
  "@refinitiv-ui/phrasebook": "^6.3.8",
366
- "@refinitiv-ui/translate": "^6.0.29",
367
+ "@refinitiv-ui/translate": "^6.0.30",
367
368
  "@refinitiv-ui/utils": "^6.3.2"
368
369
  },
369
370
  "publishConfig": {
370
371
  "access": "public"
371
372
  },
372
- "gitHead": "254068656350f9d695b0207fdd3b661f8ac7cfe2"
373
+ "gitHead": "28e5224bd2c7a635857e0fe3030947e72188b831"
373
374
  }