Skip to content

Commit 2a12602

Browse files
chore: Add deprecation notices for next release (#329)
1 parent 235b273 commit 2a12602

File tree

5 files changed

+24
-5
lines changed

5 files changed

+24
-5
lines changed

packages/base/src/styling/HSLColor.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { deprecationNotice } from '@ui5/webcomponents-react-base/lib/Utils';
2+
13
export class HSLColor {
24
private static HSL_REGEX = /(\d{0,3}\.?\d*?), ?(\d{0,3}\.?\d*?)%?, ?(\d{0,3}\.?\d*?)%?/;
35
private static HEX_REGEX = /^#([a-f\d]{1,2})([a-f\d]{1,2})([a-f\d]{1,2})$/i;
@@ -12,6 +14,11 @@ export class HSLColor {
1214
this.saturation = saturation;
1315
this.lightness = lightness;
1416
this.alpha = alpha;
17+
18+
deprecationNotice(
19+
'HSLColor',
20+
"'@ui5/webcomponents-react-base/lib/HSLColor' is deprecated and will be removed in the next major release."
21+
);
1522
}
1623

1724
static of(hue: number | string | HSLColor, saturation?: number, lightness?: number, alpha?: number): HSLColor {

packages/base/src/styling/font72.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
import { deprecationNotice } from '@ui5/webcomponents-react-base/lib/Utils';
2+
3+
deprecationNotice(
4+
'font72',
5+
"The global font face defined in '@ui5/webcomponents-react-base/lib/font72' is deprecated and will be removed in the next major release.\n. This font is now provided the the UI5 Web Components itself."
6+
);
7+
18
const font72 = {
29
'@font-face': [
310
{

packages/base/src/utils/Optional.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { deprecationNotice } from '@ui5/webcomponents-react-base/lib/Utils';
2+
13
/* eslint-disable id-blacklist */
24
/**
35
* Optionals for Javascript Objects
@@ -17,6 +19,11 @@ class Optional {
1719
constructor(object: object, path: string) {
1820
this.object = object;
1921
this.path = path;
22+
23+
deprecationNotice(
24+
'Optional',
25+
"'@ui5/webcomponents-react-base/lib/Optional' is deprecated and will be removed in the next major release.\n. Please use the Optional-Chaining-Operator instead."
26+
);
2027
}
2128

2229
/**

packages/base/src/utils/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
export const deprecationNotice = (component: string, message: string) => {
2-
const value = `* ui5-webcomponents-react Deprecation Notice - ${component}`;
3-
const dots = '*'.padStart(value.length, '*');
2+
const value = `*** ui5-webcomponents-react Deprecation Notice - ${component} ***\n`;
43
// eslint-disable-next-line no-console
5-
console.warn(`${dots}${value}${dots}${message}`);
4+
console.warn(`${value}${message}`);
65
};
76

87
export const getScrollBarWidth = () => {

packages/charts/src/internal/ChartLegend.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
/* eslint-disable no-underscore-dangle */
2-
import { Optional } from '@ui5/webcomponents-react-base/lib/Optional';
32
import '@ui5/webcomponents/dist/Label';
43
import { RefObject, useCallback, useEffect } from 'react';
54

65
const getSymbolForDataset = (type, dataset) => {
76
const datasetMeta: any = dataset.hasOwnProperty('_meta') ? Object.values(dataset._meta)[0] : null;
8-
const elementType = Optional.of(datasetMeta, 'type').orElse(type);
7+
const elementType = datasetMeta?.type ?? type;
98
switch (elementType) {
109
case 'line':
1110
return `

0 commit comments

Comments
 (0)