Skip to content

Commit d68bd2c

Browse files
authored
chore(addCustomCSSWithScoping): move to base package (#6818)
1 parent e70f794 commit d68bd2c

File tree

9 files changed

+16
-7
lines changed

9 files changed

+16
-7
lines changed

.storybook/components/ProjectTemplate.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ import {
1212
Text,
1313
ThemeProvider
1414
} from '@ui5/webcomponents-react';
15+
import { addCustomCSSWithScoping } from '@ui5/webcomponents-react-base/dist/utils/addCustomCSSWithScoping.js';
1516
import { clsx } from 'clsx';
1617
import type { ReactNode } from 'react';
1718
import { useRef, useState } from 'react';
18-
import { addCustomCSSWithScoping } from '../../packages/main/src/internal/addCustomCSSWithScoping';
1919
import classes from './ProjectTemplate.module.css';
2020

2121
interface ProjectTemplatePropTypes {

packages/base/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"./package.json": "./package.json",
1515
"./dist": "./dist/index.js",
1616
"./dist/*": "./dist/*",
17-
"./dist/*.js": "./dist/*.js"
17+
"./dist/*.js": "./dist/*.js",
18+
"./internal/addCustomCSSWithScoping.js": "./dist/utils/addCustomCSSWithScoping.js"
1819
},
1920
"homepage": "https://sap.github.io/ui5-webcomponents-react",
2021
"repository": {

packages/main/src/internal/addCustomCSSWithScoping.ts renamed to packages/base/src/utils/addCustomCSSWithScoping.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { attachBoot } from '@ui5/webcomponents-base/dist/Boot.js';
22
import { addCustomCSS } from '@ui5/webcomponents-base/dist/Theming.js';
3-
import { getUi5TagWithSuffix } from './utils.js';
3+
import { getUi5TagWithSuffix } from './index.js';
44

55
export const addCustomCSSWithScoping = (baseTagName: string, customCSS: string) => {
66
attachBoot(() => {

packages/base/src/utils/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { getEffectiveScopingSuffixForTag } from '@ui5/webcomponents-base/CustomElementsScope.js';
2+
13
export const deprecationNotice = (component: string, message: string) => {
24
if (process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test') {
35
const value = `*** ui5-webcomponents-react Deprecation Notice - ${component} ***\n`;
@@ -46,5 +48,10 @@ export const enrichEventWithDetails = <
4648
return event as EnrichedEventType<Event, Detail>;
4749
};
4850

51+
export function getUi5TagWithSuffix(baseTagName: string) {
52+
const tagNameSuffix: string | undefined = getEffectiveScopingSuffixForTag(baseTagName);
53+
return tagNameSuffix ? `${baseTagName}-${tagNameSuffix}` : baseTagName;
54+
}
55+
4956
export { debounce } from './debounce.js';
5057
export { throttle } from './throttle.js';

packages/charts/src/internal/ChartContainer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { BusyIndicator, Label } from '@ui5/webcomponents-react';
22
import type { CommonProps } from '@ui5/webcomponents-react';
3-
import { addCustomCSSWithScoping } from '@ui5/webcomponents-react/dist/internal/addCustomCSSWithScoping.js';
43
import { useStylesheet } from '@ui5/webcomponents-react-base';
4+
import { addCustomCSSWithScoping } from '@ui5/webcomponents-react-base/dist/utils/addCustomCSSWithScoping.js';
55
import { clsx } from 'clsx';
66
import type { ComponentType, ReactElement, ReactNode } from 'react';
77
import { Component, forwardRef } from 'react';

packages/main/src/components/ActionSheet/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
import ButtonDesign from '@ui5/webcomponents/dist/types/ButtonDesign.js';
44
import { isPhone } from '@ui5/webcomponents-base/dist/Device.js';
55
import { useI18nBundle, useStylesheet } from '@ui5/webcomponents-react-base';
6+
import { addCustomCSSWithScoping } from '@ui5/webcomponents-react-base/dist/utils/addCustomCSSWithScoping.js';
67
import { clsx } from 'clsx';
78
import type { ReactElement } from 'react';
89
import { forwardRef, useEffect, useReducer, useRef, useState } from 'react';
910
import { AVAILABLE_ACTIONS, CANCEL, X_OF_Y } from '../../i18n/i18n-defaults.js';
10-
import { addCustomCSSWithScoping } from '../../internal/addCustomCSSWithScoping.js';
1111
import { flattenFragments, getUi5TagWithSuffix } from '../../internal/utils.js';
1212
import { CustomThemingParameters } from '../../themes/CustomVariables.js';
1313
import type { UI5WCSlotsNode } from '../../types/index.js';

packages/main/src/components/FilterBar/FilterDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import group2Icon from '@ui5/webcomponents-icons/dist/group-2.js';
66
import listIcon from '@ui5/webcomponents-icons/dist/list.js';
77
import searchIcon from '@ui5/webcomponents-icons/dist/search.js';
88
import { enrichEventWithDetails, useI18nBundle, useStylesheet } from '@ui5/webcomponents-react-base';
9+
import { addCustomCSSWithScoping } from '@ui5/webcomponents-react-base/dist/utils/addCustomCSSWithScoping.js';
910
import type { ReactElement, RefObject } from 'react';
1011
import { Children, cloneElement, useEffect, useId, useReducer, useRef, useState } from 'react';
1112
import { FlexBoxDirection, FlexBoxJustifyContent, MessageBoxAction, MessageBoxType } from '../../enums/index.js';
@@ -29,7 +30,6 @@ import {
2930
VISIBLE,
3031
VISIBLE_AND_ACTIVE
3132
} from '../../i18n/i18n-defaults.js';
32-
import { addCustomCSSWithScoping } from '../../internal/addCustomCSSWithScoping.js';
3333
import type { OnReorderParams } from '../../internal/FilterBarDialogContext.js';
3434
import { FilterBarDialogContext } from '../../internal/FilterBarDialogContext.js';
3535
import { stopPropagation } from '../../internal/stopPropagation.js';

packages/main/src/webComponents/ExpandableText/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import '@ui5/webcomponents/dist/ExpandableText.js';
44
import type ExpandableTextOverflowMode from '@ui5/webcomponents/dist/types/ExpandableTextOverflowMode.js';
55
import type TextEmptyIndicatorMode from '@ui5/webcomponents/dist/types/TextEmptyIndicatorMode.js';
6-
import { addCustomCSSWithScoping } from '../../internal/addCustomCSSWithScoping.js';
6+
import { addCustomCSSWithScoping } from '@ui5/webcomponents-react-base/dist/utils/addCustomCSSWithScoping.js';
77
import { withWebComponent } from '../../internal/withWebComponent.js';
88
import type { CommonProps, Ui5DomRef } from '../../types/index.js';
99

vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export default defineConfig(() => {
1414
resolve: {
1515
alias: {
1616
'@sb': fileURLToPath(new URL('./.storybook', import.meta.url)),
17+
'@ui5/webcomponents-react-base/dist': fileURLToPath(new URL('./packages/base/src', import.meta.url)),
1718
'@ui5/webcomponents-react-base': fileURLToPath(new URL('./packages/base/src/index.ts', import.meta.url)),
1819
'@ui5/webcomponents-react-charts': fileURLToPath(new URL('./packages/charts/src/index.ts', import.meta.url)),
1920
'@ui5/webcomponents-react/dist': fileURLToPath(new URL('./packages/main/src/', import.meta.url)),

0 commit comments

Comments
 (0)