@refinitiv-ui/elements 7.7.0 → 7.8.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.
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
+ # [7.8.0](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@7.7.0...@refinitiv-ui/elements@7.8.0) (2023-10-31)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **list:** `selectItem()` should always require a param ([#998](https://github.com/Refinitiv/refinitiv-ui/issues/998)) ([fef8e56](https://github.com/Refinitiv/refinitiv-ui/commit/fef8e56e9187f4b0a49962a4cd87defcdc02f103))
11
+ - update `@trivago/prettier-plugin-sort-imports` to fix babel vulnerable to arbitrary code execution ([#1002](https://github.com/Refinitiv/refinitiv-ui/issues/1002)) ([e96385f](https://github.com/Refinitiv/refinitiv-ui/commit/e96385f652d8e2a8c3f6dffc952fecd718c9d033))
12
+
13
+ ### Features
14
+
15
+ - adding `type=module` to `package.json` ([#974](https://github.com/Refinitiv/refinitiv-ui/issues/974)) ([9bf21dc](https://github.com/Refinitiv/refinitiv-ui/commit/9bf21dc05cb7ed93e1d14e797c1bf6af85b659d3)), closes [#985](https://github.com/Refinitiv/refinitiv-ui/issues/985)
16
+
6
17
  # [7.7.0](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@7.6.2...@refinitiv-ui/elements@7.7.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 };
@@ -1,11 +1,11 @@
1
1
  import { JSXInterface } from '../../jsx';
2
2
  import { Chart as ChartJS } from 'chart.js';
3
+ import type { ChartConfiguration, ChartDataset, ChartOptions, ChartType, LegendItem, UpdateMode } from 'chart.js';
3
4
  import 'chartjs-adapter-date-fns';
4
5
  import { BasicElement, CSSResultGroup, PropertyValues, TemplateResult, nothing } from '@refinitiv-ui/core';
5
6
  import { Ref } from '@refinitiv-ui/core/directives/ref.js';
6
7
  import '../../header/index.js';
7
8
  import { DatasetColors } from '../helpers/index.js';
8
- import type { ChartConfiguration, ChartDataset, ChartOptions, ChartType, LegendItem, UpdateMode } from 'chart.js';
9
9
  declare module 'chart.js' {
10
10
  interface PluginOptionsByType<TType extends ChartType = ChartType> {
11
11
  'ef-chart': object;
@@ -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,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 { ChartOptions, DeepPartial, ISeriesApi, SeriesDataItemTypeMap, SeriesOptionsMap, SeriesType } from 'lightweight-charts';
2
+ import type { HSLColor, RGBColor } from '@refinitiv-ui/utils/color.js';
3
3
  type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
4
4
  type SeriesOptions = UnionToIntersection<SeriesOptionsMap[keyof SeriesOptionsMap]>;
5
5
  type SeriesList = ISeriesApi<SeriesType>;
@@ -1,8 +1,8 @@
1
1
  import { JSXInterface } from '../jsx';
2
+ import type { IChartApi, MouseEventParams } from 'lightweight-charts';
2
3
  import { CSSResultGroup, ElementSize, PropertyValues, ResponsiveElement, TemplateResult } from '@refinitiv-ui/core';
3
4
  import '../tooltip/index.js';
4
5
  import type { InteractiveChartConfig, InteractiveChartSeries, LegendStyle, RowLegend, SeriesDataItem, SeriesList, SeriesOptions, Theme } from './helpers/types.js';
5
- import type { IChartApi, MouseEventParams } from 'lightweight-charts';
6
6
  export type { InteractiveChartConfig, InteractiveChartSeries, Theme, SeriesOptions, SeriesDataItem };
7
7
  /**
8
8
  * A charting component that allows you to create several use cases of financial chart.
@@ -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
@@ -95,6 +95,7 @@ export class ViewportManager {
95
95
  // Safari does but zooming doesn't update this property value
96
96
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
97
97
  // @ts-ignore
98
+ // 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
98
99
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
99
100
  const zoom = parseFloat(window.getComputedStyle(document.body).zoom);
100
101
  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,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 = '7.7.0';
1
+ export const VERSION = '7.8.0';
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@refinitiv-ui/elements",
3
- "version": "7.7.0",
3
+ "version": "7.8.0",
4
4
  "description": "Element Framework Elements",
5
5
  "author": "LSEG",
6
6
  "license": "Apache-2.0",
7
7
  "main": "./lib/index.js",
8
8
  "module": "./lib/index.js",
9
+ "type": "module",
9
10
  "types": "./lib/index.d.ts",
10
11
  "homepage": "https://ui.refinitiv.com",
11
12
  "repository": {
@@ -325,24 +326,24 @@
325
326
  "./tree-select/themes/solar/pearl": "./lib/tree-select/themes/solar/pearl/index.js"
326
327
  },
327
328
  "scripts": {
328
- "build": "node cli.mjs build --sourceMap --declarationMap",
329
- "build:prod": "node cli.mjs build",
329
+ "build": "node cli.js build --sourceMap --declarationMap",
330
+ "build:prod": "node cli.js build",
330
331
  "clean": "nx exec -- rm -rf lib tsconfig.tsbuildinfo",
331
- "start": "node cli.mjs start",
332
- "test": "node cli.mjs test",
333
- "test:watch": "node cli.mjs test --watch",
334
- "test:snapshots": "node cli.mjs test --update-snapshots",
335
- "lint": "node cli.mjs lint",
336
- "lint:fix": "node cli.mjs lint --fix",
337
- "prepublishOnly": "node scripts/release/index.mjs",
332
+ "start": "node cli.js start",
333
+ "test": "node cli.js test",
334
+ "test:watch": "node cli.js test --watch",
335
+ "test:snapshots": "node cli.js test --update-snapshots",
336
+ "lint": "node cli.js lint",
337
+ "lint:fix": "node cli.js lint --fix",
338
+ "prepublishOnly": "node scripts/release/index.js",
338
339
  "api-analyzer": "node ../../scripts/release/api-analyzer.cjs",
339
340
  "prepack": "npm run version",
340
- "version": "node ../../scripts/version/index.mjs"
341
+ "version": "node ../../scripts/version/index.js"
341
342
  },
342
343
  "dependencies": {
343
344
  "@lit-labs/context": "^0.3.1",
344
- "@refinitiv-ui/halo-theme": "^7.1.1",
345
- "@refinitiv-ui/solar-theme": "^7.1.1",
345
+ "@refinitiv-ui/halo-theme": "^7.2.0",
346
+ "@refinitiv-ui/solar-theme": "^7.2.0",
346
347
  "chart.js": "^4.3.0",
347
348
  "chartjs-adapter-date-fns": "^3.0.0",
348
349
  "d3-interpolate": "^3.0.1",
@@ -351,25 +352,25 @@
351
352
  "tslib": "^2.3.1"
352
353
  },
353
354
  "devDependencies": {
354
- "@refinitiv-ui/core": "^7.2.2",
355
- "@refinitiv-ui/demo-block": "^7.0.9",
356
- "@refinitiv-ui/i18n": "^7.0.5",
357
- "@refinitiv-ui/phrasebook": "^7.0.5",
358
- "@refinitiv-ui/test-helpers": "^7.0.4",
359
- "@refinitiv-ui/translate": "^7.0.6",
360
- "@refinitiv-ui/utils": "^7.1.2",
355
+ "@refinitiv-ui/core": "^7.3.0",
356
+ "@refinitiv-ui/demo-block": "^7.1.0",
357
+ "@refinitiv-ui/i18n": "^7.1.0",
358
+ "@refinitiv-ui/phrasebook": "^7.1.0",
359
+ "@refinitiv-ui/test-helpers": "^7.1.0",
360
+ "@refinitiv-ui/translate": "^7.1.0",
361
+ "@refinitiv-ui/utils": "^7.2.0",
361
362
  "@types/d3-interpolate": "^3.0.1"
362
363
  },
363
364
  "peerDependencies": {
364
365
  "@refinitiv-ui/browser-sparkline": "^1.0.0 || ^2.0.0",
365
- "@refinitiv-ui/core": "^7.2.2",
366
- "@refinitiv-ui/i18n": "^7.0.5",
367
- "@refinitiv-ui/phrasebook": "^7.0.5",
368
- "@refinitiv-ui/translate": "^7.0.6",
369
- "@refinitiv-ui/utils": "^7.1.2"
366
+ "@refinitiv-ui/core": "^7.3.0",
367
+ "@refinitiv-ui/i18n": "^7.1.0",
368
+ "@refinitiv-ui/phrasebook": "^7.1.0",
369
+ "@refinitiv-ui/translate": "^7.1.0",
370
+ "@refinitiv-ui/utils": "^7.2.0"
370
371
  },
371
372
  "publishConfig": {
372
373
  "access": "public"
373
374
  },
374
- "gitHead": "3844f684f73a3ef5f035dd567e4362add74825eb"
375
+ "gitHead": "f0019ccc2f241a998c5e455b433c0e36720d5fe6"
375
376
  }
package/cli.mjs DELETED
@@ -1,23 +0,0 @@
1
- #!/usr/bin/env node
2
- import { hideBin } from 'yargs/helpers';
3
- import yargs from 'yargs/yargs';
4
-
5
- import { commands } from './scripts/cmd/index.mjs';
6
- import { errorHandler, info } from './scripts/helpers/index.mjs';
7
-
8
- yargs(hideBin(process.argv))
9
- .usage('Element Framework CLI Commands\n\nUsage: $0 <command> [options]')
10
- .command(commands)
11
- .demandCommand(1, 'You need at least one command.')
12
- .version(false)
13
- .help('help')
14
- .alias('help', 'h')
15
- .fail(function (msg, err, yargs) {
16
- if (msg) {
17
- errorHandler(msg);
18
- }
19
-
20
- info('\nSpecify --help for available options.\n');
21
- process.exit(1);
22
- })
23
- .parse();