Skip to content

Commit

Permalink
feat: convert to whitelabel (#3616)
Browse files Browse the repository at this point in the history
* feat: convert to whitelabel

* Update packages/components/README.md

Co-authored-by: Maximilian Franzke <[email protected]>

* chore: update old references

* chore: update snapshots

* fix: issue with wc-workarounds

* chore: update snapshots

* fix: issue with foundation testing

* fix: issue with linting

* chore: update snapshots

* fix: issue with missing fonts for foundations testing

* chore: update snapshots

* Update docs/migration/alpha-beta.md

Co-authored-by: Maximilian Franzke <[email protected]>

* Update output/react/README.md

Co-authored-by: Maximilian Franzke <[email protected]>

* Update output/stencil/README.md

Co-authored-by: Maximilian Franzke <[email protected]>

* Update output/vue/README.md

Co-authored-by: Maximilian Franzke <[email protected]>

* Update packages/components/README.md

Co-authored-by: Maximilian Franzke <[email protected]>

* Update packages/components/README.md

Co-authored-by: Maximilian Franzke <[email protected]>

* Update packages/components/src/styles/wc-workarounds.scss

Co-authored-by: Maximilian Franzke <[email protected]>

---------

Co-authored-by: Maximilian Franzke <[email protected]>
  • Loading branch information
nmerget and mfranzke authored Jan 9, 2025
1 parent fd36948 commit 1af58ec
Show file tree
Hide file tree
Showing 158 changed files with 2,916 additions and 3,233 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions docs/how-to-develop-a-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@

Starting with `packages/components/src/components/my-awesome-component/my-awesome-component.scss` there are something you should know:

1. The most important dependency are the `variables` included via `@use "@db-ui/foundations/build/scss/variables";`. They enable you to use e.g. `$db-spacing-fixed-md` for paddings, margins etc.
2. A lot of times you have to force another `font-size` / `line-height`, you can do it with `@use "@db-ui/foundations/build/scss/density/font;` and the corresponding placeholder extend: `@extend %db-overwrite-font-size-sm;`.
1. The most important dependency are the `variables` included via `@use "@db-ui/foundations/build/styles/variables";`. They enable you to use e.g. `$db-spacing-fixed-md` for paddings, margins etc.
2. A lot of times you have to force another `font-size` / `line-height`, you can do it with `@use "@db-ui/foundations/build/styles/density/font;` and the corresponding placeholder extend: `@extend %db-overwrite-font-size-sm;`.
3. Some components have an 'adaptive' styling. We exclude it in an own file `@use "@db-ui/components/build/scss/styles/component";` so you might use this dependency. As a reference look at another component e.g. [`packages/components/src/components/button/button.scss`](../packages/components/src/components/button/button.scss).
4. If you have to set a specific color (informational, warning, etc.) directly you can use `@use "@db-ui/foundations/build/scss/colors";`. You can take a look at the `notification` component for an example `packages/components/src/components/notification/notification.scss` you might use the `@each` to reduce the amount of code for color-variants.
5. To set a fixed icon you might use `@use "@db-ui/foundations/build/scss/icon/icons.helpers" as icons;` as dependency and e.g. `@include icons.icon("arrow_forward"), "after");`. For a dynamic icon you could prefer integrating it in HTML code with the `data-icon` attribute.
4. If you have to set a specific color (informational, warning, etc.) directly you can use `@use "@db-ui/foundations/build/styles/colors";`. You can take a look at the `notification` component for an example `packages/components/src/components/notification/notification.scss` you might use the `@each` to reduce the amount of code for color-variants.
5. To set a fixed icon you might use `@use "@db-ui/foundations/build/styles/icon/icons.helpers" as icons;` as dependency and e.g. `@include icons.icon("arrow_forward"), "after");`. For a dynamic icon you could prefer integrating it in HTML code with the `data-icon` attribute.

### Component structure with HTML

Expand Down
2 changes: 1 addition & 1 deletion docs/migration/alpha-beta.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
| 🔄 renamed `Tonality` to `Density` | class names and data-attributes changed from <br/>`.db-ui-#{$tonality},[data-tonality="#{$tonality}"] {` to <br/>`.db-#{density},[data-density="#{density}"] {` | search `tonality` & replace with `density` |
| ❌ removed `opacity` tokens | we use only 1 opacity (0.4) for all components | If you use some of the tokens like `--db-opacity-sm` you might run into issues with your layout |
| 🔄 updated `border` tokens | we add all shirt-sizes `3xs`-`3xl` as tokens | If you use some of the tokens like `db-border-height-sm` you might run into issues with your layout, because the values behind it changed |
| 🔄 moved `_font-sizes.scss` | We moved the file to another folder to align the same structure as icons or colors. We add `css` classes, you can use them by importing `@db-ui/foundations/scss/fonts/classes/all.css` | If you use some placeholder like `%db-overwrite-font-size-sm` you might need to import the `_font-sizes.scss` like this: `@use "@db-ui/foundations/build/scss/fonts";` |
| 🔄 moved `_font-sizes.scss` | We moved the file to another folder to align the same structure as icons or colors. We add `css` classes, you can use them by importing `@db-ui/foundations/scss/fonts/classes/all.css` | If you use some placeholder like `%db-overwrite-font-size-sm` you might need to import the `_font-sizes.scss` like this: `@use "@db-ui/foundations/build/scss/fonts";` |
| 🔄 ❗ refactored `colors` | All colors changed. We use color-palettes to generate speaking-names (check `@db-ui/foundations/scss/colors/_variables.scss` to see a list of available tokens). We removed `base` color, it was the same like `neutral`. Add different background level. | 1. Replace all `base` colors with `neutral`<br/>2. If you use the color class replace `db-bg-x` with `db-x-bg-lvl-1`<br/>3. Replace `border-strong`/ `border-weak` tokens with `contrast-high`/`contrast-low` |
| 🔄 renamed timing variables | renamed `$db-transition-emotional-timing` to `$db-transition-timing-emotional` / `--db-transition-emotional-timing` to `--db-transition-timing-emotional` | Replace `transition-emotional-timing` by `transition-timing-emotional` |

Expand Down
12 changes: 6 additions & 6 deletions output/angular/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ npm i @db-ui/ngx-components

Import the styles in `scss` or `css`. Based on your technology the file names could be different.

- Default (db-ui-42): points to `../assets`
- Rollup (db-ui-42-rollup): points to `@db-ui/foundations/assets`
- Webpack (db-ui-42-webpack): points to `~@db-ui/foundations/assets`
- Default (relative): points to `../assets`
- Rollup (rollup): points to `@db-ui/foundations/assets`
- Webpack (webpack): points to `~@db-ui/foundations/assets`

<details>
<summary><strong>SCSS</strong></summary>

```scss styles.scss
// styles.scss
@forward "@db-ui/components/build/styles/db-ui-42-rollup";
@forward "@db-ui/components/build/styles/rollup";
```

</details>
Expand All @@ -39,12 +39,12 @@ Import the styles in `scss` or `css`. Based on your technology the file names co

```css styles.css
/* styles.css */
@import "@db-ui/components/build/styles/db-ui-42-rollup.css";
@import "@db-ui/components/build/styles/rollup.css";
```

</details>

> **Note:** The `db-ui-42` file contains optional and all components styles. If you consider performance issues see [@db-ui/components](https://www.npmjs.com/package/@db-ui/components) for more information.
> **Note:** The `relative` file contains optional and all components styles. If you consider performance issues see [@db-ui/components](https://www.npmjs.com/package/@db-ui/components) for more information.
### Resolve assets

Expand Down
12 changes: 6 additions & 6 deletions output/react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ npm i @db-ui/react-components

Import the styles in scss or css. Based on your technology the file names could be different.

- Default (db-ui-42): points to `../assets`
- Rollup (db-ui-42-rollup): points to `@db-ui/foundations/assets`
- Webpack (db-ui-42-webpack): points to `~@db-ui/foundations/assets`
- Default (relative): points to `../assets`
- Rollup (rollup): points to `@db-ui/foundations/assets`
- Webpack (webpack): points to `~@db-ui/foundations/assets`

<details>
<summary><strong>SCSS</strong></summary>

```scss
// index.scss
@forward "@db-ui/components/build/styles/db-ui-42-rollup";
@forward "@db-ui/components/build/styles/rollup";
```

</details>
Expand All @@ -39,12 +39,12 @@ Import the styles in scss or css. Based on your technology the file names could

```tsx
// main.tsx
import "@db-ui/components/build/styles/db-ui-42-rollup.css";
import "@db-ui/components/build/styles/rollup.css";
```

</details>

> **Note:** The `db-ui-42` file contains optional and all components styles. If you consider performance issues see [@db-ui/components](https://www.npmjs.com/package/@db-ui/components) for more information.
> **Note:** The `@db-ui/components/build/styles/relative` file contains optional and all components styles. If you consider performance issues see [@db-ui/components](https://www.npmjs.com/package/@db-ui/components) for more information.
## Usage

Expand Down
12 changes: 6 additions & 6 deletions output/stencil/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ npm i @db-ui/web-components

Import the styles in scss or css. Based on your technology the file names could be different.

- Default (db-ui-42): points to `../assets`
- Rollup (db-ui-42-rollup): points to `@db-ui/foundations/assets`
- Webpack (db-ui-42-webpack): points to `~@db-ui/foundations/assets`
- Default (relative): points to `../assets`
- Rollup (rollup): points to `@db-ui/foundations/assets`
- Webpack (webpack): points to `~@db-ui/foundations/assets`

<details>
<summary><strong>SCSS</strong></summary>

```scss
// index.scss
@forward "@db-ui/components/build/styles/db-ui-42-rollup";
@forward "@db-ui/components/build/styles/rollup";
```

</details>
Expand All @@ -37,12 +37,12 @@ Import the styles in scss or css. Based on your technology the file names could

```js
// main.js
import "@db-ui/components/build/styles/db-ui-42-rollup.css";
import "@db-ui/components/build/styles/rollup.css";
```

</details>

> **Note:** The `db-ui-42` file contains optional and all components styles. If you consider performance issues see [@db-ui/components](https://www.npmjs.com/package/@db-ui/components) for more information.
> **Note:** The `@db-ui/components/build/styles/relative` file contains optional and all components styles. If you consider performance issues see [@db-ui/components](https://www.npmjs.com/package/@db-ui/components) for more information.
## Usage

Expand Down
12 changes: 6 additions & 6 deletions output/vue/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ npm i @db-ui/v-components

Import the styles in scss or css. Based on your technology the file names could be different.

- Default (db-ui-42): points to `../assets`
- Rollup (db-ui-42-rollup): points to `@db-ui/foundations/assets`
- Webpack (db-ui-42-webpack): points to `~@db-ui/foundations/assets`
- Default (relative): points to `../assets`
- Rollup (rollup): points to `@db-ui/foundations/assets`
- Webpack (webpack): points to `~@db-ui/foundations/assets`

<details>
<summary><strong>SCSS</strong></summary>

```scss
// style.scss
@forward "@db-ui/components/build/styles/db-ui-42-rollup";
@forward "@db-ui/components/build/styles/rollup";
```

```ts
Expand All @@ -44,12 +44,12 @@ import "./style.scss";

```ts
// main.ts
import "@db-ui/components/build/styles/db-ui-42-rollup.css";
import "@db-ui/components/build/styles/rollup.css";
```

</details>

> **Note:** The `db-ui-42` file contains optional and all components styles. If you consider performance issues see [@db-ui/components](https://www.npmjs.com/package/@db-ui/components) for more information.
> **Note:** The `@db-ui/components/build/styles/relative` file contains optional and all components styles. If you consider performance issues see [@db-ui/components](https://www.npmjs.com/package/@db-ui/components) for more information.
## Usage

Expand Down
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 13 additions & 13 deletions packages/components/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ If you just need the styling follow this:

Import the styles in `scss` or `css`. Based on your technology the file names could be different.

- Default (db-ui-42): asset path point to `../assets`
- Webpack (db-ui-42-webpack): asset path point to `~@db-ui/foundations/assets`
- Rollup (db-ui-42-rollup): asset path point to `@db-ui/foundations/assets`
- `relative`: asset path point to `../assets`
- `webpack`: asset path point to `~@db-ui/foundations/assets`
- `rollup`: asset path point to `@db-ui/foundations/assets`

`db-ui-42` bundles all dependencies from [foundations](https://www.npmjs.com/package/@db-ui/foundations) + all [components](https://github.com/db-ui/mono/blob/main/packages/components/src/styles/db-ui-components.scss) available.
They are bundling all dependencies from [foundations](https://www.npmjs.com/package/@db-ui/foundations) and all [components](https://github.com/db-ui/mono/blob/main/packages/components/src/styles/db-ui-components.scss) available.

**SCSS**

```scss
// index.scss
@forward "@db-ui/components/build/styles/db-ui-42-rollup";
@forward "@db-ui/components/build/styles/rollup";
```

**CSS**
Expand All @@ -49,36 +49,36 @@ Within HTML files directly:

```html
<!-- index.html //-->
<link rel="stylesheet" href="/styles/db-ui-42.css" />
<link rel="stylesheet" href="/styles/rollup.css" />
```

Or within your JavaScript files, with the related bundler as a prefix (in this case rollup and equivalents like Vite):

```js
// main.js
import "@db-ui/components/build/styles/db-ui-42-rollup.css";
import "@db-ui/components/build/styles/rollup.css";
```

### Optimize dependencies

If you only need some of the components or some features from [`@db-ui/foundations`](https://www.npmjs.com/package/@db-ui/foundations), you shouldn't include `db-ui-42`.
If you only need some of the components or some features from [`@db-ui/foundations`](https://www.npmjs.com/package/@db-ui/foundations), you shouldn't include the bundled file.
In the case you want to include only some components, and you could do it like this:

```css
/* The theme contains all prop required for components like spacings, colors, ... */
@import "@db-ui/foundations/build/css/default-theme.css";
@import "@db-ui/foundations/build/styles/default-theme.css";
/* The font include uses default font families based on your bundling paths (relative, absolute, webpack, rollup) */
@import "@db-ui/foundations/build/css/fonts/include-rollup.css";
@import "@db-ui/foundations/build/styles/fonts/include-rollup.css";
/* The required styles will normalize css and add focus and default font to body */
@import "@db-ui/foundations/build/css/init/required.css";
@import "@db-ui/foundations/build/styles/init/required.css";
/* The default root adds a default color space (neutral) and a density (regular) */
@import "@db-ui/foundations/build/css/init/default-root.css";
@import "@db-ui/foundations/build/styles/init/default-root.css";

/* Optional: Add animations / transitions for components */
@import "@db-ui/components/build/styles/component-animations.css";

/* Optional: Add data-icon/data-icon-after to global attributes to enable icons for components */
@import "@db-ui/foundations/build/css/icons/include-rollup.css";
@import "@db-ui/foundations/build/styles/icons/include-rollup.css";

/* Optional: Add components */
@import "@db-ui/components/build/components/button/button.css";
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
inject: true
to: src/styles/internal/_custom-elements.scss
after: //hygen-insert
---
db-<%= name %>,
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
inject: true
to: src/styles/db-ui-components.scss
before: angular-workaround
to: src/styles/index.scss
append: true
---
@forward "../components/<%= name %>/<%= name %>";
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ to: src/components/<%= name %>/index.html
<head>
<meta charset="UTF-8" />
<title>DB<%= h.changeCase.pascal(name) %></title>
<link rel="stylesheet" href="/styles/db-ui-42.css" />
<link rel="stylesheet" href="/styles/relative.css" />
</head>
<body style="padding: var(--db-spacing-fixed-md)">
<div class="db-<%= name %>">Test</div>
Expand Down
4 changes: 2 additions & 2 deletions packages/components/docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ The integration depends on your tech stack and varies from copying the files fro
#### Via HTML stylesheet include

```html
<link rel="stylesheet" href="<PATH>/db-ui-42.css" type="text/css" />
<link rel="stylesheet" href="<PATH>/relative.css" type="text/css" />
```

#### Via SCSS import

```scss
@use "@db-ui/components/build/styles/db-ui-42";
@use "@db-ui/components/build/styles/relative";
```

### SCSS: node_modules include path / load path
Expand Down
2 changes: 1 addition & 1 deletion packages/components/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<title>Dev</title>
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="stylesheet" href="/styles/db-ui-42.css" />
<link rel="stylesheet" href="/styles/relative.css" />
</head>
<body style="padding: var(--db-spacing-fixed-md)">
<ul>
Expand Down
7 changes: 6 additions & 1 deletion packages/components/postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
module.exports = {
plugins: [
require('cssnano')({
preset: 'default'
preset: [
'default',
{
svgo: false
}
]
})
]
};
14 changes: 7 additions & 7 deletions packages/components/src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ There are some important files where we include `SCSS mixins` and `SCSS placehol
Main use-case margins, paddings, height, width, ... Example:

```scss
@use "@db-ui/foundations/build/scss/variables";
@use "@db-ui/foundations/build/styles/variables";

.db-xxx {
padding-inline-start: variables.$db-spacing-fixed-2xs;
Expand All @@ -21,7 +21,7 @@ Main use-case margins, paddings, height, width, ... Example:
Main use-case to set/overwrite an icon inside a component. Example:

```scss
@use "@db-ui/foundations/build/scss/icons";
@use "@db-ui/foundations/build/styles/icons";

.db-xxx {
@include icons.set-icon("chevron_down", "after");
Expand All @@ -33,7 +33,7 @@ Main use-case to set/overwrite an icon inside a component. Example:
Main use-case to overwrite a default font-size/line-height. Example:

```scss
@use "@db-ui/foundations/build/scss/fonts";
@use "@db-ui/foundations/build/styles/fonts";

.db-xxx {
label {
Expand All @@ -47,8 +47,8 @@ Main use-case to overwrite a default font-size/line-height. Example:
Main use-case to overwrite a color or change colors by `data-variant`. Example:

```scss
@use "@db-ui/foundations/build/scss/colors";
@use "@db-ui/foundations/build/scss/helpers";
@use "@db-ui/foundations/build/styles/colors";
@use "@db-ui/foundations/build/styles/helpers";

.db-xxx {
@include helpers.hover {
Expand Down Expand Up @@ -87,7 +87,7 @@ Main use-case for adaptive components. Example:
Main use-case for media query. Example:

```scss
@use "@db-ui/foundations/build/scss/screen-sizes";
@use "@db-ui/foundations/build/styles/screen-sizes";

.db-xxx {
display: grid;
Expand All @@ -104,7 +104,7 @@ Main use-case for media query. Example:
Main use-case for converting `px` values or inserting UI styling like e.g. a divider. Example:

```scss
@use "@db-ui/foundations/build/scss/helpers";
@use "@db-ui/foundations/build/styles/helpers";

.db-xxx {
@include helpers.divider("top");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
@use "@db-ui/foundations/build/scss/variables";
@use "@db-ui/foundations/build/scss/helpers";
@use "@db-ui/foundations/build/scss/colors";
@use "@db-ui/foundations/build/scss/animation";
@use "../../styles/form-components";
@use "../../styles/component";
@use "@db-ui/foundations/build/styles/variables";
@use "@db-ui/foundations/build/styles/helpers";
@use "@db-ui/foundations/build/styles/colors";
@use "@db-ui/foundations/build/styles/animation";
@use "../../styles/internal/form-components";
@use "../../styles/internal/component";

$db-accordion-item-border-radius: variables.$db-border-radius-sm;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8" />
<title>DBAccordionItem</title>
<link rel="stylesheet" href="/styles/db-ui-42.css" />
<link rel="stylesheet" href="/styles/relative.css" />
</head>
<body style="padding: var(--db-spacing-fixed-md)">
<!-- HTML only component -->
Expand Down
Loading

0 comments on commit 1af58ec

Please sign in to comment.