diff --git a/.storybook/components/DocsHeader.tsx b/.storybook/components/DocsHeader.tsx index 2089938f787..51f1fc02d63 100644 --- a/.storybook/components/DocsHeader.tsx +++ b/.storybook/components/DocsHeader.tsx @@ -48,7 +48,7 @@ export const InfoTable = ({ since, subComponents, mergeSubComponents }: InfoTabl const wcSubComponents = useGetSubComponentsOfModule(moduleName.replace('V2', '')); const subComps = mergeSubComponents ? [...(subComponents ?? []), ...(wcSubComponents ?? [])] - : subComponents ?? wcSubComponents; + : (subComponents ?? wcSubComponents); const supportsClipboardApi = typeof ClipboardItem !== 'undefined'; diff --git a/.storybook/components/Import.tsx b/.storybook/components/Import.tsx index f41204d4d0d..6a5ae2c5bc7 100644 --- a/.storybook/components/Import.tsx +++ b/.storybook/components/Import.tsx @@ -11,11 +11,41 @@ interface ImportStatementPropTypes { */ packageName: string; } +interface DeepPath { + path: string; + moduleName: string; +} +interface FromPathPropTypes extends Pick { + deepPath?: null | undefined | DeepPath; +} + +function FromPath({ packageName, deepPath }: FromPathPropTypes) { + return ( + <> + from + + + {deepPath ? packageName.slice(0, -1) : packageName} + {deepPath && deepPath.path} + {deepPath && "'"} + + ; + {deepPath &&
} + + ); +} export const ImportStatement = ({ moduleNames, packageName }: ImportStatementPropTypes) => { if (!moduleNames) { return null; } + const isCompat = packageName.includes('compat'); + const paths = isCompat + ? moduleNames.map((item) => { + return { path: `/dist/components/${item}/index.js`, moduleName: item }; + }) + : [null]; + return (
       
-        import
-        
-          {' '}
-          {'{'}
-          {moduleNames.length > 2 ? (
-            <>
-              {moduleNames.map((item) => {
-                return (
-                  
+        {!paths[0] && import}
+        {paths.map((deepPath) => {
+          if (!deepPath) {
+            return (
+              
+                {' '}
+                {'{'}
+                {moduleNames.length > 2 ? (
+                  <>
+                    {moduleNames.map((item) => {
+                      return (
+                        
+                          
+    + {item}, +
+ ); + })}
-    - {item}, -
- ); - })} -
- - ) : ( - <> {moduleNames.join(', ')}  - )} - {'}'}{' '} -
- from - - {packageName} - ; + + ) : ( + <> {moduleNames.join(', ')}  + )} + {'}'}{' '} + + ); + } else { + return ( + <> + import + + {' '} + {'{'} {deepPath.moduleName} {'}'}{' '} + + + + ); + } + })} + {!paths[0] && }
); diff --git a/packages/compat/package.json b/packages/compat/package.json index 1cd41ec359c..c365ac795ac 100644 --- a/packages/compat/package.json +++ b/packages/compat/package.json @@ -12,7 +12,9 @@ "default": "./dist/index.js" }, "./package.json": "./package.json", - "./styles.css": "./dist/css/index.css" + "./styles.css": "./dist/css/index.css", + "./dist/*": "./dist/*", + "./dist/*.js": "./dist/*.js" }, "homepage": "https://sap.github.io/ui5-webcomponents-react", "repository": {