diff --git a/.config/.jscpd.json b/.config/.jscpd.json index 5658d1fdb1ed..ded79c04bf7b 100644 --- a/.config/.jscpd.json +++ b/.config/.jscpd.json @@ -48,17 +48,20 @@ "showcases/**/results/**", "showcases/angular-showcase/.angular/cache", "showcases/angular-showcase/.angular/cache/**", + "showcases/angular-showcase/src/app/app.component.html", "showcases/angular-ssr-showcase/.angular/cache/**", "showcases/next-showcase/pages/_app.tsx", "showcases/nuxt-showcase/**", "showcases/patternhub/out/**", "showcases/react-showcase/src/components/checkbox/index.tsx", "showcases/react-showcase/src/components/notification/index.tsx", - "showcases/react-showcase/src/components/notification/index.tsx", "showcases/react-showcase/src/components/radio/index.tsx", "showcases/react-showcase/src/components/radio/index.tsx", + "showcases/react-showcase/src/components/control-panel-desktop/index.tsx", "showcases/shared/*.json", - "showcases/vue-showcase/src/components/form/Form.vue" + "showcases/vue-showcase/src/components/form/Form.vue", + "showcases/vue-showcase/src/App.vue", + "showcases/**/control-panel-desktop/**" ], "absolute": true } diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dc416719ecd7..c8190eb4d264 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,8 @@ --- name: Test and publish to package registries after new GitHub release +# TODO: Revert this file before mergin to main + on: release: types: [published] @@ -10,10 +12,6 @@ jobs: uses: ./.github/workflows/00-init.yml secrets: inherit - get-playwright-version: - uses: ./.github/workflows/01-get-playwright-version.yml - needs: [init] - get-publish-version: uses: ./.github/workflows/01-get-publish-version.yml needs: [init] @@ -30,28 +28,10 @@ jobs: uses: ./.github/workflows/01-build-packages.yml needs: [init] - init-playwright: - uses: ./.github/workflows/01-init-playwright.yml - needs: [get-playwright-version] - with: - version: ${{ needs.get-playwright-version.outputs.version }} - build-outputs: uses: ./.github/workflows/01-build-outputs.yml needs: [build-packages] - test-components: - uses: ./.github/workflows/02-e2e.yml - needs: [build-packages, get-playwright-version] - with: - version: ${{ needs.get-playwright-version.outputs.version }} - - test-foundations: - uses: ./.github/workflows/02-e2e-foundations.yml - needs: [build-packages, get-playwright-version] - with: - version: ${{ needs.get-playwright-version.outputs.version }} - build-showcase-stencil: uses: ./.github/workflows/01-build-showcases.yml needs: [build-packages] @@ -101,48 +81,6 @@ jobs: release: ${{ needs.get-publish-version.outputs.release }} preRelease: ${{ needs.get-publish-version.outputs.preRelease }} - test-showcase-stencil: - uses: ./.github/workflows/02-e2e-showcases.yml - needs: [build-showcase-stencil, get-playwright-version] - with: - version: ${{ needs.get-playwright-version.outputs.version }} - showcase: stencil-showcase - - test-showcase-angular: - uses: ./.github/workflows/02-e2e-showcases.yml - needs: [build-showcase-angular, get-playwright-version] - with: - version: ${{ needs.get-playwright-version.outputs.version }} - showcase: angular-showcase - - test-showcase-react: - uses: ./.github/workflows/02-e2e-showcases.yml - needs: [build-showcase-react, get-playwright-version] - with: - version: ${{ needs.get-playwright-version.outputs.version }} - showcase: react-showcase - - test-showcase-vue: - uses: ./.github/workflows/02-e2e-showcases.yml - needs: [build-showcase-vue, get-playwright-version] - with: - version: ${{ needs.get-playwright-version.outputs.version }} - showcase: vue-showcase - - test-showcase-patternhub: - uses: ./.github/workflows/02-e2e-showcases.yml - needs: [build-showcase-patternhub, get-playwright-version] - with: - path: ${{ needs.build-showcase-patternhub.outputs.path }} - version: ${{ needs.get-playwright-version.outputs.version }} - showcase: patternhub - - test-screen-reader: - uses: ./.github/workflows/02-e2e-screen-reader.yml - needs: [build-showcase-react, init-playwright, get-playwright-version] - with: - version: ${{ needs.get-playwright-version.outputs.version }} - checks-done: if: ${{ always() }} runs-on: ubuntu-24.04 # Use Ubuntu 24.04 explicitly @@ -158,23 +96,7 @@ jobs: resultBuildShowcaseNuxt="${{ needs.build-showcase-nuxt.result }}" resultBuildShowcasePatternhub="${{ needs.build-showcase-patternhub.result }}" resultBuildOutputs="${{ needs.build-outputs.result }}" - resultTestPackages="${{ needs.test-components.result }}" - resultTestFoundations="${{ needs.test-foundations.result }}" - resultTestShowcaseStencil="${{ needs.test-showcase-stencil.result }}" - resultTestShowcaseAngular="${{ needs.test-showcase-angular.result }}" - resultTestShowcaseReact="${{ needs.test-showcase-react.result }}" - resultTestShowcaseVue="${{ needs.test-showcase-vue.result }}" - resultTestShowcasePatternhub="${{ needs.test-showcase-patternhub.result }}" - resultTestScreenReader="${{ needs.test-screen-reader.result }}" - if [[ $resultTestFoundations == "success" ]] && \ - [[ $resultTestScreenReader == "success" ]] && \ - [[ $resultTestShowcaseStencil == "success" ]] && \ - [[ $resultTestShowcaseAngular == "success" ]] && \ - [[ $resultTestShowcaseReact == "success" ]] && \ - [[ $resultTestShowcaseVue == "success" ]] && \ - [[ $resultTestShowcasePatternhub == "success" ]] && \ - [[ $resultTestPackages == "success" ]] && \ - [[ $resultBuildOutputs == "success" ]] && \ + if [[ $resultBuildOutputs == "success" ]] && \ [[ $resultBuildShowcaseStencil == "success" ]] && \ [[ $resultBuildShowcaseAngular == "success" ]] && \ [[ $resultBuildShowcaseAngularSSR == "success" ]] && \ @@ -199,15 +121,7 @@ jobs: build-showcase-vue, build-showcase-nuxt, build-showcase-patternhub, - build-outputs, - test-components, - test-showcase-stencil, - test-showcase-angular, - test-showcase-react, - test-showcase-vue, - test-showcase-patternhub, - test-foundations, - test-screen-reader + build-outputs ] deploy: diff --git a/.gitignore b/.gitignore index 1852f17b884b..a1d36c2b8a74 100644 --- a/.gitignore +++ b/.gitignore @@ -48,7 +48,7 @@ showcases/patternhub/public/iframe-resizer/* /__snapshots__/**/*-win32.png /packages/foundations/scss/_normalize.scss /packages/foundations/assets/icons/tmp/ -/packages/foundations/assets/icons/fonts/**/index.html +/packages/foundations/assets/icons/fonts/**/*.html /packages/foundations/assets/icons/fonts/**/index.css /packages/foundations/assets/icons/fonts/**/font-face.css /packages/foundations/assets/icons/fonts/**/info.json diff --git a/.stylelintignore b/.stylelintignore index 63579144728b..254f130a684a 100644 --- a/.stylelintignore +++ b/.stylelintignore @@ -8,6 +8,7 @@ output/ source/_patterns/** showcases/patternhub/** showcases/**/public/** +packages/foundations/assets/** packages/foundations/scripts/generate-icon-fonts/styles/** packages/foundations/scss/_normalize.scss packages/stylelint/test/** diff --git a/LICENSE b/LICENSE index 786b3d5c0b8c..03ef3eb75ab4 100644 --- a/LICENSE +++ b/LICENSE @@ -1,10 +1,10 @@ The DB source code is licensed under the Apache License, Version 2.0, January 2004; you may not use this file except in compliance with the License. You may obtain a copy of the Apache License at https://apache.org/licenses/LICENSE-2.0. The DB source code -does not include any DB specific design assets like fonts, icons, trademarks, brandings, etc. +does not include any DB specific design assets like fonts, icons, trademarks, control-panel-brandings, etc. All Deutsche Bahn AG (hereinafter “DB”) specific design assets like fonts, icons, -trademarks, brandings, etc. (hereinafter “DB Designs”) are licensed under the following +trademarks, control-panel-brandings, etc. (hereinafter “DB Designs”) are licensed under the following license agreement (the “DB Designs License”): - The DB Designs may only be used by external users who are acting as contractors or diff --git a/README.md b/README.md index 062e65366616..b9392a5718e2 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,7 @@ Check our migration docs for breaking changes: > We've updated to the stable version of DB UX Design System (v3) version >= 1.x, and now the colors that were supposed to be red, are colored in blue (`514ec7`). -Please have a look at the [migration guide from version 0.6.x to version 0.7.x](https://github.com/db-ux-design-system/core-web/blob/main/docs/migration/v0.6.x-to-v0.7.x.md#removed-brand-assets), you need to install and reference the DB Theme, if you're building a website or web application for Deutsche Bahn. +Please have a look at the [migration guide from version 0.6.x to version 0.7.x](https://github.com/db-ux-design-system/core-web/blob/main/docs/migration/v0.6.x-to-v0.7.x.md#removed-control-panel-brand-assets), you need to install and reference the DB Theme, if you're building a website or web application for Deutsche Bahn. ## Things to keep in mind @@ -136,7 +136,7 @@ Microsoft Teams (only available DB internally), or directly at [db-ux-designsystem@deutschebahn.com](mailto:db-ux-designsystem@deutschebahn.com). We're particularly keen to add as many examples to the behaviours as possible, to further clarify them. -## Deutsche Bahn brand +## Deutsche Bahn control-panel-brand To perfectly support our users and customers on their digital journey, the use of the Deutsche Bahn brand and trademarks is subject to clear guidelines and restrictions even when used with the code provided by this product. Deutsche Bahn fully reserves all @@ -148,7 +148,7 @@ Marketingportal, you'll agree with the ["Allgemeine Nutzungsbedingungen für das DB-Marketingportal" (german)](https://marketingportal.extranet.deutschebahn.com/marketingportal/Nutzungsbedingungen-9702684#) in case of using them. -For any usage outside of Deutsche Bahn websites and applications you aren't allowed to use any Deutsche Bahn brand and +For any usage outside of Deutsche Bahn websites and applications you aren't allowed to use any Deutsche Bahn control-panel-brand and design assets as well as protected characteristics and trademarks, that for not including the DB Theme. ## Contributions diff --git a/__snapshots__/foundations/chromium/Icons-should-match-screenshot-1/Icons-should-match-screenshot.png b/__snapshots__/foundations/chromium/Icons-should-match-screenshot-1/Icons-should-match-screenshot.png index de50c348dde7..bc1bcb974e8a 100644 Binary files a/__snapshots__/foundations/chromium/Icons-should-match-screenshot-1/Icons-should-match-screenshot.png and b/__snapshots__/foundations/chromium/Icons-should-match-screenshot-1/Icons-should-match-screenshot.png differ diff --git a/__snapshots__/foundations/firefox/Icons-should-match-screenshot-1/Icons-should-match-screenshot.png b/__snapshots__/foundations/firefox/Icons-should-match-screenshot-1/Icons-should-match-screenshot.png index 136e03d546d1..8b9f0b9c3cda 100644 Binary files a/__snapshots__/foundations/firefox/Icons-should-match-screenshot-1/Icons-should-match-screenshot.png and b/__snapshots__/foundations/firefox/Icons-should-match-screenshot-1/Icons-should-match-screenshot.png differ diff --git a/__snapshots__/foundations/webkit/Icons-should-match-screenshot-1/Icons-should-match-screenshot.png b/__snapshots__/foundations/webkit/Icons-should-match-screenshot-1/Icons-should-match-screenshot.png index efa08897c46c..7080d0dd2741 100644 Binary files a/__snapshots__/foundations/webkit/Icons-should-match-screenshot-1/Icons-should-match-screenshot.png and b/__snapshots__/foundations/webkit/Icons-should-match-screenshot-1/Icons-should-match-screenshot.png differ diff --git a/docs/migration/300-400/shell/Angular.md b/docs/migration/300-400/shell/Angular.md new file mode 100644 index 000000000000..fa8763cdceaa --- /dev/null +++ b/docs/migration/300-400/shell/Angular.md @@ -0,0 +1,377 @@ +# Migration DBPage, DBHeader, DBNavigation + +## Original Example + +### meta-navigation.component.ts + +```ts +import { Component } from "@angular/core"; +import { DBLink } from "@db-ux/ngx-core-components"; + +@Component({ + selector: "app-meta-navigation", + imports: [DBLink], + standalone: true, + template: ` + Imprint + Help + ` +}) +export class MetaNavigationComponent {} +``` + +### primary-actions.component.ts + +```ts +import { Component } from "@angular/core"; +import { DBButton } from "@db-ux/ngx-core-components"; + +@Component({ + selector: "app-primary-actions", + imports: [DBButton], + standalone: true, + template: ` + + Search + + ` +}) +export class PrimaryActionsComponent {} +``` + +### secondary-actions.component.ts + +```ts +import { Component } from "@angular/core"; +import { DBButton } from "@db-ux/ngx-core-components"; + +@Component({ + selector: "app-secondary-actions", + imports: [DBButton], + standalone: true, + template: ` + + Profile + + + Notification + + + Help + + ` +}) +export class SecondaryActionsComponent {} +``` + +### navigation.component.ts + +```ts +import { Component } from "@angular/core"; +import { + DBNavigation, + DBNavigationItem, + NavigationContentDirective +} from "@db-ux/ngx-core-components"; + +@Component({ + selector: "app-navigation", + imports: [DBNavigation, DBNavigationItem, NavigationContentDirective], + standalone: true, + template: ` + + + Navi-Item 1 + + + + Sub-Navi-Item 1 + + + + + Sub-Sub-Navi-Item 1 + + + + + Sub-Sub-Navi-Item 2 + + + + + + + Sub-Navi-Item 2 + + + + + + + Navi-Item 2 + + + + + Navi-Item 3 + + + + ` +}) +export class NavigationComponent {} +``` + +### app.component.ts + +```ts +import { Component } from "@angular/core"; +import { + DBPage, + DBHeader, + NavigationDirective, + SecondaryActionDirective, + MetaNavigationDirective +} from "@db-ux/ngx-core-components"; + +import { MetaNavigationComponent } from "./meta-navigation.component"; +import { PrimaryActionsComponent } from "./primary-actions.component"; +import { SecondaryActionsComponent } from "./secondary-actions.component"; +import { NavigationComponent } from "./navigation.component"; + +@Component({ + selector: "app-root", + imports: [ + DBPage, + DBHeader, + NavigationDirective, + SecondaryActionDirective, + MetaNavigationDirective, + MetaNavigationComponent, + PrimaryActionsComponent, + SecondaryActionsComponent, + NavigationComponent + ], + standalone: true, + template: ` + + + My Awesome App + + + + + + Main Page + + ` +}) +export class AppComponent { + drawerOpen = false; + + toggleDrawer = (open: boolean) => { + this.drawerOpen = open; + }; +} +``` + +## Refactored Example + +### meta-navigation.component.ts + +```ts +import { Component } from "@angular/core"; +import { + DBLink, + DBControlPanelMetaNavigation // new +} from "@db-ux/ngx-core-components"; + +@Component({ + selector: "app-meta-navigation", + imports: [DBLink, DBControlPanelMetaNavigation], + standalone: true, + template: ` + /* added db-control-panel-meta-navigation */ + + Imprint + Help + + ` +}) +export class MetaNavigationComponent {} +``` + +### primary-actions.component.ts + +```ts +import { Component } from "@angular/core"; +import { + DBButton, + DBControlPanelPrimaryActions // new +} from "@db-ux/ngx-core-components"; + +@Component({ + selector: "app-primary-actions", + imports: [DBButton, DBControlPanelPrimaryActions], + standalone: true, + template: ` + /* added db-control-panel-primary-actions */ + + + Search + + + ` +}) +export class PrimaryActionsComponent {} +``` + +### secondary-actions.component.ts + +```ts +import { Component } from "@angular/core"; +import { + DBButton, + DBControlPanelSecondaryActions // new +} from "@db-ux/ngx-core-components"; + +@Component({ + selector: "app-secondary-actions", + imports: [DBButton, DBControlPanelSecondaryActions], + standalone: true, + template: ` + /* added db-control-panel-secondary-actions */ + + + Profile + + + Notification + + + Help + + + ` +}) +export class SecondaryActionsComponent {} +``` + +### navigation.component.ts + +```ts +import { Component } from "@angular/core"; +import { + DBNavigation, + DBNavigationItem, + DBNavigationItemGroup // new + /*NavigationContentDirective*/ +} from "@db-ux/ngx-core-components"; + +@Component({ + selector: "app-navigation", + imports: [DBNavigation, DBNavigationItem, DBNavigationItemGroup], + standalone: true, + template: ` + + + /* replaced DBNavigationItem with subNavigation */ + + /* replaced DBNavigationItem with subNavigation */ + + + Sub-Sub-Navi-Item 1 + + + + Sub-Sub-Navi-Item 2 + + + + Sub-Navi-Item 2 + + + + Navi-Item 2 + + + Navi-Item 3 + + + ` +}) +export class NavigationComponent {} +``` + +### app.component.ts + +```ts +import { Component } from "@angular/core"; +import { + DBShell, // previously: DBPage + DBControlPanelDesktop, // previously: DBHeader + DBControlPanelMobile, // previously: DBHeader + DBControlPanelBrand // previously: DBBrand + /* NavigationDirective, + SecondaryActionDirective, + MetaNavigationDirective*/ +} from "@db-ux/ngx-core-components"; + +import { MetaNavigationComponent } from "./meta-navigation.component"; +import { PrimaryActionsComponent } from "./primary-actions.component"; +import { SecondaryActionsComponent } from "./secondary-actions.component"; +import { NavigationComponent } from "./navigation.component"; + +@Component({ + selector: "app-root", + imports: [ + DBShell, + DBControlPanelDesktop, + DBControlPanelMobile, + DBControlPanelBrand, + MetaNavigationComponent, + PrimaryActionsComponent, + SecondaryActionsComponent, + NavigationComponent + ], + standalone: true, + template: ` + + + My Awesome App + + + + + + + My Awesome App + + + + + + Main Page + + ` +}) +export class AppComponent { + // No need for own drawer state + /*drawerOpen = false; + + toggleDrawer = (open: boolean) => { + this.drawerOpen = open; + };*/ +} +``` diff --git a/docs/migration/300-400/shell/React.md b/docs/migration/300-400/shell/React.md new file mode 100644 index 000000000000..647e65f4aede --- /dev/null +++ b/docs/migration/300-400/shell/React.md @@ -0,0 +1,222 @@ +# Migration DBPage, DBHeader, DBNavigation + + +## Original Example + +```tsx +import { useState } from "react"; +import { + DBPage, + DBHeader, + DBBrand, + DBLink, + DBNavigation, + DBNavigationItem +} from "@db-ux/react-core-components"; + +const [drawerOpen, setDrawerOpen] = useState(false); + +const MetaNavigation = () => ( + <> + Imprint + Help + +); + +const PrimaryActions = () => ( + + Search + +); + +const SecondaryActions = () => ( + <> + + Profile + + + Notification + + + Help + + +); + +const Navigation = () => ( + + + + + + Sub-Sub-Navi-Item 1 + + + + Sub-Sub-Navi-Item 2 + + + } + > + Sub-Navi-Item 1 + + + Sub-Navi-Item 2 + + + } + > + Navi-Item 1 + + + Navi-Item 2 + + + Navi-Item 3 + + +); + +const App = () => ( + My Awesome App} + metaNavigation={} + primaryAction={} + secondaryAction={} + > + + + } + footer={
Footer
} + > + Main Page +
+); + +export default App; +``` + + +## Refactored Example + +```tsx + +import { + DBShell, // previously: DBPage + DBControlPanelDesktop, // previously: DBHeader + DBControlPanelMobile, // previously: DBHeader + DBControlPanelBrand, // previously: DBBrand + DBControlPanelMetaNavigation, // new + DBControlPanelPrimaryActions, // new + DBControlPanelSecondaryActions, // new + DBLink, + DBNavigation, + DBNavigationItem, + DBNavigationItemGroup // new +} from "@db-ux/react-core-components"; + +// No need for own drawer state +/*const [drawerOpen, setDrawerOpen] = useState(false);*/ + +const MetaNavigation = () => ( + + {/* added DBControlPanelMetaNavigation */} + Imprint + Help + +); + +const PrimaryActions = () => ( + + {/* added DBControlPanelPrimaryActions */} + + Search + + +); + +const SecondaryActions = () => ( + + {/* added DBControlPanelSecondaryActions */} + + Profile + + + Notification + + + Help + + +); + +const Navigation = () => ( + + + {/* replaced DBNavigationItem with `subNavigation` */} + + {/* replaced DBNavigationItem with `subNavigation` */} + + + Sub-Sub-Navi-Item 1 + + + + Sub-Sub-Navi-Item 2 + + + + Sub-Navi-Item 2 + + + + Navi-Item 2 + + + Navi-Item 3 + + +); + +const App = () => ( + My Awesome App} + metaNavigation={} + primaryActions={} + secondaryActions={} + > + + + } + controlPanelMobile={ + My Awesome App} + metaNavigation={} + primaryActions={} + secondaryActions={} + > + + + } + > + Main Page + +); + +export default App; +``` diff --git a/docs/migration/300-400/shell/Vue.md b/docs/migration/300-400/shell/Vue.md new file mode 100644 index 000000000000..164865bed97f --- /dev/null +++ b/docs/migration/300-400/shell/Vue.md @@ -0,0 +1,293 @@ +# Migration DBPage, DBHeader, DBNavigation + +## Original Example + +### MetaNavigation.vue + +```vue + + + +``` + +### PrimaryActions.vue + +```vue + + + +``` + +### SecondaryActions.vue + +```vue + + + +``` + +### Navigation.vue + +```vue + + + +``` + +### App.vue + +```vue + + + +``` + +## Refactored Example + +### MetaNavigation.vue + +```vue + + + +``` + +### PrimaryActions.vue + +```vue + + + +``` + +### SecondaryActions.vue + +```vue + + + +``` + +### Navigation.vue + +```vue + + + +``` + +### App.vue + +```vue + + + +``` diff --git a/docs/migration/v3.x.x-to-v4.0.0.md b/docs/migration/v3.x.x-to-v4.0.0.md new file mode 100644 index 000000000000..b202b8c43b78 --- /dev/null +++ b/docs/migration/v3.x.x-to-v4.0.0.md @@ -0,0 +1,78 @@ +## Migration (3.x.x) ➡ 4.0.0 + +## Refactoring of Header and Navigation + +We encountered some problems with the current `DBHeader` as well with the `DBNavigation`. +By splitting the `DBHeader` into 2 components (`DBControlPanelDesktop` & `DBControlPanelMobile`), +we are able to control our navigation based on the device size. +Additionally, we split the `DBNavigationItem` as well to provide a new `DBNavigationItemGroup` instead of +having a Slot with `subNavigation`. + +For a detailed migration based on framework checkout those: + +- [Angular](300-400/shell/Angular.md) +- [React](300-400/shell/React.md) +- [Vue](300-400/shell/Vue.md) + +### Changes in DBPage ➡️ DBShell + +- **Mandatory Usage**: The `DBShell` component is now mandatory and replaces the optional `DBPage`. +- **Removed Properties**: The following properties from `DBPage` are no longer supported in `DBShell`: + - `documentOverflow` + - `variant` + - `footer` +- **Slot Changes**: + - The `header` slot has been split into two new slots: + - `controlPanelDesktop` + - `controlPanelMobile` + +### Changes in DBHeader ➡️ DBControlPanelDesktop/DBControlPanelMobile + +- **Component Split**: The `DBHeader` has been split into two components: + - `DBControlPanelDesktop` + - `DBControlPanelMobile` +- **Slot Wrapping**: The following slots now require additional wrapping components: + - `brand` ➡️ `DBControlPanelBrand` + - `metaNavigation` ➡️ `DBControlPanelMetaNavigation` + - `primaryActions` ➡️ `DBControlPanelPrimaryActions` + - `secondaryActions` ➡️ `DBControlPanelSecondaryActions` + +### Changes in Navigation ➡️ NavigationItemGroup + +- **Slot Removal**: The `subNavigation` slot in `NavigationItem` has been removed. +- **New Component**: Use the new `NavigationItemGroup` component to group navigation items instead of relying on the `subNavigation` slot. + +#### Example Migration + +Before: + +```html +Item + + Group + + +``` + +After: + +```html +Item + + Sub Item 1 + Sub Item 2 + +``` + +## Automate migration via CLI + +We provide a CLI tool to auto migrate your source code. Use this command in your repository: + +```shell +npx @db-ux/core-migration --type=v200_v300 --src=./src +``` + +Please check the changes made in your codebase afterwards, as this is mainly a simple search & replace and there might be unexpected changes of similar wordings to our properties for any other methods, or further code occurrences that don't even refer to properties. diff --git a/docs/package.json b/docs/package.json index a175c31b2153..f50540ce5bab 100644 --- a/docs/package.json +++ b/docs/package.json @@ -1,6 +1,5 @@ { "name": "@db-ux/docs", - "private": true, "version": "0.0.0", "type": "module", "description": "Docs folder for DB UX Design System (Version 3).", @@ -9,6 +8,7 @@ "url": "git+https://github.com/db-ux-design-system/core-web.git" }, "license": "Apache-2.0", + "private": true, "scripts": { "generate:component-research": "node scripts/component-research/generate-component-research.js" }, diff --git a/package-lock.json b/package-lock.json index 3188c5b078a5..732a123236dc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -45,6 +45,7 @@ "@playwright/experimental-ct-react": "1.54.1", "@playwright/experimental-ct-vue": "1.54.1", "@playwright/test": "1.54.1", + "@types/fs-extra": "^11.0.4", "accessibility-checker": "4.0.7", "adm-zip": "0.5.16", "commander": "14.0.0", @@ -56,9 +57,11 @@ "eslint-config-xo": "0.48.0", "eslint-plugin-prettier": "5.5.3", "find-versions": "6.0.0", + "fs-extra": "^11.3.0", "glob": "11.0.3", "http-server": "14.1.1", "husky": "9.1.7", + "ignore": "^7.0.3", "jscpd": "4.0.5", "lint-staged": "16.1.2", "markdownlint-cli": "0.45.0", @@ -3564,6 +3567,22 @@ "esbuild": "bin/esbuild" } }, + "node_modules/@builder.io/mitosis-cli/node_modules/fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@builder.io/mitosis-cli/node_modules/prettier": { "version": "2.8.8", "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", @@ -4151,6 +4170,16 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/@custom-elements-manifest/analyzer/node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, "node_modules/@custom-elements-manifest/analyzer/node_modules/picomatch": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", @@ -4836,6 +4865,16 @@ "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0" } }, + "node_modules/@eslint-community/eslint-plugin-eslint-comments/node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, "node_modules/@eslint-community/eslint-utils": { "version": "4.7.0", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.7.0.tgz", @@ -5016,6 +5055,16 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/@eslint/eslintrc/node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "devOptional": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, "node_modules/@eslint/eslintrc/node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -6857,20 +6906,6 @@ "@colors/colors": "1.5.0" } }, - "node_modules/@jscpd/finder/node_modules/fs-extra": { - "version": "11.3.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.0.tgz", - "integrity": "sha512-Z4XaCL6dUDHfP/jT25jJKMmtxvuwbkrD1vNSMFlo9lNLY2c5FHYSQgHPRZUjAB26TpDEoW9HCOgplrdbaPV/ew==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=14.14" - } - }, "node_modules/@jscpd/html-reporter": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/@jscpd/html-reporter/-/html-reporter-4.0.1.tgz", @@ -6882,20 +6917,6 @@ "pug": "^3.0.3" } }, - "node_modules/@jscpd/html-reporter/node_modules/fs-extra": { - "version": "11.3.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.0.tgz", - "integrity": "sha512-Z4XaCL6dUDHfP/jT25jJKMmtxvuwbkrD1vNSMFlo9lNLY2c5FHYSQgHPRZUjAB26TpDEoW9HCOgplrdbaPV/ew==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=14.14" - } - }, "node_modules/@jscpd/tokenizer": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/@jscpd/tokenizer/-/tokenizer-4.0.1.tgz", @@ -9827,14 +9848,6 @@ "node": ">=18.12.0" } }, - "node_modules/@nuxt/kit/node_modules/ignore": { - "version": "7.0.5", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", - "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", - "engines": { - "node": ">= 4" - } - }, "node_modules/@nuxt/kit/node_modules/semver": { "version": "7.7.2", "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", @@ -10023,15 +10036,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@nuxt/vite-builder/node_modules/ignore": { - "version": "7.0.5", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", - "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", - "license": "MIT", - "engines": { - "node": ">= 4" - } - }, "node_modules/@nuxt/vite-builder/node_modules/meow": { "version": "13.2.0", "resolved": "https://registry.npmjs.org/meow/-/meow-13.2.0.tgz", @@ -12757,6 +12761,17 @@ "@types/send": "*" } }, + "node_modules/@types/fs-extra": { + "version": "11.0.4", + "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-11.0.4.tgz", + "integrity": "sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/jsonfile": "*", + "@types/node": "*" + } + }, "node_modules/@types/hast": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz", @@ -12792,6 +12807,16 @@ "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", "dev": true }, + "node_modules/@types/jsonfile": { + "version": "6.1.4", + "resolved": "https://registry.npmjs.org/@types/jsonfile/-/jsonfile-6.1.4.tgz", + "integrity": "sha512-D5qGUYwjvnNNextdU59/+fI+spnwtTFmyQP0h+PfIOSkNfpU6AOICUOkm4i0OnSk+NyjdPJrxCDro0sJsWlRpQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/katex": { "version": "0.16.7", "resolved": "https://registry.npmjs.org/@types/katex/-/katex-0.16.7.tgz", @@ -13176,15 +13201,6 @@ "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { - "version": "7.0.5", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", - "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", - "dev": true, - "engines": { - "node": ">= 4" - } - }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/minimatch": { "version": "9.0.5", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", @@ -15616,6 +15632,7 @@ "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", "dev": true, + "license": "ISC", "engines": { "node": ">= 4.0.0" } @@ -20708,6 +20725,16 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/eslint-plugin-n/node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, "node_modules/eslint-plugin-n/node_modules/minimatch": { "version": "9.0.5", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", @@ -21092,6 +21119,16 @@ "node": ">=8" } }, + "node_modules/eslint/node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "devOptional": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, "node_modules/eslint/node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -22253,18 +22290,18 @@ "dev": true }, "node_modules/fs-extra": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", - "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "version": "11.3.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.0.tgz", + "integrity": "sha512-Z4XaCL6dUDHfP/jT25jJKMmtxvuwbkrD1vNSMFlo9lNLY2c5FHYSQgHPRZUjAB26TpDEoW9HCOgplrdbaPV/ew==", "dev": true, + "license": "MIT", "dependencies": { - "at-least-node": "^1.0.0", "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" }, "engines": { - "node": ">=10" + "node": ">=14.14" } }, "node_modules/fs-jetpack": { @@ -22878,14 +22915,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/globby/node_modules/ignore": { - "version": "7.0.5", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", - "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", - "engines": { - "node": ">= 4" - } - }, "node_modules/globby/node_modules/unicorn-magic": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.3.0.tgz", @@ -23958,10 +23987,10 @@ } }, "node_modules/ignore": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", - "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", - "devOptional": true, + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", + "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", + "license": "MIT", "engines": { "node": ">= 4" } @@ -25451,20 +25480,6 @@ "node-sarif-builder": "^2.0.3" } }, - "node_modules/jscpd-sarif-reporter/node_modules/fs-extra": { - "version": "11.3.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.0.tgz", - "integrity": "sha512-Z4XaCL6dUDHfP/jT25jJKMmtxvuwbkrD1vNSMFlo9lNLY2c5FHYSQgHPRZUjAB26TpDEoW9HCOgplrdbaPV/ew==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=14.14" - } - }, "node_modules/jscpd/node_modules/commander": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz", @@ -25474,20 +25489,6 @@ "node": ">= 6" } }, - "node_modules/jscpd/node_modules/fs-extra": { - "version": "11.3.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.0.tgz", - "integrity": "sha512-Z4XaCL6dUDHfP/jT25jJKMmtxvuwbkrD1vNSMFlo9lNLY2c5FHYSQgHPRZUjAB26TpDEoW9HCOgplrdbaPV/ew==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=14.14" - } - }, "node_modules/jsesc": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", @@ -27048,15 +27049,6 @@ "node": ">=18" } }, - "node_modules/markdownlint-cli/node_modules/ignore": { - "version": "7.0.5", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", - "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", - "dev": true, - "engines": { - "node": ">= 4" - } - }, "node_modules/markdownlint-cli/node_modules/minimatch": { "version": "10.0.3", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.3.tgz", @@ -30644,15 +30636,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/nuxt/node_modules/ignore": { - "version": "7.0.5", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", - "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", - "license": "MIT", - "engines": { - "node": ">= 4" - } - }, "node_modules/nuxt/node_modules/lru-cache": { "version": "10.4.3", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", @@ -32657,20 +32640,6 @@ "fsevents": "~2.3.2" } }, - "node_modules/postcss-cli/node_modules/fs-extra": { - "version": "11.3.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.0.tgz", - "integrity": "sha512-Z4XaCL6dUDHfP/jT25jJKMmtxvuwbkrD1vNSMFlo9lNLY2c5FHYSQgHPRZUjAB26TpDEoW9HCOgplrdbaPV/ew==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=14.14" - } - }, "node_modules/postcss-cli/node_modules/glob-parent": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", @@ -37243,14 +37212,6 @@ "node": ">= 4" } }, - "node_modules/stylelint/node_modules/ignore": { - "version": "7.0.5", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", - "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", - "engines": { - "node": ">= 4" - } - }, "node_modules/stylelint/node_modules/meow": { "version": "13.2.0", "resolved": "https://registry.npmjs.org/meow/-/meow-13.2.0.tgz", @@ -39423,16 +39384,6 @@ "typescript": ">=4.8.4 <5.9.0" } }, - "node_modules/typescript-eslint/node_modules/ignore": { - "version": "7.0.5", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", - "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 4" - } - }, "node_modules/typical": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/typical/-/typical-4.0.0.tgz", @@ -41719,6 +41670,22 @@ "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", "dev": true }, + "node_modules/workbox-build/node_modules/fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/workbox-build/node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -42456,6 +42423,16 @@ "node": ">=8" } }, + "node_modules/xo/node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, "node_modules/xo/node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -43471,7 +43448,9 @@ "@inquirer/prompts": "7.8.0", "dotenv": "17.2.1", "find-versions": "6.0.0", + "fs-extra": "^11.3.0", "glob": "11.0.3", + "ignore": "^7.0.5", "inquirer": "12.9.0", "replace-in-file": "8.3.0", "tar": "7.4.3", @@ -44139,6 +44118,16 @@ "node": ">=8" } }, + "showcases/patternhub/node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, "showcases/patternhub/node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", diff --git a/package.json b/package.json index cf729a7cbdf1..f4f3b0b76c17 100644 --- a/package.json +++ b/package.json @@ -62,6 +62,7 @@ "prepare": "husky", "regenerate:screenshots": "npm run build && npm run build --workspace=react-showcase && docker-compose --file ./e2e/docker-compose.regenerate.yml up", "regenerate:screenshots:rebuild": "npm run rm:builds && node scripts/rebuild-e2e.js", + "rename-component": "tsx scripts/rename-component.ts", "rm:builds": "npm run rm:builds --workspace=scripts", "start": "npm run start --workspace=patternhub", "test": "npm run test --workspace=scripts", @@ -98,6 +99,7 @@ "@playwright/experimental-ct-react": "1.54.1", "@playwright/experimental-ct-vue": "1.54.1", "@playwright/test": "1.54.1", + "@types/fs-extra": "^11.0.4", "accessibility-checker": "4.0.7", "adm-zip": "0.5.16", "commander": "14.0.0", @@ -109,9 +111,11 @@ "eslint-config-xo": "0.48.0", "eslint-plugin-prettier": "5.5.3", "find-versions": "6.0.0", + "fs-extra": "^11.3.0", "glob": "11.0.3", "http-server": "14.1.1", "husky": "9.1.7", + "ignore": "^7.0.3", "jscpd": "4.0.5", "lint-staged": "16.1.2", "markdownlint-cli": "0.45.0", diff --git a/packages/components/index.html b/packages/components/index.html index 77f76e51c792..a85b46888450 100644 --- a/packages/components/index.html +++ b/packages/components/index.html @@ -8,6 +8,49 @@
    +
  • +DBControlPanelFlatIconNavigation +
  • + +
  • + DBShellSubNavigation +
  • + +
  • + DBNavigationItemGroup +
  • + +
  • + DBControlPanelSecondaryActions +
  • + +
  • + DBControlPanelPrimaryActions +
  • + +
  • + DBControlPanelMetaNavigation +
  • + +
  • + DBControlPanelMobile +
  • +
  • DBCustomSelectListItem
  • - DBBrand + DBControlPanelBrand
  • DBButton @@ -101,7 +146,9 @@ DBDrawer
  • - DBHeader + DBControlPanelDesktop
  • DBIcon diff --git a/packages/components/scripts/post-build/angular.ts b/packages/components/scripts/post-build/angular.ts index 313560688d26..3e6323da8402 100644 --- a/packages/components/scripts/post-build/angular.ts +++ b/packages/components/scripts/post-build/angular.ts @@ -1,7 +1,5 @@ import { replaceInFileSync } from 'replace-in-file'; -import { writeFileSync } from 'node:fs'; - import components, { Overwrite } from './components.js'; import { runReplacements, transformToUpperComponentName } from '../utils'; @@ -87,73 +85,6 @@ const setControlValueAccessorReplacements = ( }); }; -/** - * It's not possible to use multiple times in a component. - * In Angular, you have to use a directive for this... - * This is a workaround to replace it in the file. - */ -const setDirectiveReplacements = ( - replacements: Overwrite[], - outputFolder: string, - componentName: string, - upperComponentName: string, - directives: { name: string; ngContentName?: string }[] -) => { - for (const directive of directives) { - // Add ng-content multiple times to overwrite all - for (let i = 0; i < 4; i++) { - replacements.push({ - from: ``, - to: `` - }); - } - - replacements.push({ - from: `export class ${upperComponentName} implements AfterViewInit {\n`, - to: - `export class ${upperComponentName} implements AfterViewInit {\n` + - `\t@ContentChild(${directive.name}Directive, { read: TemplateRef }) db${directive.name}: any;\n` - }); - - replacements.push({ - from: '@Component({', - to: - `import { ${directive.name}Directive } from './${directive.name}.directive';\n\n` + - '@Component({' - }); - - writeFileSync( - `../../output/angular/src/components/${componentName}/${directive.name}.directive.ts`, - '/* Angular cannot handle multiple slots with the same name, we need to use Directives for this. */\n' + - "import { Directive } from '@angular/core';" + - ` -@Directive({ -\tselector: '[db${directive.name}]', -\tstandalone: true -}) -export class ${directive.name}Directive {} -` - ); - } - - replacements.push({ - from: '} from "@angular/core";', - to: 'ContentChild, TemplateRef } from "@angular/core";' - }); - - const directiveExports = directives - .map( - (directive) => - `export * from './components/${componentName}/${directive.name}.directive';` - ) - .join('\n'); - replaceInFileSync({ - files: `../../${outputFolder}/angular/src/index.ts`, - from: `export * from './components/${componentName}';`, - to: `export * from './components/${componentName}';\n${directiveExports}` - }); -}; - export default (tmp?: boolean) => { const outputFolder = `${tmp ? 'output/tmp' : 'output'}`; for (const component of components) { @@ -184,19 +115,6 @@ export default (tmp?: boolean) => { ); } - if ( - component.config?.angular?.directives && - component.config.angular.directives.length > 0 - ) { - setDirectiveReplacements( - replacements, - outputFolder, - componentName, - upperComponentName, - component.config.angular.directives - ); - } - try { runReplacements(replacements, component, 'angular', file); } catch (error) { diff --git a/packages/components/scripts/post-build/components.ts b/packages/components/scripts/post-build/components.ts index a614566741c4..fc189e43151d 100644 --- a/packages/components/scripts/post-build/components.ts +++ b/packages/components/scripts/post-build/components.ts @@ -1,5 +1,5 @@ export type Overwrite = { - from: string | RegExp; + from: string | string[] | RegExp; to: string; }; @@ -19,7 +19,6 @@ export type Component = { angular?: { controlValueAccessor?: string; controlValueAccessorRequired?: boolean; - directives?: { name: string; ngContentName?: string }[]; }; react?: { propsPassingFilter?: string[]; @@ -29,6 +28,34 @@ export type Component = { }; export const getComponents = (): Component[] => [ + { + name: "control-panel-flat-icon-navigation" + }, + + { + name: 'shell-sub-navigation' + }, + + { + name: 'navigation-item-group' + }, + + { + name: 'control-panel-secondary-actions' + }, + + { + name: 'control-panel-primary-actions' + }, + + { + name: 'control-panel-meta-navigation' + }, + + { + name: 'control-panel-mobile' + }, + { name: 'stack' }, @@ -204,11 +231,6 @@ export const getComponents = (): Component[] => [ to: 'onMouseMove={(event: any)' } ] - }, - config: { - angular: { - directives: [{ name: 'NavigationContent' }] - } } }, { @@ -330,33 +352,18 @@ export const getComponents = (): Component[] => [ }, { - name: 'page' + name: 'shell' }, { - name: 'header', + name: 'control-panel-desktop', config: { - angular: { - directives: [ - { - name: 'SecondaryAction', - ngContentName: 'secondary-action' - }, - { - name: 'MetaNavigation', - ngContentName: 'meta-navigation' - }, - { - name: 'Navigation' - } - ] - }, react: { propsPassingFilter: ['onToggle'] } } }, { - name: 'brand' + name: 'control-panel-brand' }, { name: 'input', diff --git a/packages/components/scripts/post-build/react.ts b/packages/components/scripts/post-build/react.ts index e4c296f14d82..bf142c865033 100644 --- a/packages/components/scripts/post-build/react.ts +++ b/packages/components/scripts/post-build/react.ts @@ -112,7 +112,12 @@ export default (tmp?: boolean) => { to: `, forwardRef, HTMLAttributes } from "react"` }, { - from: `function DB${upperComponentName}(props: DB${upperComponentName}Props) {`, + from: [ + `function DB${upperComponentName}(props: DB${upperComponentName}Props) {`, + `function DB${upperComponentName}( + props: DB${upperComponentName}Props +) {` + ], to: `function DB${upperComponentName}Fn(props: Omit, keyof DB${upperComponentName}Props> & DB${upperComponentName}Props, component: any) {` }, { @@ -147,8 +152,9 @@ export default DB${upperComponentName};` { from: 'className={', to: - `{...getRootProps(props,${JSON.stringify(rootProps)})}` + - '\nclassName={' + `{...getRootProps(props,${JSON.stringify( + rootProps + )})}` + '\nclassName={' }, /* We need to overwrite the internal state._value property just for react to have controlled components. * It works for Angular & Vue, so we overwrite it only for React. */ diff --git a/packages/components/src/components/brand/index.ts b/packages/components/src/components/brand/index.ts deleted file mode 100644 index a4fc5f969974..000000000000 --- a/packages/components/src/components/brand/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default as DBBrand } from './brand'; diff --git a/packages/components/src/components/brand/model.ts b/packages/components/src/components/brand/model.ts deleted file mode 100644 index 2b6b2f5ce87b..000000000000 --- a/packages/components/src/components/brand/model.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { - GlobalProps, - GlobalState, - IconProps, - ShowIconProps, - TextProps -} from '../../shared/model'; - -export type DBBrandDefaultProps = { - /** - * @deprecated: Disable the default logo svg to pass in a custom `img` - */ - hideLogo?: boolean; -}; - -export type DBBrandProps = DBBrandDefaultProps & - GlobalProps & - IconProps & - ShowIconProps & - TextProps; - -export type DBBrandDefaultState = {}; - -export type DBBrandState = DBBrandDefaultState & GlobalState; diff --git a/packages/components/src/components/button/button.scss b/packages/components/src/components/button/button.scss index 859fa9ad4bd5..3390e6950fa5 100644 --- a/packages/components/src/components/button/button.scss +++ b/packages/components/src/components/button/button.scss @@ -110,7 +110,7 @@ opacity: variables.$db-opacity-md; } - // Workaround for current stencil implementation for header + // Workaround for current stencil implementation for control-panel-desktop &:has(> .db-button) { margin: 0; padding: 0; diff --git a/packages/components/src/components/checkbox/checkbox.lite.tsx b/packages/components/src/components/checkbox/checkbox.lite.tsx index 96a9a26b130f..23045a93abf8 100644 --- a/packages/components/src/components/checkbox/checkbox.lite.tsx +++ b/packages/components/src/components/checkbox/checkbox.lite.tsx @@ -68,7 +68,7 @@ export default function DBCheckbox(props: DBCheckboxProps) { DEFAULT_INVALID_MESSAGE; if (hasVoiceOver()) { state._voiceOverFallback = state._invalidMessage; - delay(() => (state._voiceOverFallback = ''), 1000); + void delay(() => (state._voiceOverFallback = ''), 1000); } } else if ( state.hasValidState() && @@ -79,7 +79,7 @@ export default function DBCheckbox(props: DBCheckboxProps) { if (hasVoiceOver()) { state._voiceOverFallback = props.validMessage ?? DEFAULT_VALID_MESSAGE; - delay(() => (state._voiceOverFallback = ''), 1000); + void delay(() => (state._voiceOverFallback = ''), 1000); } } else if (stringPropVisible(props.message, props.showMessage)) { state._descByIds = state._messageId; diff --git a/packages/components/src/components/brand/brand.lite.tsx b/packages/components/src/components/control-panel-brand/control-panel-brand.lite.tsx similarity index 55% rename from packages/components/src/components/brand/brand.lite.tsx rename to packages/components/src/components/control-panel-brand/control-panel-brand.lite.tsx index de0f9e2b64fe..e6647a5f8e16 100644 --- a/packages/components/src/components/brand/brand.lite.tsx +++ b/packages/components/src/components/control-panel-brand/control-panel-brand.lite.tsx @@ -1,34 +1,32 @@ import { Show, + Slot, useDefaultProps, useMetadata, - useRef, - useStore + useRef } from '@builder.io/mitosis'; import { DEFAULT_ICON } from '../../shared/constants'; import { cls, getBooleanAsString } from '../../utils'; -import { DBBrandProps, DBBrandState } from './model'; +import { DBControlPanelBrandProps } from './model'; useMetadata({}); -useDefaultProps({}); +useDefaultProps({}); -export default function DBBrand(props: DBBrandProps) { +export default function DBControlPanelBrand(props: DBControlPanelBrandProps) { const _ref = useRef(null); - // jscpd:ignore-start - const state = useStore({}); - // jscpd:ignore-end return (
    + class={cls('db-control-panel-brand', props.className)}> {props.text} +
    ); } diff --git a/packages/components/src/components/brand/brand.scss b/packages/components/src/components/control-panel-brand/control-panel-brand.scss similarity index 79% rename from packages/components/src/components/brand/brand.scss rename to packages/components/src/components/control-panel-brand/control-panel-brand.scss index 3c42fa9c2ab1..514f0d7f0b0a 100644 --- a/packages/components/src/components/brand/brand.scss +++ b/packages/components/src/components/control-panel-brand/control-panel-brand.scss @@ -2,13 +2,16 @@ @use "@db-ux/core-foundations/build/styles/colors"; @use "@db-ux/core-foundations/build/styles/fonts"; -.db-brand { +.db-control-panel-brand { @extend %db-overwrite-font-size-md; display: flex; gap: variables.$db-spacing-fixed-sm; align-items: center; font-weight: 700; + grid-area: brand; + block-size: variables.$db-sizing-md; + min-block-size: variables.$db-sizing-md; &::before { --db-icon-font-size: #{variables.$db-sizing-md}; @@ -16,6 +19,12 @@ --db-icon-color: #{colors.$db-brand-origin-default}; } + &:has(img, svg) { + &::before { + content: none; + } + } + img { $logo-size: calc( #{variables.$db-sizing-md} - #{variables.$db-sizing-3xs} diff --git a/packages/components/src/components/brand/brand.spec.tsx b/packages/components/src/components/control-panel-brand/control-panel-brand.spec.tsx similarity index 80% rename from packages/components/src/components/brand/brand.spec.tsx rename to packages/components/src/components/control-panel-brand/control-panel-brand.spec.tsx index 936fafa96b0d..bc75ce5108fb 100644 --- a/packages/components/src/components/brand/brand.spec.tsx +++ b/packages/components/src/components/control-panel-brand/control-panel-brand.spec.tsx @@ -1,12 +1,12 @@ import AxeBuilder from '@axe-core/playwright'; import { expect, test } from '@playwright/experimental-ct-react'; -import { DBBrand } from './index'; +import { DBControlPanelBrand } from './index'; // @ts-ignore - vue can only find it with .ts as file ending import { DEFAULT_VIEWPORT } from '../../shared/constants.ts'; -const comp: any = Test; -const testBrand = () => { +const comp: any = Test; +const testControlPanelBrand = () => { test(`should contain text`, async ({ mount }) => { const component = await mount(comp); await expect(component).toContainText('Test'); @@ -26,15 +26,15 @@ const testA11y = () => { test('should not have A11y issues', async ({ page, mount }) => { await mount(comp); const accessibilityScanResults = await new AxeBuilder({ page }) - .include('.db-brand') + .include('.db-control-panel-brand') .analyze(); expect(accessibilityScanResults.violations).toEqual([]); }); }; -test.describe('DBBrand', () => { +test.describe('DBControlPanelBrand', () => { test.use({ viewport: DEFAULT_VIEWPORT }); - testBrand(); + testControlPanelBrand(); testA11y(); }); diff --git a/packages/components/src/components/brand/docs/Angular.md b/packages/components/src/components/control-panel-brand/docs/Angular.md similarity index 67% rename from packages/components/src/components/brand/docs/Angular.md rename to packages/components/src/components/control-panel-brand/docs/Angular.md index e58f45d776e0..fd6140fd3e07 100644 --- a/packages/components/src/components/brand/docs/Angular.md +++ b/packages/components/src/components/control-panel-brand/docs/Angular.md @@ -6,12 +6,12 @@ For general installation and configuration take a look at the [ngx-core-componen ```ts app.component.ts // app.component.ts -import { DBBrand } from '@db-ux/ngx-core-components'; +import { DBControlPanelBrand } from '@db-ux/ngx-core-components'; @Component({ // ... standalone: true, - imports: [..., DBBrand], + imports: [..., DBControlPanelBrand], // ... }) ``` @@ -20,5 +20,5 @@ import { DBBrand } from '@db-ux/ngx-core-components'; ```html app.component.html -Brand +ControlPanelBrand ``` diff --git a/packages/components/src/components/brand/docs/HTML.md b/packages/components/src/components/control-panel-brand/docs/HTML.md similarity index 78% rename from packages/components/src/components/brand/docs/HTML.md rename to packages/components/src/components/control-panel-brand/docs/HTML.md index 371866a04ffe..62372cd89488 100644 --- a/packages/components/src/components/brand/docs/HTML.md +++ b/packages/components/src/components/control-panel-brand/docs/HTML.md @@ -8,6 +8,6 @@ For general installation and configuration take a look at the [components](https ... -
    Brand
    +
    ControlPanelBrand
    ``` diff --git a/packages/components/src/components/brand/docs/Migration.md b/packages/components/src/components/control-panel-brand/docs/Migration.md similarity index 78% rename from packages/components/src/components/brand/docs/Migration.md rename to packages/components/src/components/control-panel-brand/docs/Migration.md index 38c63e556125..5809f9f078e8 100644 --- a/packages/components/src/components/brand/docs/Migration.md +++ b/packages/components/src/components/control-panel-brand/docs/Migration.md @@ -7,15 +7,15 @@ ### class -| Before | Status | After | Description | -| ----------- | :----: | ---------- | ----------- | -| `cmp-brand` | 🔁 | `db-brand` | | +| Before | Status | After | Description | +| ------------------------- | :----: | ------------------------ | ----------- | +| `cmp-control-panel-brand` | 🔁 | `db-control-panel-brand` | | ### properties > **Note** -> We removed all old properties, because brand hasn't a wrapping anchor tag (``) anymore. -> If you want to use a link around `db-brand`, do it by yourself. +> We removed all old properties, because control-panel-brand hasn't a wrapping anchor tag (``) anymore. +> If you want to use a link around `db-control-panel-brand`, do it by yourself. | Before | Status | After | Description | | ---------------- | :----: | :---: | ----------------------------------------------------------------------------------------------------- | diff --git a/packages/components/src/components/brand/docs/React.md b/packages/components/src/components/control-panel-brand/docs/React.md similarity index 61% rename from packages/components/src/components/brand/docs/React.md rename to packages/components/src/components/control-panel-brand/docs/React.md index 556c27495fab..c86f005ee696 100644 --- a/packages/components/src/components/brand/docs/React.md +++ b/packages/components/src/components/control-panel-brand/docs/React.md @@ -6,9 +6,9 @@ For general installation and configuration take a look at the [react-core-compon ```tsx App.tsx // App.tsx -import { DBBrand } from "@db-ux/react-core-components"; +import { DBControlPanelBrand } from "@db-ux/react-core-components"; -const App = () => Brand; +const App = () => ControlPanelBrand; export default App; ``` diff --git a/packages/components/src/components/brand/docs/Vue.md b/packages/components/src/components/control-panel-brand/docs/Vue.md similarity index 66% rename from packages/components/src/components/brand/docs/Vue.md rename to packages/components/src/components/control-panel-brand/docs/Vue.md index 8e99dc6e9d81..d4c3e307b222 100644 --- a/packages/components/src/components/brand/docs/Vue.md +++ b/packages/components/src/components/control-panel-brand/docs/Vue.md @@ -7,10 +7,10 @@ For general installation and configuration take a look at the [v-core-components ```vue App.vue ``` diff --git a/packages/components/src/components/header/index.html b/packages/components/src/components/control-panel-brand/index.html similarity index 65% rename from packages/components/src/components/header/index.html rename to packages/components/src/components/control-panel-brand/index.html index 9520bd064942..4866cecac5e0 100644 --- a/packages/components/src/components/header/index.html +++ b/packages/components/src/components/control-panel-brand/index.html @@ -2,12 +2,10 @@ - DBHeader + DBControlPanelBrand -
    -
    Header
    -
    +
    diff --git a/packages/components/src/components/control-panel-brand/index.ts b/packages/components/src/components/control-panel-brand/index.ts new file mode 100644 index 000000000000..ac47d56f9590 --- /dev/null +++ b/packages/components/src/components/control-panel-brand/index.ts @@ -0,0 +1 @@ +export { default as DBControlPanelBrand } from './control-panel-brand'; diff --git a/packages/components/src/components/control-panel-brand/model.ts b/packages/components/src/components/control-panel-brand/model.ts new file mode 100644 index 000000000000..4a34b1059fee --- /dev/null +++ b/packages/components/src/components/control-panel-brand/model.ts @@ -0,0 +1,22 @@ +import { + AdditionalInformationSlotProps, + GlobalProps, + GlobalState, + IconProps, + ShowIconProps, + TextProps +} from '../../shared/model'; + +export type DBControlPanelBrandDefaultProps = {}; + +export type DBControlPanelBrandProps = DBControlPanelBrandDefaultProps & + GlobalProps & + IconProps & + ShowIconProps & + TextProps & + AdditionalInformationSlotProps; + +export type DBControlPanelBrandDefaultState = {}; + +export type DBControlPanelBrandState = DBControlPanelBrandDefaultState & + GlobalState; diff --git a/packages/components/src/components/control-panel-desktop/control-panel-desktop.lite.tsx b/packages/components/src/components/control-panel-desktop/control-panel-desktop.lite.tsx new file mode 100644 index 000000000000..526ca991eb5b --- /dev/null +++ b/packages/components/src/components/control-panel-desktop/control-panel-desktop.lite.tsx @@ -0,0 +1,109 @@ +import { + onInit, + Slot, + useDefaultProps, + useMetadata, + useRef, + useStore +} from '@builder.io/mitosis'; +import { DEFAULT_COLLAPSE, DEFAULT_EXPAND } from '../../shared/constants'; +import { cls, getBoolean, getBooleanAsString, uuid } from '../../utils'; +import { handleSubNavigationPosition } from '../../utils/navigation'; +import DBButton from '../button/button.lite'; +import DBTooltip from '../tooltip/tooltip.lite'; +import { + DBControlPanelDesktopProps, + DBControlPanelDesktopState +} from './model'; + +useMetadata({}); + +useDefaultProps({}); + +export default function DBControlPanelDesktop( + props: DBControlPanelDesktopProps +) { + const _ref = useRef(null); + const _scrollContainerRef = useRef(null); + // jscpd:ignore-start + const state = useStore({ + _id: `db-control-panel-desktop-${uuid()}`, + _open: true, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + handleToggle: (event: any) => { + if (typeof event.detail !== 'object') { + event.stopPropagation(); + + state._open = !state._open; + } + }, + getToggleButtonText: (): string => { + if (props.onExpandButtonTooltipFn) { + const open = state._open; + return props.onExpandButtonTooltipFn(open); + } + if (props.expandButtonTooltip) { + return props.expandButtonTooltip; + } + + return state._open ? DEFAULT_COLLAPSE : DEFAULT_EXPAND; + }, + onScroll() { + if (!_scrollContainerRef) return; + const popoverNavigation: HTMLElement | null = ( + _scrollContainerRef as HTMLDivElement + ).querySelector('.db-navigation[data-variant="popover"]'); + + if (!popoverNavigation) return; + + const navigationMenu = popoverNavigation.querySelector('menu'); + + if (navigationMenu) { + handleSubNavigationPosition(navigationMenu); + } + } + }); + + // jscpd:ignore-end + + onInit(() => { + if (props.expanded !== undefined) { + state._open = getBoolean(props.expanded, 'expanded') ?? true; + } + }); + + return ( +
    + +
    state.onScroll()}> + {props.children} + +
    + + +
    + state.handleToggle(event)} + variant="ghost" + aria-controls={props.id ?? state._id} + aria-expanded={state._open} + noText + type="button" + icon="double_chevron_left"> + + {state.getToggleButtonText()} + + +
    +
    + ); +} diff --git a/packages/components/src/components/control-panel-desktop/control-panel-desktop.scss b/packages/components/src/components/control-panel-desktop/control-panel-desktop.scss new file mode 100644 index 000000000000..5153d40d0313 --- /dev/null +++ b/packages/components/src/components/control-panel-desktop/control-panel-desktop.scss @@ -0,0 +1,29 @@ +@use "@db-ux/core-foundations/build/styles/variables"; +@use "@db-ux/core-foundations/build/styles/helpers"; +@use "@db-ux/core-foundations/build/styles/density"; +@use "@db-ux/core-foundations/build/styles/colors"; +@use "../../styles/internal/component"; +@use "../../styles/internal/control-panel-desktop"; + +.db-control-panel-desktop { + background-color: colors.$db-adaptive-bg-basic-level-1-default; + display: grid; + position: relative; + min-block-size: component.$min-mobile-header-height; + + &[data-orientation="vertical"] { + @extend %control-panel-desktop-vertical-orientation; + } + + &[data-orientation="horizontal"] { + @extend %control-panel-desktop-horizontal-orientation; + } + + .db-link { + display: inline-block; + } + + .db-navigation { + grid-area: navigation; + } +} diff --git a/packages/components/src/components/header/docs/Angular.md b/packages/components/src/components/control-panel-desktop/docs/Angular.md similarity index 81% rename from packages/components/src/components/header/docs/Angular.md rename to packages/components/src/components/control-panel-desktop/docs/Angular.md index 2a7ef65a4457..fdf77f505d94 100644 --- a/packages/components/src/components/header/docs/Angular.md +++ b/packages/components/src/components/control-panel-desktop/docs/Angular.md @@ -7,7 +7,7 @@ For general installation and configuration take a look at the [ngx-core-componen ```ts app.component.ts //app.component.ts import { - DBHeader, + DBControlPanelDesktop, NavigationDirective, SecondaryActionDirective, MetaNavigationDirective @@ -17,7 +17,7 @@ import { // ... imports: [ // ..., - DBHeader, + DBControlPanelDesktop, NavigationDirective, // Optional: If you want to use a Navigation SecondaryActionDirective, // Optional: If you want to use ActionBar MetaNavigationDirective, // Optional: If you want to use MetaNavigation @@ -32,9 +32,11 @@ import { ```html app.component.html - - Header - + + ControlPanelDesktop + ``` #### Full @@ -59,8 +61,13 @@ export class AppComponent { ```html app.component.html - - My Awesome App + + My Awesome App @@ -82,5 +89,5 @@ export class AppComponent { Help - + ``` diff --git a/packages/components/src/components/header/docs/HTML.md b/packages/components/src/components/control-panel-desktop/docs/HTML.md similarity index 73% rename from packages/components/src/components/header/docs/HTML.md rename to packages/components/src/components/control-panel-desktop/docs/HTML.md index baf8cc17dd68..ec6c78999d4f 100644 --- a/packages/components/src/components/header/docs/HTML.md +++ b/packages/components/src/components/control-panel-desktop/docs/HTML.md @@ -8,15 +8,15 @@ For general installation and configuration take a look at the [components](https ... -
    + -
    + -
    -
    -
    +
    +
    +
    DBHeader + >DBControlPanelDesktop
    -
    -
    +
    +
    -
    +
    -
    -
    +
    +
    -
    +
    -
    + ``` diff --git a/packages/components/src/components/header/docs/Migration.md b/packages/components/src/components/control-panel-desktop/docs/Migration.md similarity index 64% rename from packages/components/src/components/header/docs/Migration.md rename to packages/components/src/components/control-panel-desktop/docs/Migration.md index e09a47128fc2..cfd41ef4213b 100644 --- a/packages/components/src/components/header/docs/Migration.md +++ b/packages/components/src/components/control-panel-desktop/docs/Migration.md @@ -7,9 +7,9 @@ ### class -| Before | Status | After | Description | -| ------------ | :----: | ----------- | ----------- | -| `rea-header` | 🔁 | `db-header` | | +| Before | Status | After | Description | +| --------------------------- | :----: | -------------------------- | ----------- | +| `rea-control-panel-desktop` | 🔁 | `db-control-panel-desktop` | | ### mobile diff --git a/packages/components/src/components/header/docs/React.md b/packages/components/src/components/control-panel-desktop/docs/React.md similarity index 70% rename from packages/components/src/components/header/docs/React.md rename to packages/components/src/components/control-panel-desktop/docs/React.md index bd3874e9e60c..546e9d4b227d 100644 --- a/packages/components/src/components/header/docs/React.md +++ b/packages/components/src/components/control-panel-desktop/docs/React.md @@ -8,9 +8,18 @@ For general installation and configuration take a look at the [react-core-compon ```tsx App.tsx // App.tsx -import { DBHeader, DBBrand } from "@db-ux/react-core-components"; +import { + DBControlPanelDesktop, + DBControlPanelBrand +} from "@db-ux/react-core-components"; -const App = () => Header} />; +const App = () => ( + ControlPanelDesktop + } + /> +); export default App; ``` @@ -20,15 +29,21 @@ export default App; ```tsx App.tsx // App.tsx import { useState } from "react"; -import { DBHeader, DBBrand, DBLink } from "@db-ux/react-core-components"; +import { + DBControlPanelDesktop, + DBControlPanelBrand, + DBLink +} from "@db-ux/react-core-components"; const [drawerOpen, setDrawerOpen] = useState(false); const App = () => ( - My Awesome App} + control-panel-brand={ + My Awesome App + } metaNavigation={ <> Imprint @@ -58,7 +73,7 @@ const App = () => ( // https://github.com/db-ux-design-system/core-web/blob/main/packages/components/src/components/navigation/docs/React.md - + ); export default App; diff --git a/packages/components/src/components/header/docs/Vue.md b/packages/components/src/components/control-panel-desktop/docs/Vue.md similarity index 69% rename from packages/components/src/components/header/docs/Vue.md rename to packages/components/src/components/control-panel-desktop/docs/Vue.md index c642932f6a97..23568fe8bd2f 100644 --- a/packages/components/src/components/header/docs/Vue.md +++ b/packages/components/src/components/control-panel-desktop/docs/Vue.md @@ -9,13 +9,18 @@ For general installation and configuration take a look at the [v-core-components ```vue App.vue ``` @@ -25,7 +30,7 @@ import { DBHeader, DBBrand } from "@db-ux/v-core-components"; diff --git a/showcases/nuxt-showcase/nuxt.config.ts b/showcases/nuxt-showcase/nuxt.config.ts index 38a1dc415ab4..8f7983b4e16f 100644 --- a/showcases/nuxt-showcase/nuxt.config.ts +++ b/showcases/nuxt-showcase/nuxt.config.ts @@ -1,3 +1,8 @@ +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); + export default defineNuxtConfig({ telemetry: false, devtools: { enabled: true }, @@ -25,5 +30,8 @@ export default defineNuxtConfig({ dir: '../../build-showcases/nuxt-showcase', publicDir: '../../build-showcases/nuxt-showcase' } + }, + alias: { + '@components': path.resolve(__dirname, '../../output/vue/src') } }); diff --git a/showcases/nuxt-showcase/tsconfig.json b/showcases/nuxt-showcase/tsconfig.json index 947f6b690488..98b8b6b77482 100644 --- a/showcases/nuxt-showcase/tsconfig.json +++ b/showcases/nuxt-showcase/tsconfig.json @@ -1,4 +1,10 @@ { // https://nuxt.com/docs/guide/concepts/typescript - "extends": "./.nuxt/tsconfig.json" + "extends": "./.nuxt/tsconfig.json", + "compilerOptions": { + "paths": { + "@components": ["../../output/vue/src"], + "@components/src/*": ["../../output/vue/src/*"] + } + } } diff --git a/showcases/patternhub/components/accessibility-review-info/accessibility-review-info.tsx b/showcases/patternhub/components/accessibility-review-info/accessibility-review-info.tsx index 355a15795f1e..c739ca4a4daa 100644 --- a/showcases/patternhub/components/accessibility-review-info/accessibility-review-info.tsx +++ b/showcases/patternhub/components/accessibility-review-info/accessibility-review-info.tsx @@ -1,5 +1,5 @@ +import { DBInfotext, type SemanticType } from '@components'; import { useEffect, useState } from 'react'; -import { DBInfotext, type SemanticType } from '../../../../output/react/src'; export type AccessibilityReviewInfoType = { name: string; diff --git a/showcases/patternhub/components/card-navigation/card-navigation.tsx b/showcases/patternhub/components/card-navigation/card-navigation.tsx index 01afc98fef28..5ecd6be3a094 100644 --- a/showcases/patternhub/components/card-navigation/card-navigation.tsx +++ b/showcases/patternhub/components/card-navigation/card-navigation.tsx @@ -1,6 +1,6 @@ +import { DBCard, DBIcon } from '@components'; import Link from 'next/link'; import { useRouter } from 'next/router'; -import { DBCard, DBIcon } from '../../../../output/react/src'; import { getAllNavigationItems } from '../../data/routes'; import DefaultPage from '../default-page'; diff --git a/showcases/patternhub/components/component-parser/data.ts b/showcases/patternhub/components/component-parser/data.ts index 2ef8805544d9..2431b8013ea5 100644 --- a/showcases/patternhub/components/component-parser/data.ts +++ b/showcases/patternhub/components/component-parser/data.ts @@ -5,7 +5,8 @@ export type ComponentParserType = { export type ComponentType = { index?: string | number; type?: /* Template hygen type */ - | 'stack' + | 'control-panel-mobile' + | 'stack' | 'switch' | 'custom-select' | 'tab-panel' diff --git a/showcases/patternhub/components/component-parser/index.tsx b/showcases/patternhub/components/component-parser/index.tsx index a5d3e56c81ef..2d4a5fdf61a2 100644 --- a/showcases/patternhub/components/component-parser/index.tsx +++ b/showcases/patternhub/components/component-parser/index.tsx @@ -1,15 +1,13 @@ -import { useEffect, useState } from 'react'; import { DBAccordion, DBAccordionItem, DBBadge, - DBBrand, DBButton, DBCard, DBCheckbox, + DBControlPanelMobile, DBCustomSelect, DBDivider, - DBHeader, DBIcon, DBInfotext, DBInput, @@ -30,7 +28,8 @@ import { DBTag, DBTextarea, DBTooltip -} from '../../../../output/react/src/index'; +} from '@components'; +import { useEffect, useState } from 'react'; import type { ComponentParserType, ComponentType } from './data'; const validHosts = new Set(['marketingportal.extranet.deutschebahn.com']); @@ -116,14 +115,6 @@ const ComponentSwitch = ({ ); } - if (type === 'brand') { - return ( - - {resolvedContent} - - ); - } - if (type === 'button') { return ( @@ -148,14 +139,6 @@ const ComponentSwitch = ({ ); } - if (type === 'header') { - return ( - - {resolvedContent} - - ); - } - if (type === 'icon') { return ( @@ -348,6 +331,14 @@ const ComponentSwitch = ({ ); } + if (type === 'control-panel-mobile') { + return ( + + {resolvedContent} + + ); + } + // Template hygen before return {resolvedContent}; diff --git a/showcases/patternhub/components/control-panel/primary-actions.tsx b/showcases/patternhub/components/control-panel/primary-actions.tsx new file mode 100644 index 000000000000..269b97736d33 --- /dev/null +++ b/showcases/patternhub/components/control-panel/primary-actions.tsx @@ -0,0 +1,28 @@ +import { DBControlPanelPrimaryActions, DBSwitch, DBTooltip } from '@components'; + +const PrimaryActions = ({ + mode, + setColorMode +}: { + mode: boolean; + setColorMode: (dark: boolean) => void; +}) => { + return ( + + { + setColorMode(!mode); + }}> + Switch color scheme (light/dark) + Switch color scheme (light/dark) + + + ); +}; + +export default PrimaryActions; diff --git a/showcases/patternhub/components/control-panel/secondary-actions.tsx b/showcases/patternhub/components/control-panel/secondary-actions.tsx new file mode 100644 index 000000000000..0006ed7131b8 --- /dev/null +++ b/showcases/patternhub/components/control-panel/secondary-actions.tsx @@ -0,0 +1,12 @@ +import { DBControlPanelSecondaryActions } from '@components'; +import VersionSwitcher from '../version-switcher'; + +const SecondaryActions = () => { + return ( + + + + ); +}; + +export default SecondaryActions; diff --git a/showcases/patternhub/components/copy-clipboard-button/index.tsx b/showcases/patternhub/components/copy-clipboard-button/index.tsx index 8ec2706e8ce7..57c4ce8d70ba 100644 --- a/showcases/patternhub/components/copy-clipboard-button/index.tsx +++ b/showcases/patternhub/components/copy-clipboard-button/index.tsx @@ -1,5 +1,5 @@ +import { DBButton, DBTooltip } from '@components'; import { type MouseEvent, type ReactNode, useEffect, useState } from 'react'; -import { DBButton, DBTooltip } from '../../../../output/react/src/index'; export type CopyClipboardButtonProps = { name: string; diff --git a/showcases/patternhub/components/default-page.tsx b/showcases/patternhub/components/default-page.tsx index 8561dd6df82f..e4e1edc986e2 100644 --- a/showcases/patternhub/components/default-page.tsx +++ b/showcases/patternhub/components/default-page.tsx @@ -1,3 +1,12 @@ +import { + DBCard, + DBControlPanelBrand, + DBControlPanelDesktop, + DBControlPanelMobile, + DBIcon, + DBSection, + DBShell +} from '@components'; import hljs from 'highlight.js'; import dynamic from 'next/dynamic'; import Link from 'next/link'; @@ -9,23 +18,14 @@ import { useEffect, useState } from 'react'; -import { - DBBrand, - DBCard, - DBHeader, - DBIcon, - DBPage, - DBSection, - DBSwitch, - DBTooltip -} from '../../../output/react/src'; import { getBreadcrumb, getNavigationList, type NavigationItem } from '../data/routes'; +import PrimaryActions from './control-panel/primary-actions'; +import SecondaryActions from './control-panel/secondary-actions'; import Navigation from './navigation'; -import VersionSwitcher from './version-switcher'; const preferDark = '(prefers-color-scheme: dark)'; const colorModeKey = 'db-ux-mode'; @@ -132,38 +132,42 @@ const DefaultPage = ({ )} {router.isReady && !fullscreen && ( - + {process.env.NEXT_PUBLIC_APP_NAME} + + } + primaryActions={ + + } + secondaryActions={}> + + + } + controlPanelMobile={ + + {process.env.NEXT_PUBLIC_APP_NAME} - + } - primaryAction={ - { - setColorMode(!mode); - }}> - - Switch color scheme (light/dark) - - Switch color scheme (light/dark) - + primaryActions={ + } - secondaryAction={}> + secondaryActions={}> - + }> {breadcrumb && breadcrumb.length > 1 && ( @@ -230,7 +234,7 @@ const DefaultPage = ({ )} )} - + )} ); diff --git a/showcases/patternhub/components/foundations/colors/colors-overview-tabs/index.tsx b/showcases/patternhub/components/foundations/colors/colors-overview-tabs/index.tsx index a08b3cd474b7..2eab48d9493a 100644 --- a/showcases/patternhub/components/foundations/colors/colors-overview-tabs/index.tsx +++ b/showcases/patternhub/components/foundations/colors/colors-overview-tabs/index.tsx @@ -1,11 +1,11 @@ -import { useState } from 'react'; import { DBSwitch, DBTabItem, DBTabList, DBTabPanel, DBTabs -} from '../../../../../../output/react/src'; +} from '@components'; +import { useState } from 'react'; import ColorsGrid from '../colors-grid'; import { type ColorValue } from '../data'; diff --git a/showcases/patternhub/components/link-header/index.tsx b/showcases/patternhub/components/link-header/index.tsx index 143bd9df0f6f..a58c1b15b19f 100644 --- a/showcases/patternhub/components/link-header/index.tsx +++ b/showcases/patternhub/components/link-header/index.tsx @@ -1,5 +1,5 @@ +import { DBIcon } from '@components'; import Link from 'next/link'; -import { DBIcon } from '../../../../output/react/src'; const LinkHeader = ({ id }) => { if (id) { diff --git a/showcases/patternhub/components/navigation/index.tsx b/showcases/patternhub/components/navigation/index.tsx index 8359bbde4e55..75e2e6db21ec 100644 --- a/showcases/patternhub/components/navigation/index.tsx +++ b/showcases/patternhub/components/navigation/index.tsx @@ -1,4 +1,4 @@ -import { DBNavigation } from '../../../../output/react/src'; +import { DBNavigation } from '@components'; import { ROUTES, type NavigationItem } from '../../data/routes'; import NavItem from './nav-item'; diff --git a/showcases/patternhub/components/navigation/nav-item.tsx b/showcases/patternhub/components/navigation/nav-item.tsx index 6fee97317a9a..65aac38a706b 100644 --- a/showcases/patternhub/components/navigation/nav-item.tsx +++ b/showcases/patternhub/components/navigation/nav-item.tsx @@ -1,6 +1,6 @@ +import { DBNavigationItem, DBNavigationItemGroup } from '@components'; import Link from 'next/link'; import { type NextRouter, useRouter } from 'next/router'; -import { DBNavigationItem } from '../../../../output/react/src'; import type { NavigationItem } from '../../data/routes'; const isRouteActive = ( @@ -25,34 +25,30 @@ const NavItem = ({ navItem }: { navItem: NavigationItem }) => { const isActive = isRouteActive(router.pathname, navItem, router); + if (navItem.subNavigation) { + return ( + + {navItem.subNavigation + .filter(({ isHiddenInMenu }) => isHiddenInMenu !== true) + .map((subItem: NavigationItem) => ( + + ))} + + ); + } + return ( - - {navItem?.subNavigation - .filter( - ({ isHiddenInMenu }) => isHiddenInMenu !== true - ) - .map((subItem: NavigationItem) => ( - - ))} - - ) - }> - {navItem.subNavigation ? ( - navItem.label - ) : ( - - {navItem.label} - - )} + + + {navItem.label} + ); }; diff --git a/showcases/patternhub/components/playgrounds/data.ts b/showcases/patternhub/components/playgrounds/data.ts new file mode 100644 index 000000000000..e8f2b9e5434a --- /dev/null +++ b/showcases/patternhub/components/playgrounds/data.ts @@ -0,0 +1,54 @@ +export type PlaygroundCardProps = { + type?: 'stackblitz' | 'codesandbox' | string; + hrefPath?: string; + asset?: string; + headline?: string; + description?: string; +}; + +export const plagrounds: PlaygroundCardProps[] = [ + { + headline: 'React 18', + hrefPath: 'react-example', + asset: '/assets/images/react-showcase.svg', + description: 'React app including `@db-ux/react-core-components`' + }, + { + headline: 'Vue 3', + hrefPath: 'vue-example', + asset: '/assets/images/vue-showcase.svg', + description: 'Vue app including `@db-ux/v-core-components`' + }, + { + headline: 'Angular 17', + hrefPath: 'angular17-example', + asset: '/assets/images/angular-showcase.svg', + description: 'Angular app including `@db-ux/ngx-core-components`' + }, + { + headline: 'React 18 + tailwind', + hrefPath: 'react-tailwind-example', + asset: '/assets/images/react-wind-showcase.svg', + description: + 'React + tailwind app including `@db-ux/react-core-components`' + }, + {}, + { + headline: 'React Shell Documentation Example', + hrefPath: 'shell-examples/react-documentation-example', + asset: '/assets/images/react-showcase.svg', + description: 'How to build a documentation app with new `DBShell`' + }, + { + headline: 'React Shell KPI Example', + hrefPath: 'shell-examples/react-kpi-example', + asset: '/assets/images/react-showcase.svg', + description: 'How to build a KPI app with new `DBShell`' + }, + { + headline: 'React Shell Table Example', + hrefPath: 'shell-examples/react-table-example', + asset: '/assets/images/react-showcase.svg', + description: 'How to build a Table app with new `DBShell`' + } +]; diff --git a/showcases/patternhub/components/playgrounds/index.tsx b/showcases/patternhub/components/playgrounds/index.tsx new file mode 100644 index 000000000000..783f843d3c7f --- /dev/null +++ b/showcases/patternhub/components/playgrounds/index.tsx @@ -0,0 +1,34 @@ +import { DBTabItem, DBTabList, DBTabPanel, DBTabs } from '@components'; +import { plagrounds } from './data'; +import PlaygroundCard from './playground-card'; + +const Index = () => { + return ( + + + StackBlitz + CodeSandbox + + {['stackblitz', 'codesandbox'].map((type) => ( + +
    +

    + {type === 'stackblitz' + ? 'StackBlitz' + : 'CodeSandbox'} +

    + {plagrounds.map((playground) => ( + + ))} +
    +
    + ))} +
    + ); +}; + +export default Index; diff --git a/showcases/patternhub/components/playgrounds/playground-card.tsx b/showcases/patternhub/components/playgrounds/playground-card.tsx new file mode 100644 index 000000000000..89f373b9dc39 --- /dev/null +++ b/showcases/patternhub/components/playgrounds/playground-card.tsx @@ -0,0 +1,45 @@ +import { DBCard, DBDivider, DBStack } from '@components'; +import { type PlaygroundCardProps } from './data'; + +const PlaygroundCard = ({ + hrefPath, + type, + asset, + description, + headline +}: PlaygroundCardProps) => { + const href = + type === 'codesandbox' + ? `https://codesandbox.io/s/github/db-ux-design-system/examples/tree/main/${hrefPath}` + : `https://stackblitz.com/fork/github/db-ux-design-system/examples/tree/main/${hrefPath}?file=index.html`; + + if (!headline) { + return ( + <> + + + + ); + } + + return ( + + + + {headline} + + {headline} + {description} + + + + + ); +}; + +export default PlaygroundCard; diff --git a/showcases/patternhub/components/validation-example/index.tsx b/showcases/patternhub/components/validation-example/index.tsx index 9faec5899dac..a95baecb1522 100644 --- a/showcases/patternhub/components/validation-example/index.tsx +++ b/showcases/patternhub/components/validation-example/index.tsx @@ -1,9 +1,4 @@ -import { - DBButton, - DBCard, - DBInfotext, - DBInput -} from '../../../../output/react/src'; +import { DBButton, DBCard, DBInfotext, DBInput } from '@components'; const ValidationExample = () => { return ( diff --git a/showcases/patternhub/components/version-switcher/version-switcher.tsx b/showcases/patternhub/components/version-switcher/version-switcher.tsx index 43727af0cd81..7690f7168721 100644 --- a/showcases/patternhub/components/version-switcher/version-switcher.tsx +++ b/showcases/patternhub/components/version-switcher/version-switcher.tsx @@ -1,7 +1,7 @@ +import { DBSelect } from '@components'; import DOMPurify from 'dompurify'; import { useRouter } from 'next/router'; import { useEffect, useState } from 'react'; -import { DBSelect } from '../../../../output/react/src'; import { type BranchGroup, type GithubResponse } from './data'; const fetchFromGitHubApi = async (url: string): Promise => { diff --git a/showcases/patternhub/data/components.json b/showcases/patternhub/data/components.json index 987d0eb9d487..2dcf3b3f5946 100644 --- a/showcases/patternhub/data/components.json +++ b/showcases/patternhub/data/components.json @@ -20,8 +20,8 @@ "name": "data-display", "subNavigation": [ { - "label": "DBBrand", - "name": "brand" + "label": "DBControlPanelBrand", + "name": "control-panel-brand" }, { "label": "DBTooltip", @@ -135,8 +135,12 @@ "name": "drawer" }, { - "label": "DBHeader", - "name": "header" + "label": "DBControlPanelDesktop", + "name": "control-panel-desktop" + }, + { + "label": "DBControlPanelMobile", + "name": "control-panel-mobile" }, { "label": "DBSection", diff --git a/showcases/patternhub/data/routes.tsx b/showcases/patternhub/data/routes.tsx index 4b31222b4520..f6e49c4f6e91 100644 --- a/showcases/patternhub/data/routes.tsx +++ b/showcases/patternhub/data/routes.tsx @@ -1,20 +1,23 @@ import { type ReactElement } from 'react'; import AccordionComponent from '../../react-showcase/src/components/accordion'; import AccordionItemComponent from '../../react-showcase/src/components/accordion-item'; -import BrandComponent from '../../react-showcase/src/components/brand'; import ButtonComponent from '../../react-showcase/src/components/button'; import LinkComponent from '../../react-showcase/src/components/link'; // Import IconComponent from '../../react-showcase/src/components/icon'; import BadgeComponent from '../../react-showcase/src/components/badge'; import CardComponent from '../../react-showcase/src/components/card'; import CheckboxComponent from '../../react-showcase/src/components/checkbox'; +import ControlPanelDesktop from '../../react-showcase/src/components/control-panel-desktop'; import DividerComponent from '../../react-showcase/src/components/divider'; import DrawerComponent from '../../react-showcase/src/components/drawer'; -import HeaderComponent from '../../react-showcase/src/components/header'; import InfotextComponent from '../../react-showcase/src/components/infotext'; import InputComponent from '../../react-showcase/src/components/input'; +import NavigationComponent from '../../react-showcase/src/components/navigation'; +import NavigationItemComponent from '../../react-showcase/src/components/navigation-item'; import NotificationComponent from '../../react-showcase/src/components/notification'; +import PopoverComponent from '../../react-showcase/src/components/popover'; import RadioComponent from '../../react-showcase/src/components/radio'; +import SectionComponent from '../../react-showcase/src/components/section'; import SelectComponent from '../../react-showcase/src/components/select'; import SwitchComponent from '../../react-showcase/src/components/switch'; import TabItemComponent from '../../react-showcase/src/components/tab-item'; @@ -22,43 +25,38 @@ import TabsComponent from '../../react-showcase/src/components/tabs'; import TagComponent from '../../react-showcase/src/components/tag'; import TextareaComponent from '../../react-showcase/src/components/textarea'; import TooltipComponent from '../../react-showcase/src/components/tooltip'; -// Import PageComponent from '../../react-showcase/src/components/page'; -import NavigationComponent from '../../react-showcase/src/components/navigation'; -import NavigationItemComponent from '../../react-showcase/src/components/navigation-item'; -import PopoverComponent from '../../react-showcase/src/components/popover'; -import SectionComponent from '../../react-showcase/src/components/section'; import * as accordionCode from '../components/code-docs/accordion'; import * as accordionItemCode from '../components/code-docs/accordion-item'; -import * as brandCode from '../components/code-docs/brand'; import * as buttonCode from '../components/code-docs/button'; import * as linkCode from '../components/code-docs/link'; // Import * as iconCode from '../components/code-docs/icon'; +import ControlPanelMobileComponent from '../../react-showcase/src/components/control-panel-mobile'; +import MutliSelectComponent from '../../react-showcase/src/components/custom-select'; +import StackComponent from '../../react-showcase/src/components/stack'; import * as badgeCode from '../components/code-docs/badge'; import * as cardCode from '../components/code-docs/card'; import * as checkboxCode from '../components/code-docs/checkbox'; +import * as controlPanelDesktopCode from '../components/code-docs/control-panel-desktop'; +import * as ControlPanelMobileCode from '../components/code-docs/control-panel-mobile'; +import * as CustomSelectCode from '../components/code-docs/custom-select'; import * as dividerCode from '../components/code-docs/divider'; import * as drawerCode from '../components/code-docs/drawer'; -import * as headerCode from '../components/code-docs/header'; import * as infotextCode from '../components/code-docs/infotext'; import * as inputCode from '../components/code-docs/input'; +import * as navigationCode from '../components/code-docs/navigation'; +import * as navigationItemCode from '../components/code-docs/navigation-item'; import * as notificationCode from '../components/code-docs/notification'; +import * as popoverCode from '../components/code-docs/popover'; import * as radioCode from '../components/code-docs/radio'; +import * as sectionCode from '../components/code-docs/section'; import * as selectCode from '../components/code-docs/select'; +import * as StackCode from '../components/code-docs/stack'; import * as switchCode from '../components/code-docs/switch'; import * as tabItemCode from '../components/code-docs/tab-item'; import * as tabsCode from '../components/code-docs/tabs'; import * as tagCode from '../components/code-docs/tag'; import * as textareaCode from '../components/code-docs/textarea'; import * as tooltipCode from '../components/code-docs/tooltip'; -// Import * as pageCode from '../components/code-docs/page'; -import MutliSelectComponent from '../../react-showcase/src/components/custom-select'; -import StackComponent from '../../react-showcase/src/components/stack'; -import * as CustomSelectCode from '../components/code-docs/custom-select'; -import * as navigationCode from '../components/code-docs/navigation'; -import * as navigationItemCode from '../components/code-docs/navigation-item'; -import * as popoverCode from '../components/code-docs/popover'; -import * as sectionCode from '../components/code-docs/section'; -import * as StackCode from '../components/code-docs/stack'; import Components from './components.json'; export type NavigationItem = { @@ -71,11 +69,14 @@ export type NavigationItem = { }; const nameComponentMap = { + 'control-panel-mobile': ( + + ), + 'custom-select': , stack: , button: , link: , - brand: , // Icon: , tooltip: , infotext: , @@ -117,8 +118,9 @@ const nameComponentMap = { card: , divider: , drawer: , - header: , - // Page: , + 'control-panel-desktop': ( + + ), section: , navigation: ( { // eslint-disable-next-line unicorn/no-array-reduce const paths = componentChildren.reduce( - (accumulator: DBPagePath[], { subNavigation, name }) => { + (accumulator: DBShellPath[], { subNavigation, name }) => { if (subNavigation) { for (const subNavItem of subNavigation) { if (!subNavItem.component || !subNavItem.name) { diff --git a/showcases/patternhub/pages/foundations/colors/color-modes.tsx b/showcases/patternhub/pages/foundations/colors/color-modes.tsx index 8b197f73197d..be8c2f563891 100644 --- a/showcases/patternhub/pages/foundations/colors/color-modes.tsx +++ b/showcases/patternhub/pages/foundations/colors/color-modes.tsx @@ -1,5 +1,5 @@ +import { DBButton, DBCard, DBTag } from '@components'; import { useState } from 'react'; -import { DBButton, DBCard, DBTag } from '../../../../../output/react/src'; import { SEMANTICS } from '../../../../../packages/components/src/shared/constants'; import DefaultPage from '../../../components/default-page'; diff --git a/showcases/patternhub/pages/foundations/colors/color-schemes.tsx b/showcases/patternhub/pages/foundations/colors/color-schemes.tsx index 6153b99f84c6..6511e56f66aa 100644 --- a/showcases/patternhub/pages/foundations/colors/color-schemes.tsx +++ b/showcases/patternhub/pages/foundations/colors/color-schemes.tsx @@ -1,4 +1,4 @@ -import { DBInfotext } from '../../../../../output/react/src'; +import { DBInfotext } from '@components'; import DefaultPage from '../../../components/default-page'; import ColorsOverviewTabs from '../../../components/foundations/colors/colors-overview-tabs'; import { diff --git a/showcases/patternhub/pages/foundations/colors/color-usage-guide.tsx b/showcases/patternhub/pages/foundations/colors/color-usage-guide.tsx index dbd7e090d392..eeda9dd2bfb9 100644 --- a/showcases/patternhub/pages/foundations/colors/color-usage-guide.tsx +++ b/showcases/patternhub/pages/foundations/colors/color-usage-guide.tsx @@ -1,6 +1,6 @@ +import { DBCard, DBLink, DBSection } from '@components'; import Link from 'next/link'; import { ArcherContainer, ArcherElement } from 'react-archer'; -import { DBCard, DBLink, DBSection } from '../../../../../output/react/src'; import DefaultPage from '../../../components/default-page'; const ColorUsageGuide = () => { diff --git a/showcases/patternhub/pages/foundations/densities/examples.tsx b/showcases/patternhub/pages/foundations/densities/examples.tsx index b5996bf2c0ce..a6a4d18ccb04 100644 --- a/showcases/patternhub/pages/foundations/densities/examples.tsx +++ b/showcases/patternhub/pages/foundations/densities/examples.tsx @@ -1,4 +1,4 @@ -import { DBButton, DBCard, DBInput } from '../../../../../output/react/src'; +import { DBButton, DBCard, DBInput } from '@components'; import DefaultPage from '../../../components/default-page'; const densities = ['functional', 'regular', 'expressive']; diff --git a/showcases/patternhub/pages/foundations/font-sizes/overview.tsx b/showcases/patternhub/pages/foundations/font-sizes/overview.tsx index ada94406093b..7fa64eb5ee66 100644 --- a/showcases/patternhub/pages/foundations/font-sizes/overview.tsx +++ b/showcases/patternhub/pages/foundations/font-sizes/overview.tsx @@ -1,10 +1,5 @@ +import { DBIcon, DBInfotext, DBSection, DBSwitch } from '@components'; import { useState } from 'react'; -import { - DBIcon, - DBInfotext, - DBSection, - DBSwitch -} from '../../../../../output/react/src'; import DefaultPage from '../../../components/default-page'; import IntrinsicElements = React.JSX.IntrinsicElements; diff --git a/showcases/patternhub/pages/foundations/icons/overview.tsx b/showcases/patternhub/pages/foundations/icons/overview.tsx index 4e56a3ac6680..6964811d57c9 100644 --- a/showcases/patternhub/pages/foundations/icons/overview.tsx +++ b/showcases/patternhub/pages/foundations/icons/overview.tsx @@ -1,12 +1,6 @@ +import { DBCard, DBIcon, DBInfotext, DBInput, DBSelect } from '@components'; import { ALL_ICONS } from '@db-ux/db-theme-icons'; import { useState } from 'react'; -import { - DBCard, - DBIcon, - DBInfotext, - DBInput, - DBSelect -} from '../../../../../output/react/src'; import DefaultPage from '../../../components/default-page'; const IconOverview = () => { diff --git a/showcases/patternhub/pages/foundations/playgrounds/index.mdx b/showcases/patternhub/pages/foundations/playgrounds/index.mdx index e17b4ed3b833..06b0a09cb301 100644 --- a/showcases/patternhub/pages/foundations/playgrounds/index.mdx +++ b/showcases/patternhub/pages/foundations/playgrounds/index.mdx @@ -1,5 +1,5 @@ import DefaultPage from "../../../components/default-page"; -import { DBCard } from "../../../../../output/react/src"; +import Playgrounds from "../../../components/playgrounds"; # Playgrounds @@ -7,80 +7,6 @@ You can try out our components on StackBlitz or CodeSandbox without downloading We would also appreciate it if you could provide a working example when opening an issue in our repository. Please keep in mind not to share any internal information or data this way, not even in screenshots. This includes internal URLs. Only use sample material. -
    - - ## CodeSandbox - - - - ![](/assets/images/react-showcase.svg) - React 18 - React app including `@db-ux/react-core-components` - - - - - - ![](/assets/images/vue-showcase.svg) - Vue 3 - Vue app including `@db-ux/v-core-components` - - - - - - ![](/assets/images/angular-showcase.svg) - Angular 17 - Angular app including `@db-ux/ngx-core-components` - - - - - - ![](/assets/images/react-wind-showcase.svg) - React 18 + tailwind - React + tailwind app including `@db-ux/react-core-components` - - - -
    - -
    - - ## StackBlitz - - - - ![](/assets/images/react-showcase.svg) - React 18 - React app including `@db-ux/react-core-components` - - - - - - ![](/assets/images/vue-showcase.svg) - Vue 3 - Vue app including `@db-ux/v-core-components` - - - - - - ![](/assets/images/angular-showcase.svg) - Angular 17 - Angular app including `@db-ux/ngx-core-components` - - - - - - ![](/assets/images/react-wind-showcase.svg) - React 18 + tailwind - React + tailwind app including `@db-ux/react-core-components` - - - -
    + export default ({ children }) => {children}; diff --git a/showcases/patternhub/pages/foundations/test-table/index.tsx b/showcases/patternhub/pages/foundations/test-table/index.tsx index 3a5c757a0a1e..692204adb8c1 100644 --- a/showcases/patternhub/pages/foundations/test-table/index.tsx +++ b/showcases/patternhub/pages/foundations/test-table/index.tsx @@ -1,4 +1,4 @@ -import { DBInfotext } from '../../../../../output/react/src'; +import { DBInfotext } from '@components'; import AccessibilityReviewInfo from '../../../components/accessibility-review-info/accessibility-review-info'; // This file will be generated at runtime import DefaultPage from '../../../components/default-page'; import { testTableData } from '../../../data/testing-table'; // This file will be generated at runtime by /showcases/patternhub/scripts/generate-test-table.js diff --git a/showcases/patternhub/pages/foundations/variables/examples.tsx b/showcases/patternhub/pages/foundations/variables/examples.tsx index dbe9254a1b51..2e2e85c81e1b 100644 --- a/showcases/patternhub/pages/foundations/variables/examples.tsx +++ b/showcases/patternhub/pages/foundations/variables/examples.tsx @@ -1,9 +1,4 @@ -import { - DBButton, - DBCard, - DBIcon, - DBInfotext -} from '../../../../../output/react/src'; +import { DBButton, DBCard, DBIcon, DBInfotext } from '@components'; import DefaultPage from '../../../components/default-page'; const Example = () => { diff --git a/showcases/patternhub/scripts/generate-example-jsx.js b/showcases/patternhub/scripts/generate-example-jsx.js index 806780fe6391..1bbe84e77c57 100644 --- a/showcases/patternhub/scripts/generate-example-jsx.js +++ b/showcases/patternhub/scripts/generate-example-jsx.js @@ -54,7 +54,7 @@ const generateExampleJSX = () => { `./scripts/generated/index.jsx`, "import { renderToString } from 'react-dom/server';\n" + "import React from 'react';\n" + - `import {${imports.join(',')}} from '../../../../output/react/src';\n\n` + + `import {${imports.join(',')}} from '@components';\n\n` + `export const allExamples = {${examples.join(',\n')}}` ); }; diff --git a/showcases/patternhub/scripts/get-code-files.js b/showcases/patternhub/scripts/get-code-files.js index a5e4d02bcea7..f8475df520a7 100644 --- a/showcases/patternhub/scripts/get-code-files.js +++ b/showcases/patternhub/scripts/get-code-files.js @@ -38,7 +38,7 @@ const getExamplesAsMDX = async (componentName, variant) => { 'DBTabList,\n' + 'DBTabPanel,\n' + 'DBTabs\n' + - "} from '../../../../../output/react/src';\n" + + "} from '@components';\n" + `const ${variant.name} = () => { const [copied, setCopied] = useState(); diff --git a/showcases/patternhub/styles/globals.scss b/showcases/patternhub/styles/globals.scss index d6433e3f9a6c..35b693bff21c 100644 --- a/showcases/patternhub/styles/globals.scss +++ b/showcases/patternhub/styles/globals.scss @@ -7,11 +7,11 @@ @forward "@db-ux/core-components/build/styles/webpack"; @forward "@db-ux/db-theme/build/styles/webpack"; -:root:not(:has(.db-page)) { +:root:not(:has(.db-shell)) { color-scheme: light; } -body:not(:has(.db-page)) { +body:not(:has(.db-shell)) { padding-block-end: variables.$db-spacing-fixed-lg; } @@ -19,14 +19,6 @@ body:not(:has(.db-page)) { scroll-behavior: smooth; } -#__next { - block-size: inherit; -} - -#__next > div { - block-size: inherit; -} - db-mainnavigation { margin: auto; } @@ -120,7 +112,7 @@ table th { max-inline-size: variables.$db-sizing-3xl; } -/* Workaround for current db-page from db-ux-elements */ +/* Workaround for current db-shell from db-ux-elements */ div[class^="ch-"] { div, span { diff --git a/showcases/patternhub/tsconfig.json b/showcases/patternhub/tsconfig.json index 02d15ee8c846..b3b456b1bbad 100644 --- a/showcases/patternhub/tsconfig.json +++ b/showcases/patternhub/tsconfig.json @@ -17,7 +17,11 @@ "noUnusedLocals": false, "noUnusedParameters": false, "jsx": "preserve", - "incremental": true + "incremental": true, + "paths": { + "@components": ["../../output/react/src"], + "@components/src/*": ["../../output/react/src/*"] + } }, "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], "exclude": ["node_modules"] diff --git a/showcases/react-showcase/src/app.tsx b/showcases/react-showcase/src/app.tsx index 0c1aec45d6d2..53377b49d13b 100644 --- a/showcases/react-showcase/src/app.tsx +++ b/showcases/react-showcase/src/app.tsx @@ -1,78 +1,94 @@ -import { useState } from 'react'; +import { + DBControlPanelBrand, + DBControlPanelDesktop, + DBControlPanelMobile, + DBShell, + DBShellSubNavigation +} from '@components'; import { Outlet } from 'react-router-dom'; -import { DBBrand, DBButton, DBHeader, DBPage } from '../../../output/react/src'; +import MetaNavigation from './control-panel/meta-navigation'; +import PrimaryActions from './control-panel/primary-actions'; +import SecondaryActions from './control-panel/secondary-actions'; import useQuery from './hooks/use-query'; -import MetaNavigation from './meta-navigation'; import Navigation from './navigation'; const App = () => { - const [density, setDensity, color, setColor, pageName, fullscreen] = - useQuery(); + const { + density, + setDensity, + color, + setColor, + page, + fullscreen, + setSettings, + settings + } = useQuery(); - const [drawerOpen, setDrawerOpen] = useState(false); - - if (pageName ?? fullscreen) { + if (page ?? fullscreen) { return ( -
    +
    ); } return ( - Showcase} - metaNavigation={ - + + + } + controlPanelMobile={ + Showcase} + primaryActions={ + } - primaryAction={ - /* TODO: Use DBSearchBar in future */ - - Search - + secondaryActions={} + metaNavigation={}> + + + } + controlPanelDesktop={ + Showcase} + metaNavigation={} + primaryActions={ + } - secondaryAction={ - <> - - Profile - - - Notification - - - Help - - - }> - - + secondaryActions={}> + + }>
    -
    + ); }; diff --git a/showcases/react-showcase/src/components/accordion-item/index.tsx b/showcases/react-showcase/src/components/accordion-item/index.tsx index d0650d1020d5..c5e5dda72ccf 100644 --- a/showcases/react-showcase/src/components/accordion-item/index.tsx +++ b/showcases/react-showcase/src/components/accordion-item/index.tsx @@ -1,5 +1,5 @@ -import { DBAccordionItem } from '../../../../../output/react/src'; -import type { DBAccordionItemProps } from '../../../../../output/react/src/components/accordion-item/model'; +import { DBAccordionItem } from '@components'; +import type { DBAccordionItemProps } from '@components/src/components/accordion-item/model'; import defaultComponentVariants from '../../../../shared/accordion-item.json'; import { type BaseComponentProps } from '../base-component-data'; import { getVariants } from '../data'; diff --git a/showcases/react-showcase/src/components/accordion/index.tsx b/showcases/react-showcase/src/components/accordion/index.tsx index 17c9aa816e2e..cff7b9339082 100644 --- a/showcases/react-showcase/src/components/accordion/index.tsx +++ b/showcases/react-showcase/src/components/accordion/index.tsx @@ -1,9 +1,5 @@ -import { - DBAccordion, - DBAccordionItem, - DBInfotext -} from '../../../../../output/react/src'; -import type { DBAccordionProps } from '../../../../../output/react/src/components/accordion/model'; +import { DBAccordion, DBAccordionItem, DBInfotext } from '@components'; +import type { DBAccordionProps } from '@components/src/components/accordion/model'; import defaultComponentVariants from '../../../../shared/accordion.json'; import { type BaseComponentProps } from '../base-component-data'; import { getVariants } from '../data'; diff --git a/showcases/react-showcase/src/components/badge/index.tsx b/showcases/react-showcase/src/components/badge/index.tsx index 2110baec4749..9c98323f37e8 100644 --- a/showcases/react-showcase/src/components/badge/index.tsx +++ b/showcases/react-showcase/src/components/badge/index.tsx @@ -1,10 +1,5 @@ -import { - DBBadge, - DBButton, - DBIcon, - DBInfotext -} from '../../../../../output/react/src'; -import type { DBBadgeProps } from '../../../../../output/react/src/components/badge/model'; +import { DBBadge, DBButton, DBIcon, DBInfotext } from '@components'; +import type { DBBadgeProps } from '@components/src/components/badge/model'; import defaultComponentVariants from '../../../../shared/badge.json'; import { type BaseComponentProps } from '../base-component-data'; import { getVariants } from '../data'; diff --git a/showcases/react-showcase/src/components/brand/index.tsx b/showcases/react-showcase/src/components/brand/index.tsx index f03ed384a062..d80acfcd7750 100644 --- a/showcases/react-showcase/src/components/brand/index.tsx +++ b/showcases/react-showcase/src/components/brand/index.tsx @@ -1,7 +1,5 @@ -/* eslint-disable @typescript-eslint/no-deprecated */ - -import { DBBrand } from '../../../../../output/react/src'; -import { type DBBrandProps } from '../../../../../output/react/src/components/brand/model'; +import { DBControlPanelBrand } from '@components'; +import { type DBControlPanelBrandProps } from '@components/src/components/control-panel-brand/model'; import defaultComponentVariants from '../../../../shared/brand.json'; import { type BaseComponentProps } from '../base-component-data'; import { getVariants } from '../data'; @@ -9,24 +7,25 @@ import DefaultComponent from '../default-component'; const getBrand = ({ children, - hideLogo, customLogo -}: DBBrandProps & { customLogo: boolean }) => ( - +}: DBControlPanelBrandProps & { customLogo: boolean }) => ( + {customLogo && ( this is a fancy placeholder logo )} {children} - + ); const BrandComponent = (props: BaseComponentProps) => { return ( ( <> ( + + {withName && 'DBHeader'} + + } + metaNavigation={ + withMeta && ( + + Imprint + Help + + ) + } + primaryActions={ + withPrimary && ( + + + Search + + + ) + } + secondaryActions={ + withSecondary && ( + + + Profile + + + Notification + + + Help + + + ) + } + className={className} + id={id} + orientation={orientation}> + {withNavigation && ( + + + {children} + + + {children} disabled + + + )} + +); + +const ControlPanelDesktopComponent = (props: BaseComponentProps) => { + return ( + + ); +}; + +export default ControlPanelDesktopComponent; diff --git a/showcases/react-showcase/src/components/control-panel-mobile/index.tsx b/showcases/react-showcase/src/components/control-panel-mobile/index.tsx new file mode 100644 index 000000000000..c19dda93d29c --- /dev/null +++ b/showcases/react-showcase/src/components/control-panel-mobile/index.tsx @@ -0,0 +1,117 @@ +import { + DBButton, + DBControlPanelBrand, + DBControlPanelFlatIconNavigation, + DBControlPanelMetaNavigation, + DBControlPanelMobile, + DBControlPanelPrimaryActions, + DBControlPanelSecondaryActions, + DBLink, + DBNavigation, + DBNavigationItem +} from '@components'; +import type { DBControlPanelMobileProps } from '@components/src/components/control-panel-mobile/model'; +import defaultComponentVariants from '../../../../shared/control-panel-mobile.json'; +import type { BaseComponentProps } from '../base-component-data'; +import { getVariants } from '../data'; +import DefaultComponent from '../default-component'; + +const getControlPanelMobile = ({ + children, + withNavigation = true, + withName = true, + withPrimary = true, + withSecondary = true, + withMeta = true, + noText = false, + position = 'top', + variant +}: DBControlPanelMobileProps & { + withName: boolean; + withPrimary: boolean; + withSecondary: boolean; + withMeta: boolean; + withNavigation: boolean; + noText: boolean; +}) => ( + + {withName && 'DBHeader'} + + } + metaNavigation={ + withMeta && ( + + Imprint + Help + + ) + } + primaryActions={ + withPrimary && ( + + + Search + + + ) + } + secondaryActions={ + withSecondary && ( + + + Profile + + + Notification + + + Help + + + ) + } + flatIconNavigation={ + + + + {children} + + + {children} disabled + + + {children} long + + + + }> + {withNavigation && ( + + + {children} + + + {children} disabled + + + )} + +); + +const ControlPanelMobileComponent = (props: BaseComponentProps) => { + return ( + + ); +}; + +export default ControlPanelMobileComponent; diff --git a/showcases/react-showcase/src/components/custom-select/index.tsx b/showcases/react-showcase/src/components/custom-select/index.tsx index d6ad9dfc0825..afdc09621adf 100644 --- a/showcases/react-showcase/src/components/custom-select/index.tsx +++ b/showcases/react-showcase/src/components/custom-select/index.tsx @@ -1,7 +1,7 @@ +import { DBCustomSelect, DBInfotext } from '@components'; +import type { DBCustomSelectProps } from '@components/src/components/custom-select/model'; import { type CustomSelectOptionType } from '@db-ux/core-components/src/components/custom-select/model'; import { useState } from 'react'; -import { DBCustomSelect, DBInfotext } from '../../../../../output/react/src'; -import type { DBCustomSelectProps } from '../../../../../output/react/src/components/custom-select/model'; import defaultComponentVariants from '../../../../shared/custom-select.json'; import type { BaseComponentProps } from '../base-component-data'; import { getVariants } from '../data'; @@ -38,11 +38,7 @@ const getCustomSelect = ({ searchValue, selectedLabels, transformSelectedLabels, - searchFilter, - validMessage, - validation, - invalidMessage, - showRequiredAsterisk + searchFilter }: DBCustomSelectProps & { lineBreak?: boolean; info?: boolean; @@ -74,7 +70,6 @@ const getCustomSelect = ({ return ( { - if (typeof globalThis !== 'undefined') { - const searchParameters = new URLSearchParams( - globalThis?.location?.href.split('?')[1] - ); - searchParameters.set('page', variantName.toLowerCase()); - return `${globalThis?.location?.href.split('?')[0]}?${searchParameters.toString()}`; + if ( + typeof globalThis !== 'undefined' && + process.env.NEXT_SHOWCASE_VARIANT !== 'next-ssr' + ) { + const urlPaths = globalThis?.location?.href.split('?'); + if (urlPaths?.length > 1) { + const searchParameters = new URLSearchParams(urlPaths[1]); + searchParameters.set('page', variantName.toLowerCase()); + return `${urlPaths[0]}?${searchParameters.toString()}`; + } } - return ''; + return '/'; }; const openVariantInNewWindow = ( diff --git a/showcases/react-showcase/src/components/divider/index.tsx b/showcases/react-showcase/src/components/divider/index.tsx index 5af690fc84dd..51c1f425c6b0 100644 --- a/showcases/react-showcase/src/components/divider/index.tsx +++ b/showcases/react-showcase/src/components/divider/index.tsx @@ -1,5 +1,5 @@ -import { DBDivider, DBInfotext } from '../../../../../output/react/src'; -import { type DBDividerProps } from '../../../../../output/react/src/components/divider/model'; +import { DBDivider, DBInfotext } from '@components'; +import { type DBDividerProps } from '@components/src/components/divider/model'; import defaultComponentVariants from '../../../../shared/divider.json'; import { type BaseComponentProps } from '../base-component-data'; import { getVariants } from '../data'; diff --git a/showcases/react-showcase/src/components/drawer/index.tsx b/showcases/react-showcase/src/components/drawer/index.tsx index f30132cb4c4d..967b676a7c18 100644 --- a/showcases/react-showcase/src/components/drawer/index.tsx +++ b/showcases/react-showcase/src/components/drawer/index.tsx @@ -1,6 +1,6 @@ +import { DBButton, DBDrawer } from '@components'; +import type { DBDrawerProps } from '@components/src/components/drawer/model'; import { useState } from 'react'; -import { DBButton, DBDrawer } from '../../../../../output/react/src'; -import type { DBDrawerProps } from '../../../../../output/react/src/components/drawer/model'; import defaultComponentVariants from '../../../../shared/drawer.json'; import { type BaseComponentProps } from '../base-component-data'; import { getVariants } from '../data'; diff --git a/showcases/react-showcase/src/components/form/index.tsx b/showcases/react-showcase/src/components/form/index.tsx index d8da140fa7e0..6ac874a5b60d 100644 --- a/showcases/react-showcase/src/components/form/index.tsx +++ b/showcases/react-showcase/src/components/form/index.tsx @@ -1,4 +1,3 @@ -import { useEffect, useState } from 'react'; import { DBAccordion, DBAccordionItem, @@ -17,14 +16,15 @@ import { DBTabs, DBTag, DBTextarea, - DBTooltip -} from '../../../../../output/react/src'; -import type { - ChangeEvent, - ValueLabelType -} from '../../../../../output/react/src/shared/model'; + DBTooltip, + type ChangeEvent, + type ValueLabelType +} from '@components'; +import { useEffect, useId, useState } from 'react'; const FormComponent = () => { + const tabsId = useId(); + const tabsVerticalId = useId(); const [input, setInput] = useState(''); const [dateinput, setDateinput] = useState(''); const [textarea, setTextarea] = useState('default textarea'); @@ -304,9 +304,7 @@ const FormComponent = () => { ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor{' '} - labore et dolore magna aliquyam erat, sed diam voluptua. - At vero eos et accusam et justo duo dolores et ea rebum. - Stet + labore et dolore magna {' '} ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. @@ -320,7 +318,7 @@ const FormComponent = () => { }}> TabsTest - + Test 1 Test 2 @@ -331,7 +329,10 @@ const FormComponent = () => { {tabsTest && Tab Panel 3} - + Airplane Button diff --git a/showcases/react-showcase/src/components/header/index.tsx b/showcases/react-showcase/src/components/header/index.tsx deleted file mode 100644 index de04b0320d8d..000000000000 --- a/showcases/react-showcase/src/components/header/index.tsx +++ /dev/null @@ -1,100 +0,0 @@ -import { - DBBrand, - DBButton, - DBHeader, - DBLink, - DBNavigation, - DBNavigationItem -} from '../../../../../output/react/src'; -import { type DBHeaderProps } from '../../../../../output/react/src/components/header/model'; -import defaultComponentVariants from '../../../../shared/header.json'; -import { type BaseComponentProps } from '../base-component-data'; -import { getVariants } from '../data'; -import DefaultComponent from '../default-component'; - -const getHeader = ({ - drawerOpen, - forceMobile, - burgerMenuLabel, - children, - className, - id, - onToggle, - width, - example, - withNavigation, - withName -}: DBHeaderProps & { - example: boolean; - withName: boolean; - withNavigation: boolean; -}) => ( - - {(!example || withName) && 'DBHeader'} - - } - metaNavigation={ - !example && ( - <> - Imprint - Help - - ) - } - primaryAction={ - !example && ( - - Search - - ) - } - secondaryAction={ - !example && ( - <> - - Profile - - - Notification - - - Help - - - ) - } - drawerOpen={drawerOpen} - forceMobile={forceMobile} - burgerMenuLabel={burgerMenuLabel} - className={className} - id={id} - onToggle={onToggle}> - {(!example || withNavigation) && ( - - - {children} - - - {children} disabled - - - )} - -); - -const HeaderComponent = (props: BaseComponentProps) => { - return ( - - ); -}; - -export default HeaderComponent; diff --git a/showcases/react-showcase/src/components/home/index.tsx b/showcases/react-showcase/src/components/home/index.tsx index d9f8763d143d..542d6b930cdc 100644 --- a/showcases/react-showcase/src/components/home/index.tsx +++ b/showcases/react-showcase/src/components/home/index.tsx @@ -4,6 +4,7 @@ import { DBTabPanel, DBTabs } from '@db-ux/react-core-components/src'; +import { useId } from 'react'; import FormComponent from '../form'; import FormCheckboxes from '../form/checkbox'; import FormCustomSelects from '../form/custom-select'; @@ -13,8 +14,9 @@ import FormSelects from '../form/select'; import FormTextareas from '../form/textarea'; const Home = () => { + const id = useId(); return ( - + All Input diff --git a/showcases/react-showcase/src/components/icon/index.tsx b/showcases/react-showcase/src/components/icon/index.tsx index a441aa732f22..1d9f06ecc051 100644 --- a/showcases/react-showcase/src/components/icon/index.tsx +++ b/showcases/react-showcase/src/components/icon/index.tsx @@ -1,5 +1,5 @@ -import { DBIcon, DBInfotext } from '../../../../../output/react/src'; -import { type DBIconProps } from '../../../../../output/react/src/components/icon/model'; +import { DBIcon, DBInfotext } from '@components'; +import { type DBIconProps } from '@components/src/components/icon/model'; import defaultComponentVariants from '../../../../shared/icon.json'; import { type BaseComponentProps } from '../base-component-data'; import { getVariants } from '../data'; diff --git a/showcases/react-showcase/src/components/infotext/index.tsx b/showcases/react-showcase/src/components/infotext/index.tsx index 262d51b5789f..c8d605e8d477 100644 --- a/showcases/react-showcase/src/components/infotext/index.tsx +++ b/showcases/react-showcase/src/components/infotext/index.tsx @@ -1,5 +1,5 @@ -import { DBInfotext } from '../../../../../output/react/src'; -import { type DBInfotextProps } from '../../../../../output/react/src/components/infotext/model'; +import { DBInfotext } from '@components'; +import { type DBInfotextProps } from '@components/src/components/infotext/model'; import defaultComponentVariants from '../../../../shared/infotext.json'; import { type BaseComponentProps } from '../base-component-data'; import { getVariants } from '../data'; diff --git a/showcases/react-showcase/src/components/input/index.tsx b/showcases/react-showcase/src/components/input/index.tsx index 83409a9b428a..d91f70c22ed7 100644 --- a/showcases/react-showcase/src/components/input/index.tsx +++ b/showcases/react-showcase/src/components/input/index.tsx @@ -2,8 +2,8 @@ import { DBInput, type LabelVariantType, type ValueLabelType -} from '../../../../../output/react/src'; -import { type DBInputProps } from '../../../../../output/react/src/components/input/model'; +} from '@components'; +import { type DBInputProps } from '@components/src/components/input/model'; import defaultComponentVariants from '../../../../shared/input.json'; import { type BaseComponentProps } from '../base-component-data'; import { getVariants } from '../data'; @@ -43,7 +43,6 @@ const getInput = ({ validMessage, validation, invalidMessage, - showRequiredAsterisk, maxLength, max, min @@ -55,7 +54,6 @@ const getInput = ({ placeholder={children} variant={variant} showLabel={showLabel} - showRequiredAsterisk={showRequiredAsterisk} defaultValue={value} type={type} minLength={minLength} diff --git a/showcases/react-showcase/src/components/link/index.tsx b/showcases/react-showcase/src/components/link/index.tsx index 3e02e11ba99a..6868215820eb 100644 --- a/showcases/react-showcase/src/components/link/index.tsx +++ b/showcases/react-showcase/src/components/link/index.tsx @@ -1,5 +1,5 @@ -import { DBLink } from '../../../../../output/react/src'; -import { type DBLinkProps } from '../../../../../output/react/src/components/link/model'; +import { DBLink } from '@components'; +import { type DBLinkProps } from '@components/src/components/link/model'; import defaultComponentVariants from '../../../../shared/link.json'; import { type BaseComponentProps } from '../base-component-data'; import { getVariants } from '../data'; diff --git a/showcases/react-showcase/src/components/navigation-item/index.tsx b/showcases/react-showcase/src/components/navigation-item/index.tsx index ff3a979314e6..05ec586d0dad 100644 --- a/showcases/react-showcase/src/components/navigation-item/index.tsx +++ b/showcases/react-showcase/src/components/navigation-item/index.tsx @@ -1,5 +1,5 @@ -import { DBNavigationItem } from '../../../../../output/react/src'; -import type { DBNavigationItemProps } from '../../../../../output/react/src/components/navigation-item/model'; +import { DBNavigationItem, DBNavigationItemGroup } from '@components'; +import type { DBNavigationItemProps } from '@components/src/components/navigation-item/model'; import defaultComponentVariants from '../../../../shared/navigation-item.json'; import { type BaseComponentProps } from '../base-component-data'; import { getVariants } from '../data'; @@ -10,48 +10,35 @@ const getNavigationItem = ({ icon, disabled, active, - width, areaPopup, - showIcon, - wrap + showIcon }: DBNavigationItemProps & { areaPopup: boolean }) => (
      - { - // eslint-disable-next-line no-alert - alert(children.toString()); - }} - showIcon={showIcon} - wrap={wrap} - subNavigation={ - areaPopup && ( - <> - - - Navigation-Item 2 - - - }> - Also a navigation item with longer label - - - Navigation-Item 1 - - - ) - }> - {areaPopup ? children : {children}} - + {areaPopup ? ( + + + Navigation-Item 1 + + + Navigation-Item 2 + + + ) : ( + { + // eslint-disable-next-line no-alert + alert(children.toString()); + }} + showIcon={showIcon}> + {areaPopup ? children : {children}} + + )}
    ); diff --git a/showcases/react-showcase/src/components/navigation/index.tsx b/showcases/react-showcase/src/components/navigation/index.tsx index cda765c200da..491250a2945d 100644 --- a/showcases/react-showcase/src/components/navigation/index.tsx +++ b/showcases/react-showcase/src/components/navigation/index.tsx @@ -1,9 +1,10 @@ import { DBInfotext, DBNavigation, - DBNavigationItem -} from '../../../../../output/react/src'; -import type { DBNavigationProps } from '../../../../../output/react/src/components/navigation/model'; + DBNavigationItem, + DBNavigationItemGroup +} from '@components'; +import type { DBNavigationProps } from '@components/src/components/navigation/model'; import defaultComponentVariants from '../../../../shared/navigation.json'; import { type BaseComponentProps } from '../base-component-data'; import { getVariants } from '../data'; @@ -21,31 +22,21 @@ const getNavigation = ({ children }: DBNavigationProps) => { {children} - - - - - Sub-Sub-Navi-Item 1 - - - - Sub-Sub-Navi-Item 2 - - - }> - Sub-Navi-Item 1 - - - Sub-Navi-Item 2 - - - }> - Navi-Item 1 - + + + + + Sub-Sub-Navi-Item 1 + + + + Sub-Sub-Navi-Item 2 + + + + Sub-Navi-Item 2 + + Navi-Item 2 diff --git a/showcases/react-showcase/src/components/notification/index.tsx b/showcases/react-showcase/src/components/notification/index.tsx index 84e97c723685..483ef993dbeb 100644 --- a/showcases/react-showcase/src/components/notification/index.tsx +++ b/showcases/react-showcase/src/components/notification/index.tsx @@ -1,5 +1,5 @@ -import { DBLink, DBNotification } from '../../../../../output/react/src'; -import { type DBNotificationProps } from '../../../../../output/react/src/components/notification/model'; +import { DBLink, DBNotification } from '@components'; +import { type DBNotificationProps } from '@components/src/components/notification/model'; import defaultComponentVariants from '../../../../shared/notification.json'; import { getBasePath } from '../../utils/base-path'; import { type BaseComponentProps } from '../base-component-data'; diff --git a/showcases/react-showcase/src/components/page/index.tsx b/showcases/react-showcase/src/components/page/index.tsx deleted file mode 100644 index cea2c91bde4b..000000000000 --- a/showcases/react-showcase/src/components/page/index.tsx +++ /dev/null @@ -1,76 +0,0 @@ -import { - DBBrand, - DBButton, - DBHeader, - DBLink, - DBNavigation, - DBNavigationItem, - DBPage -} from '../../../../../output/react/src'; -import { type DBPageProps } from '../../../../../output/react/src/components/page/model'; -import defaultComponentVariants from '../../../../shared/page.json'; -import { type BaseComponentProps } from '../base-component-data'; -import { getVariants } from '../data'; -import DefaultComponent from '../default-component'; - -const getPage = ({ variant, fadeIn, children, className, id }: DBPageProps) => ( - DBHeader} - metaNavigation={ - <> - Imprint - Help - - } - primaryAction={ - - Search - - } - secondaryAction={ - <> - - Profile - - - Notification - - - Help - - - }> - - - {children} - - - {children} disabled - - - - } - footer={<>Footer Content}> - My Page Content - -); - -const PageComponent = (props: BaseComponentProps) => { - return ( - - ); -}; - -export default PageComponent; diff --git a/showcases/react-showcase/src/components/popover/index.tsx b/showcases/react-showcase/src/components/popover/index.tsx index 4b917a5bc55b..54e939c505cd 100644 --- a/showcases/react-showcase/src/components/popover/index.tsx +++ b/showcases/react-showcase/src/components/popover/index.tsx @@ -1,5 +1,5 @@ -import { DBButton, DBPopover } from '../../../../../output/react/src'; -import type { DBPopoverProps } from '../../../../../output/react/src/components/popover/model'; +import { DBButton, DBPopover } from '@components'; +import type { DBPopoverProps } from '@components/src/components/popover/model'; import defaultComponentVariants from '../../../../shared/popover.json'; import { type BaseComponentProps } from '../base-component-data'; import { getVariants } from '../data'; diff --git a/showcases/react-showcase/src/components/radio/index.tsx b/showcases/react-showcase/src/components/radio/index.tsx index ae2d84326642..fdf770f8dba7 100644 --- a/showcases/react-showcase/src/components/radio/index.tsx +++ b/showcases/react-showcase/src/components/radio/index.tsx @@ -1,9 +1,5 @@ -import { - DBInfotext, - DBRadio, - getBoolean -} from '../../../../../output/react/src'; -import { type DBRadioProps } from '../../../../../output/react/src/components/radio/model'; +import { DBInfotext, DBRadio, getBoolean } from '@components'; +import { type DBRadioProps } from '@components/src/components/radio/model'; import defaultComponentVariants from '../../../../shared/radio.json'; import { type BaseComponentProps } from '../base-component-data'; import { getVariants } from '../data'; @@ -19,12 +15,10 @@ const getRadio = ({ disabled, value, showLabel, - validation, - showRequiredAsterisk + validation }: DBRadioProps) => ( <> { const [mValue, setValue] = useState(value); return ( @@ -34,7 +33,6 @@ const getSelect = ({ showLabel={showLabel} icon={icon} value={mValue} - showRequiredAsterisk={showRequiredAsterisk} onChange={(event) => { setValue(event.target.value); }} diff --git a/showcases/react-showcase/src/components/shell/index.tsx b/showcases/react-showcase/src/components/shell/index.tsx new file mode 100644 index 000000000000..a70f6a9d7ec0 --- /dev/null +++ b/showcases/react-showcase/src/components/shell/index.tsx @@ -0,0 +1,100 @@ +import { + DBButton, + DBControlPanelBrand, + DBControlPanelDesktop, + DBControlPanelMetaNavigation, + DBControlPanelPrimaryActions, + DBControlPanelSecondaryActions, + DBLink, + DBNavigation, + DBNavigationItem, + DBShell, + type DBShellProps +} from '@components'; +import defaultComponentVariants from '../../../../shared/shell.json'; +import { type BaseComponentProps } from '../base-component-data'; +import { getVariants } from '../data'; +import DefaultComponent from '../default-component'; + +const getShell = ({ + controlPanelDesktopPosition, + controlPanelMobilePosition, + fadeIn, + children, + className, + id +}: DBShellProps) => ( + + DBHeader + + } + metaNavigation={ + + Imprint + Help + + } + primaryActions={ + + + Search + + + } + secondaryActions={ + + + Profile + + + Notification + + + Help + + + }> + + + {children} + + + {children} disabled + + + + }> + My Page Content + +); + +const ShellComponent = (props: BaseComponentProps) => { + return ( + + ); +}; + +export default ShellComponent; diff --git a/showcases/react-showcase/src/components/stack/index.tsx b/showcases/react-showcase/src/components/stack/index.tsx index 7872be6eb779..bb4d84a49cff 100644 --- a/showcases/react-showcase/src/components/stack/index.tsx +++ b/showcases/react-showcase/src/components/stack/index.tsx @@ -1,9 +1,5 @@ -import { - DBDivider, - DBInfotext, - DBStack -} from '../../../../../output/react/src'; -import type { DBStackProps } from '../../../../../output/react/src/components/stack/model'; +import { DBDivider, DBInfotext, DBStack } from '@components'; +import type { DBStackProps } from '@components/src/components/stack/model'; import defaultComponentVariants from '../../../../shared/stack.json'; import type { BaseComponentProps } from '../base-component-data'; import { getVariants } from '../data'; diff --git a/showcases/react-showcase/src/components/switch/index.tsx b/showcases/react-showcase/src/components/switch/index.tsx index 2116b797ecfe..4a6d4f1f856d 100644 --- a/showcases/react-showcase/src/components/switch/index.tsx +++ b/showcases/react-showcase/src/components/switch/index.tsx @@ -1,9 +1,5 @@ -import { - DBInfotext, - DBSwitch, - getBoolean -} from '../../../../../output/react/src'; -import type { DBSwitchProps } from '../../../../../output/react/src/components/switch/model'; +import { DBInfotext, DBSwitch, getBoolean } from '@components'; +import type { DBSwitchProps } from '@components/src/components/switch/model'; import defaultComponentVariants from '../../../../shared/switch.json'; import { type BaseComponentProps } from '../base-component-data'; import { getVariants } from '../data'; @@ -19,15 +15,13 @@ const getSwitch = ({ size, icon, iconTrailing, - required, - showRequiredAsterisk + required }: DBSwitchProps) => ( <> ( -
    - - {children}: - - - - Test 1 - Test 2 - Test 3 +}: DBTabsProps & { overflow: boolean }) => { + const id = useId(); + return ( +
    + + {children}: + + + + Test 1 + Test 2 + Test 3 + {overflow && ( + <> + Test 4 + Test 5 + + )} + + Tab Panel 1 + Tab Panel 2 + Tab Panel 3 {overflow && ( <> - Test 4 - Test 5 + Tab Panel 4 + Tab Panel 5 )} - - Tab Panel 1 - Tab Panel 2 - Tab Panel 3 - {overflow && ( - <> - Tab Panel 4 - Tab Panel 5 - - )} - -
    -); +
    +
    + ); +}; const TabsComponent = (props: BaseComponentProps) => { return ( diff --git a/showcases/react-showcase/src/components/tag/index.tsx b/showcases/react-showcase/src/components/tag/index.tsx index 6e921e23cd27..1404c3bcde5f 100644 --- a/showcases/react-showcase/src/components/tag/index.tsx +++ b/showcases/react-showcase/src/components/tag/index.tsx @@ -1,6 +1,6 @@ +import { DBTag, getBoolean } from '@components'; +import { type DBTagProps } from '@components/src/components/tag/model'; import { useState } from 'react'; -import { DBTag, getBoolean } from '../../../../../output/react/src'; -import { type DBTagProps } from '../../../../../output/react/src/components/tag/model'; import defaultComponentVariants from '../../../../shared/tag.json'; import { type BaseComponentProps } from '../base-component-data'; import { getVariants } from '../data'; @@ -23,7 +23,7 @@ const getTag = ({ showCheckState, lineBreak, showIcon -}: Omit & { +}: DBTagProps & { disabled?: boolean; checked?: boolean; component?: 'button' | 'link' | 'radio' | 'checkbox'; diff --git a/showcases/react-showcase/src/components/textarea/index.tsx b/showcases/react-showcase/src/components/textarea/index.tsx index e822cd939da0..341d91fe0f3e 100644 --- a/showcases/react-showcase/src/components/textarea/index.tsx +++ b/showcases/react-showcase/src/components/textarea/index.tsx @@ -1,6 +1,6 @@ +import { DBTextarea } from '@components'; +import type { DBTextareaProps } from '@components/src/components/textarea/model'; import { useState } from 'react'; -import { DBTextarea } from '../../../../../output/react/src'; -import type { DBTextareaProps } from '../../../../../output/react/src/components/textarea/model'; import defaultComponentVariants from '../../../../shared/textarea.json'; import { type BaseComponentProps } from '../base-component-data'; import { getVariants } from '../data'; @@ -24,14 +24,12 @@ const getTextarea = ({ validation, invalidMessage, fieldSizing, - showResizer, - showRequiredAsterisk + showResizer }: DBTextareaProps) => { const [dynamicValue, setDynamicValue] = useState(value); return ( ( + + + Link 1 + + + Link 2 + + + Link 3 + + +); + +export default MetaNavigation; diff --git a/showcases/react-showcase/src/control-panel/primary-actions.tsx b/showcases/react-showcase/src/control-panel/primary-actions.tsx new file mode 100644 index 000000000000..2e86db088702 --- /dev/null +++ b/showcases/react-showcase/src/control-panel/primary-actions.tsx @@ -0,0 +1,112 @@ +import { + DBButton, + DBControlPanelPrimaryActions, + DBDivider, + DBDrawer, + DBSelect, + DBTooltip, + DENSITIES, + SEMANTICS +} from '@components'; +import { Fragment, useState } from 'react'; +import { + type DefaultSettings, + defaultSettingsMapping +} from '../../../shared/default-component-data'; + +export type PrimaryActionsProps = { + color: string; + density: string; + settings: DefaultSettings; + onDensityChange: (density: string) => void; + onColorChange: (color: string) => void; + onSettingsChange: (settings: DefaultSettings) => void; +}; + +const PrimaryActions = ({ + onSettingsChange, + onDensityChange, + onColorChange, + color, + density, + settings +}: PrimaryActionsProps) => { + const [open, setOpen] = useState(false); + + return ( + + { + setOpen(false); + }}> + { + onDensityChange(event?.target?.value); + }}> + {DENSITIES.map((ton) => ( + + ))} + + { + onColorChange(event?.target?.value); + }}> + {SEMANTICS.map((col) => ( + + ))} + + + + {Object.entries(defaultSettingsMapping).map( + ([key, value], index) => ( + + { + onSettingsChange({ + ...settings, + [key]: event.target.value + }); + }}> + {value.map((option) => ( + + ))} + + {(index === 1 || index === 3) && } + + ) + )} + + { + setOpen(true); + }}> + Settings + Settings + + + ); +}; + +export default PrimaryActions; diff --git a/showcases/react-showcase/src/control-panel/secondary-actions.tsx b/showcases/react-showcase/src/control-panel/secondary-actions.tsx new file mode 100644 index 000000000000..a0ae63576e3c --- /dev/null +++ b/showcases/react-showcase/src/control-panel/secondary-actions.tsx @@ -0,0 +1,19 @@ +import { DBButton, DBControlPanelSecondaryActions } from '@components'; + +const SecondaryActions = () => { + return ( + + + Profile + + + Notification + + + Help + + + ); +}; + +export default SecondaryActions; diff --git a/showcases/react-showcase/src/hooks/use-query.tsx b/showcases/react-showcase/src/hooks/use-query.tsx index 9f58b272c155..d4c26ee36f91 100644 --- a/showcases/react-showcase/src/hooks/use-query.tsx +++ b/showcases/react-showcase/src/hooks/use-query.tsx @@ -1,13 +1,9 @@ +import { COLOR_CONST, DENSITY, DENSITY_CONST, SEMANTIC } from '@components'; import { useEffect, useState } from 'react'; -import { - COLOR, - COLOR_CONST, - DENSITY, - DENSITY_CONST -} from '../../../../packages/components/src/shared/constants'; +import { defaultSettings } from '../../../shared/default-component-data'; import useUniversalSearchParameters from './use-universal-search-parameters'; -const useQuery = (redirectURLSearchParameters = true): any => { +const useQuery = (redirectURLSearchParameters = true) => { const [searchParameters, setSearchParameters] = useUniversalSearchParameters(); @@ -15,12 +11,18 @@ const useQuery = (redirectURLSearchParameters = true): any => { searchParameters.get(DENSITY_CONST) ?? DENSITY.REGULAR ); const [color, setColor] = useState( - searchParameters.get(COLOR_CONST) ?? COLOR.NEUTRAL_BG_LEVEL_1 + searchParameters.get(COLOR_CONST) ?? SEMANTIC.NEUTRAL ); const [page, setPage] = useState(undefined); const [fullscreen, setFullscreen] = useState(false); const [searchRead, setSearchRead] = useState(false); + const [settings, setSettings] = useState( + searchParameters.has('settings') + ? JSON.parse(searchParameters.get('settings')!) + : defaultSettings + ); + useEffect(() => { for (const [key, value] of searchParameters.entries()) { if (value) { @@ -39,6 +41,10 @@ const useQuery = (redirectURLSearchParameters = true): any => { if (key === 'fullscreen' && fullscreen !== Boolean(value)) { setFullscreen(Boolean(value)); } + + if (key === 'settings' && JSON.stringify(settings) !== value) { + setSettings(JSON.parse(value)); + } } } @@ -47,7 +53,11 @@ const useQuery = (redirectURLSearchParameters = true): any => { useEffect(() => { if (searchRead) { - const nextQuery: any = { density, color }; + const nextQuery: any = { + density, + color, + settings: JSON.stringify(settings) + }; if (page) { nextQuery.page = page; } @@ -60,9 +70,18 @@ const useQuery = (redirectURLSearchParameters = true): any => { setSearchParameters(nextQuery); } } - }, [color, density, page, fullscreen, searchRead]); + }, [color, density, page, fullscreen, searchRead, settings]); - return [density, setDensity, color, setColor, page, fullscreen]; + return { + density, + setDensity, + color, + setColor, + page, + fullscreen, + settings, + setSettings + }; }; export default useQuery; diff --git a/showcases/react-showcase/src/hooks/use-universal-search-parameters.ts b/showcases/react-showcase/src/hooks/use-universal-search-parameters.ts index 28f495557bfb..51f89e45a53a 100644 --- a/showcases/react-showcase/src/hooks/use-universal-search-parameters.ts +++ b/showcases/react-showcase/src/hooks/use-universal-search-parameters.ts @@ -9,17 +9,15 @@ const useUniversalSearchParameters = (): [ URLSearchParams, (parameters: Record) => void ] => { - const nextRouter = - process.env.NEXT_SHOWCASE_VARIANT === 'next' - ? useRouterNext() - : undefined; - const nextPathName = - process.env.NEXT_SHOWCASE_VARIANT === 'next' - ? usePathnameNext() - : undefined; + const nextRouter = process.env.NEXT_SHOWCASE_VARIANT?.startsWith('next') + ? useRouterNext() + : undefined; + const nextPathName = process.env.NEXT_SHOWCASE_VARIANT?.startsWith('next') + ? usePathnameNext() + : undefined; const [searchParameters, _setSearchParameters] = - process.env.NEXT_SHOWCASE_VARIANT === 'next' + process.env.NEXT_SHOWCASE_VARIANT?.startsWith('next') ? [useSearchParametersNext()] : useSearchParams(); diff --git a/showcases/react-showcase/src/main.tsx b/showcases/react-showcase/src/main.tsx index ad0cb09238d5..da40160f1d7f 100644 --- a/showcases/react-showcase/src/main.tsx +++ b/showcases/react-showcase/src/main.tsx @@ -3,9 +3,6 @@ import '@db-ux/db-theme/build/styles/rollup.css'; import React from 'react'; import ReactDOM from 'react-dom/client'; import { HashRouter, Navigate, Route, Routes } from 'react-router-dom'; -import 'sa11y/dist/css/sa11y.min.css'; -import Sa11yLangEn from 'sa11y/dist/js/lang/en.js'; -import { Lang, Sa11y } from 'sa11y/dist/js/sa11y.esm.js'; import '../../showcase-styles.css'; import App from './app'; import { NAVIGATION_ITEMS } from './utils/navigation-item'; @@ -17,13 +14,6 @@ window['env'] = { BASE_URL: import.meta.env.BASE_URL }; -if (import.meta.env.DEV) { - Lang.addI18n(Sa11yLangEn.strings); - const sa11y = new Sa11y({ - checkRoot: 'body' - }); -} - ReactDOM.createRoot(document.querySelector('#root')!).render( diff --git a/showcases/react-showcase/src/meta-navigation/index.tsx b/showcases/react-showcase/src/meta-navigation/index.tsx deleted file mode 100644 index 5e80b869717d..000000000000 --- a/showcases/react-showcase/src/meta-navigation/index.tsx +++ /dev/null @@ -1,83 +0,0 @@ -import { useEffect, useState } from 'react'; -import { DBSelect } from '../../../../output/react/src'; -import { - COLOR, - COLOR_CONST, - COLORS, - DENSITIES, - DENSITY, - DENSITY_CONST -} from '../../../../packages/components/src/shared/constants'; -import useUniversalSearchParameters from '../hooks/use-universal-search-parameters'; - -export type MetaNavigationProps = { - onDensityChange: (density: string) => void; - onColorChange: (color: string) => void; -}; - -const MetaNavigation = ({ - onDensityChange, - onColorChange -}: MetaNavigationProps) => { - const [searchParameters, setSearchParameters] = - useUniversalSearchParameters(); - const [density, setDensity] = useState( - searchParameters.get(DENSITY_CONST) ?? DENSITY.REGULAR - ); - const [color, setColor] = useState( - searchParameters.get(COLOR_CONST) ?? COLOR.NEUTRAL_BG_LEVEL_1 - ); - - useEffect(() => { - for (const [key, value] of searchParameters.entries()) { - if (value) { - if (key === DENSITY_CONST && density !== value) { - setDensity(value); - onDensityChange(value); - } - - if (key === COLOR_CONST && color !== value) { - setColor(value); - onColorChange(value); - } - } - } - }, [searchParameters]); - - useEffect(() => { - setSearchParameters({ density, color }); - }, [color, density]); - - return ( - <> - { - setDensity(event?.target?.value); - }}> - {DENSITIES.map((ton) => ( - - ))} - - { - setColor(event?.target?.value); - }}> - {COLORS.map((col) => ( - - ))} - - - ); -}; - -export default MetaNavigation; diff --git a/showcases/react-showcase/src/navigation/index.tsx b/showcases/react-showcase/src/navigation/index.tsx index 75fcfefb1c94..d02f91325e1d 100644 --- a/showcases/react-showcase/src/navigation/index.tsx +++ b/showcases/react-showcase/src/navigation/index.tsx @@ -1,4 +1,4 @@ -import { DBNavigation } from '../../../../output/react/src'; +import { DBNavigation, type NavigationItemGroupVariantType } from '@components'; import { getSortedNavigationItems, NAVIGATION_ITEMS, @@ -6,8 +6,12 @@ import { } from '../utils/navigation-item'; import NavItem from './nav-item'; -const Navigation = () => ( - +const Navigation = ({ + variant +}: { + variant?: NavigationItemGroupVariantType; +}) => ( + {getSortedNavigationItems(NAVIGATION_ITEMS).map( (navItem: NavigationItem) => ( { - const pathname = - process.env.NEXT_SHOWCASE_VARIANT === 'next' - ? usePathname() - : useLocation().pathname; + const menuId = useId(); + const pathname = process.env.NEXT_SHOWCASE_VARIANT?.startsWith('next') + ? usePathname() + : useLocation().pathname; const [isActive, setIsActive] = useState(false); @@ -25,46 +25,46 @@ const NavItem = ({ navItem }: { navItem: NavigationItem }) => { setIsActive(standardizedItemPath === pathname); }, [pathname]); + if (navItem.subNavigation) { + return ( + + {navItem.subNavigation + .map((subItem: NavigationItem) => ({ + ...subItem, + path: `${navItem.path}/${subItem.path}` + })) + .map((subItem: NavigationItem) => ( + + ))} + + ); + } + return ( - - {navItem.subNavigation - .map((subItem: NavigationItem) => ({ - ...subItem, - path: `${navItem.path}/${subItem.path}` - })) - .map((subItem: NavigationItem) => ( - - ))} - - ) - }> - {navItem.component ? ( - <> - {process.env.NEXT_SHOWCASE_VARIANT === 'next' ? ( - - {navItem.label} - - ) : ( - - {navItem.label} - - )} - - ) : ( - navItem.label - )} + + <> + {process.env.NEXT_SHOWCASE_VARIANT?.startsWith('next') ? ( + + {navItem.label} + + ) : ( + + {navItem.label} + + )} + ); }; diff --git a/showcases/react-showcase/src/utils/navigation-item.tsx b/showcases/react-showcase/src/utils/navigation-item.tsx index 1f5f0774bb6e..90248a6f9aa8 100644 --- a/showcases/react-showcase/src/utils/navigation-item.tsx +++ b/showcases/react-showcase/src/utils/navigation-item.tsx @@ -1,3 +1,5 @@ +import ControlPanelMobileComponent from '../components/control-panel-mobile'; + import AccordionComponent from '../components/accordion'; import AccordionItemComponent from '../components/accordion-item'; import BadgeComponent from '../components/badge'; @@ -5,10 +7,10 @@ import BrandComponent from '../components/brand'; import ButtonComponent from '../components/button'; import CardComponent from '../components/card'; import CheckboxComponent from '../components/checkbox'; +import ControlPanelDesktopComponent from '../components/control-panel-desktop'; import CustomSelectComponent from '../components/custom-select'; import DividerComponent from '../components/divider'; import DrawerComponent from '../components/drawer'; -import HeaderComponent from '../components/header'; import Home from '../components/home'; import IconComponent from '../components/icon'; import InfotextComponent from '../components/infotext'; @@ -21,6 +23,7 @@ import PopoverComponent from '../components/popover'; import RadioComponent from '../components/radio'; import SectionComponent from '../components/section'; import SelectComponent from '../components/select'; +import ShellComponent from '../components/shell'; import StackComponent from '../components/stack'; import SwitchComponent from '../components/switch'; import TabItemComponent from '../components/tab-item'; @@ -145,7 +148,11 @@ export const NAVIGATION_ITEMS: NavigationItem[] = [ path: '02', label: '02 Action', subNavigation: getSortedNavigationItems([ - { path: 'link', label: 'Link', component: }, + { + path: 'link', + label: 'Link', + component: + }, { path: 'button', label: 'Button', component: } ]) }, @@ -153,6 +160,7 @@ export const NAVIGATION_ITEMS: NavigationItem[] = [ path: '01', label: '01 Layout', subNavigation: getSortedNavigationItems([ + { path: 'shell', label: 'Shell', component: }, { path: 'stack', label: 'Stack', component: }, { path: 'card', label: 'Card', component: }, { path: 'drawer', label: 'Drawer', component: }, @@ -172,9 +180,14 @@ export const NAVIGATION_ITEMS: NavigationItem[] = [ component: }, { - path: 'header', - label: 'Header', - component: + path: 'control-panel-desktop', + label: 'ControlPanelDesktop', + component: + }, + { + path: 'control-panel-mobile', + label: 'ControlPanelMobile', + component: } ]) }, diff --git a/showcases/react-showcase/tsconfig.json b/showcases/react-showcase/tsconfig.json index 99102dd1bbaa..59b42838b06c 100644 --- a/showcases/react-showcase/tsconfig.json +++ b/showcases/react-showcase/tsconfig.json @@ -19,7 +19,11 @@ "noUnusedParameters": false, "noEmit": true, "jsx": "react-jsx", - "types": ["vite/client"] + "types": ["vite/client"], + "paths": { + "@components": ["../../output/react/src"], + "@components/src/*": ["../../output/react/src/*"] + } }, "include": ["src"], "references": [{ "path": "./tsconfig.node.json" }] diff --git a/showcases/react-showcase/vite.config.ts b/showcases/react-showcase/vite.config.ts index de7b83614a6a..6e01d8dbad01 100644 --- a/showcases/react-showcase/vite.config.ts +++ b/showcases/react-showcase/vite.config.ts @@ -1,5 +1,10 @@ import react from '@vitejs/plugin-react'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; import { defineConfig } from 'vite'; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); + // https://vitejs.dev/config/ export default defineConfig({ base: `/react-showcase/`, @@ -11,6 +16,11 @@ export default defineConfig({ define: { process }, + resolve: { + alias: { + '@components': path.resolve(__dirname, '../../output/react/src') + } + }, css: { devSourcemap: true // Enables source maps in dev mode for CSS } diff --git a/showcases/shared/control-panel-desktop.json b/showcases/shared/control-panel-desktop.json new file mode 100644 index 000000000000..dd387bf2f478 --- /dev/null +++ b/showcases/shared/control-panel-desktop.json @@ -0,0 +1,193 @@ +[ + { + "name": "Density", + "examples": [ + { + "name": "Functional", + "density": "functional", + "props": {}, + "style": { + "width": "100%", + "display": "block" + } + }, + { + "name": "(Default) Regular", + "density": "regular", + "props": {}, + "style": { + "width": "100%", + "display": "block" + } + }, + { + "name": "Expressive", + "density": "expressive", + "props": {}, + "style": { + "width": "100%", + "display": "block" + } + } + ] + }, + { + "name": "Width", + "examples": [ + { + "name": "Full", + "style": { + "width": "100%", + "display": "block" + } + }, + { + "name": "Medium", + "style": { + "width": "100%", + "display": "block" + }, + "props": { + "width": "medium" + } + }, + { + "name": "Large", + "style": { + "width": "100%", + "display": "block" + }, + "props": { + "width": "large" + } + } + ] + }, + { + "name": "Orientation", + "examples": [ + { + "name": "Horizontal (Default)", + "style": { + "width": "100%", + "display": "block" + } + }, + { + "name": "Vertical", + "style": { + "maxInlineSize": "300px", + "width": "auto", + "height": "500px", + "display": "block" + }, + "props": { + "orientation": "vertical" + } + } + ] + }, + { + "name": "Examples", + "examples": [ + { + "name": "With Application Name + Navigation", + "style": { + "width": "100%", + "display": "block" + }, + "props": { + "withName": true, + "withNavigation": true, + "withMeta": false, + "withPrimary": false, + "withSecondary": false + } + }, + { + "name": "Without Navigation", + "style": { + "width": "100%", + "display": "block" + }, + "props": { + "withName": true, + "withNavigation": false, + "withMeta": false, + "withPrimary": false, + "withSecondary": false + } + }, + { + "name": "Without Navigation + Primary + Secondary", + "style": { + "width": "100%", + "display": "block" + }, + "props": { + "withName": true, + "withNavigation": false, + "withMeta": false, + "withPrimary": true, + "withSecondary": true + } + }, + { + "name": "Without Navigation + Primary", + "style": { + "width": "100%", + "display": "block" + }, + "props": { + "withName": true, + "withNavigation": false, + "withMeta": false, + "withPrimary": true, + "withSecondary": false + } + }, + { + "name": "Without Navigation + Secondary", + "style": { + "width": "100%", + "display": "block" + }, + "props": { + "withName": true, + "withNavigation": false, + "withMeta": false, + "withPrimary": false, + "withSecondary": true + } + }, + { + "name": "Without Application Name", + "style": { + "width": "100%", + "display": "block" + }, + "props": { + "withName": false, + "withNavigation": true, + "withMeta": false, + "withPrimary": false, + "withSecondary": false + } + }, + { + "name": "Without Application Name + Navigation", + "style": { + "width": "100%", + "display": "block" + }, + "props": { + "withName": false, + "withNavigation": false, + "withMeta": false, + "withPrimary": false, + "withSecondary": false + } + } + ] + } +] diff --git a/showcases/shared/control-panel-mobile.json b/showcases/shared/control-panel-mobile.json new file mode 100644 index 000000000000..8f4e877099c7 --- /dev/null +++ b/showcases/shared/control-panel-mobile.json @@ -0,0 +1,340 @@ +[ + { + "name": "Density", + "examples": [ + { + "name": "Functional", + "density": "functional", + "props": {}, + "style": { + "width": "100%", + "display": "block" + } + }, + { + "name": "(Default) Regular", + "density": "regular", + "props": {}, + "style": { + "width": "100%", + "display": "block" + } + }, + { + "name": "Expressive", + "density": "expressive", + "props": {}, + "style": { + "width": "100%", + "display": "block" + } + } + ] + }, + { + "name": "Position", + "examples": [ + { + "name": "(Default) top", + "props": { + "position": "top" + }, + "style": { + "width": "100%", + "display": "block" + } + }, + { + "name": "Bottom", + "props": { + "position": "bottom" + }, + "style": { + "width": "100%", + "display": "block" + } + } + ] + }, + { + "name": "Examples Bottom + Variant", + "examples": [ + { + "name": "(Default) Drawer", + "props": { + "position": "top", + "variant": "drawer" + }, + "style": { + "width": "100%", + "display": "block" + } + }, + { + "name": "Flat Icon", + "props": { + "position": "bottom", + "variant": "flat-icon" + }, + "style": { + "width": "100%", + "display": "block" + } + }, + { + "name": "Flat Icon + No Text", + "props": { + "position": "bottom", + "variant": "flat-icon", + "noText": true + }, + "style": { + "width": "100%", + "display": "block" + } + } + ] + }, + { + "name": "Examples", + "examples": [ + { + "name": "With Application Name + Navigation", + "style": { + "width": "100%", + "display": "block" + }, + "props": { + "withName": true, + "withNavigation": true, + "withMeta": false, + "withPrimary": false, + "withSecondary": false + } + }, + { + "name": "Without Navigation", + "style": { + "width": "100%", + "display": "block" + }, + "props": { + "withName": true, + "withNavigation": false, + "withMeta": false, + "withPrimary": false, + "withSecondary": false + } + }, + { + "name": "Without Navigation + Primary + Secondary", + "style": { + "width": "100%", + "display": "block" + }, + "props": { + "withName": true, + "withNavigation": false, + "withMeta": false, + "withPrimary": true, + "withSecondary": true + } + }, + { + "name": "Without Navigation + Primary", + "style": { + "width": "100%", + "display": "block" + }, + "props": { + "withName": true, + "withNavigation": false, + "withMeta": false, + "withPrimary": true, + "withSecondary": false + } + }, + { + "name": "Without Navigation + Secondary", + "style": { + "width": "100%", + "display": "block" + }, + "props": { + "withName": true, + "withNavigation": false, + "withMeta": false, + "withPrimary": false, + "withSecondary": true + } + }, + { + "name": "Without Navigation + Meta", + "style": { + "width": "100%", + "display": "block" + }, + "props": { + "withName": true, + "withNavigation": false, + "withMeta": true, + "withPrimary": false, + "withSecondary": false + } + }, + { + "name": "Without Application Name", + "style": { + "width": "100%", + "display": "block" + }, + "props": { + "withName": false, + "withNavigation": true, + "withMeta": false, + "withPrimary": false, + "withSecondary": false + } + }, + { + "name": "Without Application Name + Navigation", + "style": { + "width": "100%", + "display": "block" + }, + "props": { + "withName": false, + "withNavigation": false, + "withMeta": false, + "withPrimary": false, + "withSecondary": false + } + } + ] + }, + { + "name": "Examples Bottom", + "examples": [ + { + "name": "With Application Name + Navigation", + "style": { + "width": "100%", + "display": "block" + }, + "props": { + "position": "bottom", + "withName": true, + "withNavigation": true, + "withMeta": false, + "withPrimary": false, + "withSecondary": false + } + }, + { + "name": "Without Navigation", + "style": { + "width": "100%", + "display": "block" + }, + "props": { + "position": "bottom", + "withName": true, + "withNavigation": false, + "withMeta": false, + "withPrimary": false, + "withSecondary": false + } + }, + { + "name": "Without Navigation + Primary + Secondary", + "style": { + "width": "100%", + "display": "block" + }, + "props": { + "position": "bottom", + "withName": true, + "withNavigation": false, + "withMeta": false, + "withPrimary": true, + "withSecondary": true + } + }, + { + "name": "Without Navigation + Primary", + "style": { + "width": "100%", + "display": "block" + }, + "props": { + "position": "bottom", + "withName": true, + "withNavigation": false, + "withMeta": false, + "withPrimary": true, + "withSecondary": false + } + }, + { + "name": "Without Navigation + Secondary", + "style": { + "width": "100%", + "display": "block" + }, + "props": { + "position": "bottom", + "withName": true, + "withNavigation": false, + "withMeta": false, + "withPrimary": false, + "withSecondary": true + } + }, + { + "name": "Without Navigation + Meta", + "style": { + "width": "100%", + "display": "block" + }, + "props": { + "position": "bottom", + "withName": true, + "withNavigation": false, + "withMeta": true, + "withPrimary": false, + "withSecondary": false + } + }, + { + "name": "Without Application Name", + "style": { + "width": "100%", + "display": "block" + }, + "props": { + "position": "bottom", + "withName": false, + "withNavigation": true, + "withMeta": false, + "withPrimary": false, + "withSecondary": false + } + }, + { + "name": "Without Application Name + Navigation", + "style": { + "width": "100%", + "display": "block" + }, + "props": { + "position": "bottom", + "withName": false, + "withNavigation": false, + "withMeta": false, + "withPrimary": false, + "withSecondary": false + } + } + ] + } +] diff --git a/showcases/shared/default-component-data.ts b/showcases/shared/default-component-data.ts index 791857481de4..e55374045e1a 100644 --- a/showcases/shared/default-component-data.ts +++ b/showcases/shared/default-component-data.ts @@ -33,3 +33,36 @@ export type DefaultComponentProps = { title: string; variants: DefaultComponentVariants[]; }; + +export type DefaultSettings = { + controlPanelDesktopPosition: 'top' | 'left'; + controlPanelMobilePosition: 'bottom' | 'top'; + subNavigationDesktopPosition: 'top' | 'left'; + subNavigationMobilePosition: 'top' | 'bottom' | 'none'; + subNavigation: 'true' | 'false'; + subNavigationVariant: 'tree' | 'popover'; + navigationDesktopVariant: 'tree' | 'popover'; + navigationMobileVariant: 'tree' | 'popover'; +}; + +export const defaultSettingsMapping = { + controlPanelDesktopPosition: ['top', 'left'], + navigationDesktopVariant: ['tree', 'popover'], + controlPanelMobilePosition: ['bottom', 'top'], + navigationMobileVariant: ['tree', 'popover'], + subNavigation: ['true', 'false'], + subNavigationDesktopPosition: ['top', 'left'], + subNavigationMobilePosition: ['top', 'bottom', 'none'], + subNavigationVariant: ['tree', 'popover'] +}; + +export const defaultSettings: DefaultSettings = { + navigationMobileVariant: 'popover', + subNavigation: 'false', + subNavigationDesktopPosition: 'top', + subNavigationMobilePosition: 'none', + subNavigationVariant: 'tree', + controlPanelDesktopPosition: 'top', + controlPanelMobilePosition: 'top', + navigationDesktopVariant: 'popover' +}; diff --git a/showcases/shared/header.json b/showcases/shared/header.json deleted file mode 100644 index 1e220312932d..000000000000 --- a/showcases/shared/header.json +++ /dev/null @@ -1,465 +0,0 @@ -[ - { - "name": "Density", - "children": [ - { - "name": "brand", - "slot": "brand", - "content": "DBHeader" - }, - { - "name": "link", - "slot": "meta-navigation", - "angularDirective": true, - "content": "Imprint", - "props": { - "href": "#" - } - }, - { - "name": "button", - "slot": "primary-action", - "content": "Search", - "props": { - "icon": "magnifying_glass", - "variant": "ghost", - "noText": true - } - }, - { - "name": "button", - "slot": "secondary-action", - "angularDirective": true, - "content": "Profile", - "props": { - "icon": "x_placeholder", - "variant": "ghost", - "noText": true - } - }, - { - "name": "navigation", - "slot": "Navigation", - "angularDirective": true, - "children": [ - { - "name": "navigation-item", - "props": { - "icon": "x_placeholder" - }, - "children": [ - { - "name": "a", - "native": true, - "slot": "NavigationContent", - "angularDirective": true, - "content": "Link", - "props": { - "href": "#" - } - } - ] - }, - { - "name": "navigation-item", - "props": { - "icon": "x_placeholder", - "disabled": true - }, - "children": [ - { - "name": "a", - "native": true, - "slot": "NavigationContent", - "angularDirective": true, - "content": "Link disabled", - "props": { - "href": "#" - } - } - ] - } - ] - } - ], - "examples": [ - { - "name": "Functional", - "density": "functional", - "props": {}, - "style": { - "width": "100%", - "display": "block" - } - }, - { - "name": "(Default) Regular", - "density": "regular", - "props": {}, - "style": { - "width": "100%", - "display": "block" - } - }, - { - "name": "Expressive", - "density": "expressive", - "props": {}, - "style": { - "width": "100%", - "display": "block" - } - } - ] - }, - { - "name": "Width", - "children": [ - { - "name": "brand", - "slot": "brand", - "content": "DBHeader" - }, - { - "name": "link", - "slot": "meta-navigation", - "angularDirective": true, - "content": "Imprint", - "props": { - "href": "#" - } - }, - { - "name": "button", - "slot": "primary-action", - "content": "Search", - "props": { - "icon": "magnifying_glass", - "variant": "ghost", - "noText": true - } - }, - { - "name": "button", - "slot": "secondary-action", - "angularDirective": true, - "content": "Profile", - "props": { - "icon": "x_placeholder", - "variant": "ghost", - "noText": true - } - }, - { - "name": "navigation", - "slot": "Navigation", - "angularDirective": true, - "children": [ - { - "name": "navigation-item", - "props": { - "icon": "x_placeholder" - }, - "children": [ - { - "name": "a", - "native": true, - "slot": "NavigationContent", - "angularDirective": true, - "content": "Link", - "props": { - "href": "#" - } - } - ] - }, - { - "name": "navigation-item", - "props": { - "icon": "x_placeholder", - "disabled": true - }, - "children": [ - { - "name": "a", - "native": true, - "slot": "NavigationContent", - "angularDirective": true, - "content": "Link disabled", - "props": { - "href": "#" - } - } - ] - } - ] - } - ], - "examples": [ - { - "name": "Full", - "style": { - "width": "100%", - "display": "block" - } - }, - { - "name": "Medium", - "style": { - "width": "100%", - "display": "block" - }, - "props": { - "width": "medium" - } - }, - { - "name": "Large", - "style": { - "width": "100%", - "display": "block" - }, - "props": { - "width": "large" - } - } - ] - }, - { - "name": "Behavior", - "children": [ - { - "name": "brand", - "slot": "brand", - "content": "DBHeader" - }, - { - "name": "link", - "slot": "meta-navigation", - "angularDirective": true, - "content": "Imprint", - "props": { - "href": "#" - } - }, - { - "name": "button", - "slot": "primary-action", - "content": "Search", - "props": { - "icon": "magnifying_glass", - "variant": "ghost", - "noText": true - } - }, - { - "name": "button", - "slot": "secondary-action", - "angularDirective": true, - "content": "Profile", - "props": { - "icon": "x_placeholder", - "variant": "ghost", - "noText": true - } - }, - { - "name": "navigation", - "slot": "Navigation", - "angularDirective": true, - "children": [ - { - "name": "navigation-item", - "props": { - "icon": "x_placeholder" - }, - "children": [ - { - "name": "a", - "native": true, - "slot": "NavigationContent", - "angularDirective": true, - "content": "Link", - "props": { - "href": "#" - } - } - ] - }, - { - "name": "navigation-item", - "props": { - "icon": "x_placeholder", - "disabled": true - }, - "children": [ - { - "name": "a", - "native": true, - "slot": "NavigationContent", - "angularDirective": true, - "content": "Link disabled", - "props": { - "href": "#" - } - } - ] - } - ] - } - ], - "examples": [ - { - "name": "Desktop (full width)", - "style": { - "width": "100%", - "display": "block" - } - }, - { - "name": "Mobile", - "style": { - "width": "100%", - "display": "block" - }, - "props": { - "forceMobile": "true" - } - } - ] - }, - { - "name": "Examples", - "children": [ - { - "name": "brand", - "slot": "brand", - "content": "DBHeader" - }, - { - "name": "link", - "slot": "meta-navigation", - "angularDirective": true, - "content": "Imprint", - "props": { - "href": "#" - } - }, - { - "name": "button", - "slot": "primary-action", - "content": "Search", - "props": { - "icon": "magnifying_glass", - "variant": "ghost", - "noText": true - } - }, - { - "name": "button", - "slot": "secondary-action", - "angularDirective": true, - "content": "Profile", - "props": { - "icon": "x_placeholder", - "variant": "ghost", - "noText": true - } - }, - { - "name": "navigation", - "slot": "Navigation", - "angularDirective": true, - "children": [ - { - "name": "navigation-item", - "props": { - "icon": "x_placeholder" - }, - "children": [ - { - "name": "a", - "native": true, - "slot": "NavigationContent", - "angularDirective": true, - "content": "Link", - "props": { - "href": "#" - } - } - ] - }, - { - "name": "navigation-item", - "props": { - "icon": "x_placeholder", - "disabled": true - }, - "children": [ - { - "name": "a", - "native": true, - "slot": "NavigationContent", - "angularDirective": true, - "content": "Link disabled", - "props": { - "href": "#" - } - } - ] - } - ] - } - ], - "examples": [ - { - "name": "With Application Name + Navigation", - "style": { - "width": "100%", - "display": "block" - }, - "props": { - "example": true, - "withName": true, - "withNavigation": true - } - }, - { - "name": "Without Navigation", - "style": { - "width": "100%", - "display": "block" - }, - "props": { - "example": true, - "withName": true, - "withNavigation": false - } - }, - { - "name": "Without Application Name", - "style": { - "width": "100%", - "display": "block" - }, - "props": { - "example": true, - "withName": false, - "withNavigation": true - } - }, - { - "name": "Without Application Name + Navigation", - "style": { - "width": "100%", - "display": "block" - }, - "props": { - "example": true, - "withName": false, - "withNavigation": false - } - } - ] - } -] diff --git a/showcases/shared/page.json b/showcases/shared/shell.json similarity index 52% rename from showcases/shared/page.json rename to showcases/shared/shell.json index 906c6e982e9b..f77d043eb197 100644 --- a/showcases/shared/page.json +++ b/showcases/shared/shell.json @@ -18,5 +18,22 @@ "props": {} } ] + }, + { + "name": "Control Panel Desktop Position", + "examples": [ + { + "name": "Top (Default)", + "props": { + "controlPanelDesktopPosition": "top" + } + }, + { + "name": "Left", + "props": { + "controlPanelDesktopPosition": "left" + } + } + ] } ] diff --git a/showcases/showcase-styles.css b/showcases/showcase-styles.css index 85efd1dba798..6f260ee4341b 100644 --- a/showcases/showcase-styles.css +++ b/showcases/showcase-styles.css @@ -29,35 +29,56 @@ db-card:is(.variants-card) > .db-card { padding: var(--db-spacing-fixed-sm); } +.variants-list .db-select, +.w-full { + inline-size: 100%; +} + .variants-list { display: flex; flex-wrap: wrap; inline-size: 100%; justify-content: center; gap: var(--db-spacing-fixed-md); -} -.variants-list > div { - align-items: center; - display: flex; - gap: var(--db-spacing-fixed-md); -} + > div { + align-items: center; + display: flex; + gap: var(--db-spacing-fixed-md); + } -.variants-list .db-select, -.w-full { - inline-size: 100%; -} + .db-shell { + &:is( + :not([data-control-panel-desktop-position]), + [data-control-panel-desktop-position="top"] + ) { + block-size: 200px; + } + + &[data-control-panel-desktop-position="left"] { + block-size: 500px; + } + } -.variants-list .db-select, -.variants-list .db-input, -.variants-list .db-textarea { - margin-block-start: auto; -} + .db-select, + .db-input, + .db-textarea { + margin-block-start: auto; + + &:has([placeholder="(Default) Basic"]) { + margin-block: 0 auto; + } + } + + &:has(.db-shell) { + flex-direction: column; + align-items: center; -.variants-list .db-select:has([placeholder="(Default) Basic"]), -.variants-list .db-input:has([placeholder="(Default) Basic"]), -.variants-list .db-textarea:has([placeholder="(Default) Basic"]) { - margin-block: 0 auto; + > div { + justify-content: center; + inline-size: 100%; + } + } } .html-code-container { @@ -128,28 +149,15 @@ db-card:is(.variants-card) > .db-card { margin-block: auto; } -.fixed-header-footer { - overflow: hidden; -} - .tab-hide-article article { display: none !important; } -.db-page.fixed-header-footer main { +.db-main { overflow-x: hidden; overflow-inline: hidden; } -:root:has(.db-page) { - block-size: 100%; - overflow: hidden; -} - -main .db-header { - block-size: 100%; -} - .stack-container { padding: var(--db-spacing-fixed-xs); } @@ -203,3 +211,32 @@ main .db-header { color: var(--db-successful-on-bg-basic-emphasis-100-default); padding-inline: var(--db-spacing-fixed-xs); } + +.db-control-panel-primary-actions { + .db-drawer { + @media screen and (width < 768px) { + --db-drawer-max-width: 100%; + --db-drawer-min-width: 100%; + } + + @media screen and (width >= 768px) { + --db-drawer-max-width: var(--db-container-xs); + --db-drawer-min-width: var(--db-container-xs); + } + + .db-drawer-content { + display: flex; + flex-direction: column; + padding: var(--db-spacing-fixed-xs); + gap: var(--db-spacing-fixed-xs); + } + } +} + +/* stylelint-disable selector-type-no-unknown */ +app-meta-navigation, +app-primary-actions, +app-secondary-actions, +app-nav-item { + display: contents; +} diff --git a/showcases/stencil-showcase/src/main.ts b/showcases/stencil-showcase/src/main.ts index e389a9a69cc8..17df2130c7f4 100644 --- a/showcases/stencil-showcase/src/main.ts +++ b/showcases/stencil-showcase/src/main.ts @@ -4,10 +4,7 @@ import { defineCustomElements } from '../../../output/stencil/dist/loader'; import { AppComponent } from '../../angular-showcase/src/app/app.component'; import { getRoutes } from '../../angular-showcase/src/app/utils/navigation-item'; -defineCustomElements(undefined, { - // TODO: Fix issues with double slots to solve this issue - exclude: ['db-header', 'db-navigation', 'db-navigation-item', 'db-page'] -}); +defineCustomElements(); // eslint-disable-next-line @typescript-eslint/no-floating-promises bootstrapApplication(AppComponent, { diff --git a/showcases/stencil-showcase/tsconfig.json b/showcases/stencil-showcase/tsconfig.json index cadda2628ccd..82d7d831b5ce 100644 --- a/showcases/stencil-showcase/tsconfig.json +++ b/showcases/stencil-showcase/tsconfig.json @@ -20,7 +20,11 @@ "target": "ES2022", "module": "ES2022", "useDefineForClassFields": false, - "lib": ["ES2022", "dom"] + "lib": ["ES2022", "dom"], + "paths": { + "@components": ["../../output/angular/src"], + "@components/src/*": ["../../output/angular/src/*"] + } }, "angularCompilerOptions": { "enableI18nLegacyMessageIdFormat": false, diff --git a/showcases/vue-showcase/src/App.vue b/showcases/vue-showcase/src/App.vue index 57c5af3102b8..87b63bee0872 100644 --- a/showcases/vue-showcase/src/App.vue +++ b/showcases/vue-showcase/src/App.vue @@ -1,111 +1,98 @@