dasar-ui 1.5.0 → 1.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +53 -0
- package/README.md +40 -34
- package/docs/_config.yml +3 -0
- package/docs/getting-started.md +89 -0
- package/docs/index.md +9 -0
- package/docs/installation.md +46 -0
- package/package.json +7 -6
- package/projects/dasar-ui/package.json +1 -1
- package/projects/dasar-ui/src/lib/components/dasar-modal/dasar-modal.ts +2 -2
- package/projects/dasar-ui/src/lib/components/dasar-overlay/dasar-overlay.spec.ts +8 -0
- package/projects/dasar-ui/src/lib/components/dasar-overlay/dasar-overlay.ts +2 -2
- package/projects/dasar-ui/src/lib/components/dasar-theme-provider/dasar-theme-provider.spec.ts +89 -0
- package/projects/dasar-ui/src/lib/components/dasar-theme-provider/dasar-theme-provider.ts +23 -0
- package/projects/dasar-ui/src/lib/models/theme.model.ts +64 -0
- package/projects/dasar-ui/src/lib/services/theme.service.spec.ts +65 -0
- package/projects/dasar-ui/src/lib/services/theme.service.ts +70 -0
- package/projects/dasar-ui/src/public-api.ts +1 -0
- package/projects/documentation/src/app/app.html +33 -6
- package/projects/documentation/src/app/app.ts +36 -2
- package/projects/documentation/src/app/components/doc-customize-modal.component.ts +56 -2
- package/projects/documentation/src/app/components/doc-markdown.component.ts +154 -0
- package/projects/documentation/src/app/layouts/doc.layout.ts +23 -3
- package/projects/documentation/src/app/pages/button/button.page.html +1 -1
- package/projects/documentation/src/app/pages/chip/chip.page.html +1 -1
- package/projects/documentation/src/app/pages/getting-started/getting-started.page.ts +21 -0
- package/projects/documentation/src/app/pages/icon/icon.page.html +1 -1
- package/projects/documentation/src/app/pages/installation/installation.page.ts +18 -0
- package/projects/documentation/src/app/pages/introduction/introduction.page.ts +18 -0
- package/projects/documentation/src/app/pages/list/examples/advanced-dynamic/list-advanced-dynamic.example.html +29 -0
- package/projects/documentation/src/app/pages/list/examples/advanced-dynamic/list-advanced-dynamic.example.ts +33 -0
- package/projects/documentation/src/app/pages/list/examples/advanced-theme/list-advanced-theme.example.html +13 -0
- package/projects/documentation/src/app/pages/list/examples/advanced-theme/list-advanced-theme.example.ts +30 -0
- package/projects/documentation/src/app/pages/list/examples/basic/list-basic.example.html +5 -0
- package/projects/documentation/src/app/pages/list/examples/basic/list-basic.example.ts +12 -0
- package/projects/documentation/src/app/pages/list/examples/bordered-divider/list-bordered-divider.example.html +20 -0
- package/projects/documentation/src/app/pages/list/examples/bordered-divider/list-bordered-divider.example.ts +12 -0
- package/projects/documentation/src/app/pages/list/examples/custom-style/list-custom-style.example.html +11 -0
- package/projects/documentation/src/app/pages/list/examples/custom-style/list-custom-style.example.ts +19 -0
- package/projects/documentation/src/app/pages/list/examples/header-footer/list-header-footer.example.html +7 -0
- package/projects/documentation/src/app/pages/list/examples/header-footer/list-header-footer.example.ts +12 -0
- package/projects/documentation/src/app/pages/list/examples/interactive/list-interactive.example.html +20 -0
- package/projects/documentation/src/app/pages/list/examples/interactive/list-interactive.example.ts +22 -0
- package/projects/documentation/src/app/pages/list/examples/prefix-suffix/list-prefix-suffix.example.html +9 -0
- package/projects/documentation/src/app/pages/list/examples/prefix-suffix/list-prefix-suffix.example.ts +16 -0
- package/projects/documentation/src/app/pages/list/examples/size/list-size.example.html +20 -0
- package/projects/documentation/src/app/pages/list/examples/size/list-size.example.ts +12 -0
- package/projects/documentation/src/app/pages/list/list.page.html +95 -0
- package/projects/documentation/src/app/pages/list/list.page.ts +238 -0
- package/projects/documentation/src/app/pages/modal/modal.page.ts +15 -6
- package/projects/documentation/src/app/pages/table/table.page.html +1 -1
- package/projects/documentation/src/app/pages/tabs/tabs.page.ts +7 -0
- package/projects/documentation/src/app/pages/theming/examples/component-config/theming-component-config.example.html +13 -0
- package/projects/documentation/src/app/pages/theming/examples/component-config/theming-component-config.example.ts +20 -0
- package/projects/documentation/src/app/pages/theming/examples/css-override/theming-css-override.example.html +8 -0
- package/projects/documentation/src/app/pages/theming/examples/css-override/theming-css-override.example.scss +4 -0
- package/projects/documentation/src/app/pages/theming/examples/css-override/theming-css-override.example.ts +11 -0
- package/projects/documentation/src/app/pages/theming/examples/custom-tokens/theming-custom-tokens.example.html +13 -0
- package/projects/documentation/src/app/pages/theming/examples/custom-tokens/theming-custom-tokens.example.ts +33 -0
- package/projects/documentation/src/app/pages/theming/examples/global-theme/theming-global-theme.example.html +6 -0
- package/projects/documentation/src/app/pages/theming/examples/global-theme/theming-global-theme.example.ts +20 -0
- package/projects/documentation/src/app/pages/theming/examples/light-dark/theming-light-dark.example.html +15 -0
- package/projects/documentation/src/app/pages/theming/examples/light-dark/theming-light-dark.example.ts +31 -0
- package/projects/documentation/src/app/pages/theming/theming-component-config.page.ts +52 -0
- package/projects/documentation/src/app/pages/theming/theming-css-variables.page.ts +71 -0
- package/projects/documentation/src/app/pages/theming/theming-tokens.page.ts +56 -0
- package/projects/documentation/src/app/pages/theming/theming.data.ts +947 -0
- package/projects/documentation/src/app/pages/theming/theming.page.html +56 -0
- package/projects/documentation/src/app/pages/theming/theming.page.ts +144 -0
- package/projects/documentation/src/app/routes/app.routes.ts +63 -15
- package/projects/documentation/src/app/services/doc-customize.service.ts +12 -0
- package/projects/documentation/src/styles.scss +12 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,59 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [1.9.2](https://github.com/pis2co/dasar-ui/compare/v1.9.1...v1.9.2) (2026-10-15)
|
|
6
|
+
|
|
7
|
+
### [1.9.1](https://github.com/pis2co/dasar-ui/compare/v1.9.0...v1.9.1) (2026-10-15)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* docs and script publish ([1012339](https://github.com/pis2co/dasar-ui/commit/10123392d668821b282ca96d274cc5d68f799049))
|
|
13
|
+
|
|
14
|
+
## [1.9.0](https://github.com/pis2co/dasar-ui/compare/v1.7.1...v1.9.0) (2026-10-15)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* adjust docs ([e40bfef](https://github.com/pis2co/dasar-ui/commit/e40bfef5251752f24716b96c5081a8831a0991ed))
|
|
20
|
+
|
|
21
|
+
## [1.8.0](https://github.com/pis2co/dasar-ui/compare/v1.7.1...v1.8.0) (2026-10-15)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Bug Fixes
|
|
25
|
+
|
|
26
|
+
* adjust docs ([4b59465](https://github.com/pis2co/dasar-ui/commit/4b5946546fbbbb5de97ddc1d66687593dd289266))
|
|
27
|
+
|
|
28
|
+
### [1.7.1](https://github.com/pis2co/dasar-ui/compare/v1.7.0...v1.7.1) (2026-10-15)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Bug Fixes
|
|
32
|
+
|
|
33
|
+
* navbar styling ([05045d7](https://github.com/pis2co/dasar-ui/commit/05045d7e3c93f3a1f5bd1c68705be5937e0550ea))
|
|
34
|
+
|
|
35
|
+
## [1.7.0](https://github.com/pis2co/dasar-ui/compare/v1.6.0...v1.7.0) (2026-10-15)
|
|
36
|
+
|
|
37
|
+
## [1.6.0](https://github.com/pis2co/dasar-ui/compare/v1.5.2...v1.6.0) (2026-10-15)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
### Features
|
|
41
|
+
|
|
42
|
+
* add more documentation page for basic and theme ([7671853](https://github.com/pis2co/dasar-ui/commit/7671853fb07d291a897bdd995f89daac893ac354))
|
|
43
|
+
|
|
44
|
+
### [1.5.2](https://github.com/pis2co/dasar-ui/compare/v1.5.1...v1.5.2) (2026-10-15)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
### Features
|
|
48
|
+
|
|
49
|
+
* add documentation for dasar-list ([dab366a](https://github.com/pis2co/dasar-ui/commit/dab366adee2661891c601e3bd8eed6e65fb236f6))
|
|
50
|
+
|
|
51
|
+
### [1.5.1](https://github.com/pis2co/dasar-ui/compare/v1.5.0...v1.5.1) (2026-10-15)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
### Bug Fixes
|
|
55
|
+
|
|
56
|
+
* theme and tokens configuration ([2af6c69](https://github.com/pis2co/dasar-ui/commit/2af6c69ec4bb54be02b12e199e8ad4caf64b62f6))
|
|
57
|
+
|
|
5
58
|
## [1.5.0](https://github.com/pis2co/dasar-ui/compare/v1.4.0...v1.5.0) (2026-10-15)
|
|
6
59
|
|
|
7
60
|
|
package/README.md
CHANGED
|
@@ -1,59 +1,65 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dasar-ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Angular UI component library based on danarakca design system. Standalone components, SSR-safe, themeable with light and dark mode.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[](https://www.npmjs.com/package/dasar-ui)
|
|
6
|
+
[](https://github.com/pis2co/dasar-ui/blob/main/package.json)
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
## Features
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
- Standalone Angular components, no NgModule setup
|
|
11
|
+
- Theming in three layers: CSS variables, theme tokens, component config
|
|
12
|
+
- Light and dark mode with `data-theme="dark"`
|
|
13
|
+
- SSR-safe components and documentation app
|
|
14
|
+
- Design tokens for colors, typography, spacing, radius and per-component styles
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
## Components
|
|
14
17
|
|
|
15
|
-
|
|
18
|
+
Button, Icon, Chip, Input, Number Input, Select, Calendar, Datepicker, Card, Modal, Overlay, Menu, Table, Tabs, List.
|
|
16
19
|
|
|
17
|
-
|
|
20
|
+
## Quick start
|
|
18
21
|
|
|
19
22
|
```bash
|
|
20
|
-
|
|
23
|
+
npm i dasar-ui
|
|
21
24
|
```
|
|
22
25
|
|
|
23
|
-
|
|
26
|
+
```ts
|
|
27
|
+
import { DasarButtonComponent } from 'dasar-ui';
|
|
24
28
|
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
@Component({
|
|
30
|
+
imports: [DasarButtonComponent],
|
|
31
|
+
template: `<dasar-button variant="primary">Save</dasar-button>`,
|
|
32
|
+
})
|
|
33
|
+
export class App {}
|
|
27
34
|
```
|
|
28
35
|
|
|
29
|
-
|
|
36
|
+
Read the full guides:
|
|
30
37
|
|
|
31
|
-
|
|
38
|
+
- [Installation](./docs/installation.md)
|
|
39
|
+
- [Getting started](./docs/getting-started.md)
|
|
40
|
+
- [Theming overview](https://github.com/pis2co/dasar-ui) (in the docs app: `/theming`)
|
|
32
41
|
|
|
33
|
-
|
|
34
|
-
ng build
|
|
35
|
-
```
|
|
42
|
+
## Links
|
|
36
43
|
|
|
37
|
-
|
|
44
|
+
- [Documentation app](https://github.com/pis2co/dasar-ui)
|
|
45
|
+
- [npm package](https://www.npmjs.com/package/dasar-ui)
|
|
46
|
+
- [Changelog](https://github.com/pis2co/dasar-ui/blob/main/CHANGELOG.md)
|
|
47
|
+
- [GitHub repository](https://github.com/pis2co/dasar-ui)
|
|
38
48
|
|
|
39
|
-
##
|
|
49
|
+
## Contributors
|
|
40
50
|
|
|
41
|
-
|
|
51
|
+
- <a href="https://github.com/pis2co"><img src="https://github.com/pis2co.png?size=40" width="32" height="32" alt="pis2co" style="display: inline-block; border-radius: 50%; vertical-align: middle; margin: 0 8px 0 0;" /></a> **[pis2co](https://github.com/pis2co)** — Organization and maintainer
|
|
52
|
+
- <a href="https://github.com/dxxta"><img src="https://github.com/dxxta.png?size=40" width="32" height="32" alt="dxxta" style="display: inline-block; border-radius: 50%; vertical-align: middle; margin: 0 8px 0 0;" /></a> **[dxxta](https://github.com/dxxta)** — Author and maintainer
|
|
42
53
|
|
|
43
|
-
|
|
44
|
-
ng test
|
|
45
|
-
```
|
|
54
|
+
Contributions are welcome for apbn core team. Open an issue or a pull request on [GitHub](https://github.com/pis2co/dasar-ui).
|
|
46
55
|
|
|
47
|
-
##
|
|
56
|
+
## Development
|
|
48
57
|
|
|
49
|
-
|
|
58
|
+
This repository is an Angular 22 monorepo with the `dasar-ui` library and an SSR documentation app.
|
|
50
59
|
|
|
51
60
|
```bash
|
|
52
|
-
|
|
61
|
+
npm install
|
|
62
|
+
npx ng build dasar-ui
|
|
63
|
+
npx ng build documentation
|
|
64
|
+
npx ng test dasar-ui --watch=false
|
|
53
65
|
```
|
|
54
|
-
|
|
55
|
-
Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
|
|
56
|
-
|
|
57
|
-
## Additional Resources
|
|
58
|
-
|
|
59
|
-
For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
|
package/docs/_config.yml
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Getting started
|
|
2
|
+
|
|
3
|
+
Render your first component, wrap the app in the theme provider, and switch between light and dark mode.
|
|
4
|
+
|
|
5
|
+
## 1. Render a component
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { DasarButtonComponent, DasarCardComponent } from 'dasar-ui';
|
|
9
|
+
|
|
10
|
+
@Component({
|
|
11
|
+
imports: [DasarButtonComponent, DasarCardComponent],
|
|
12
|
+
template: `
|
|
13
|
+
<dasar-card label="Hello">
|
|
14
|
+
<dasar-button variant="primary">Save</dasar-button>
|
|
15
|
+
</dasar-card>
|
|
16
|
+
`,
|
|
17
|
+
})
|
|
18
|
+
export class App {}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## 2. Add the theme provider
|
|
22
|
+
|
|
23
|
+
Wrap your app in `dasar-theme-provider` to set component defaults, theme tokens and the color mode in one place:
|
|
24
|
+
|
|
25
|
+
```html
|
|
26
|
+
<dasar-theme-provider [componentConfig]="componentConfig" [tokenConfig]="tokenConfig" mode="light">
|
|
27
|
+
<router-outlet></router-outlet>
|
|
28
|
+
</dasar-theme-provider>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { DasarComponentConfig, DasarThemeConfig } from 'dasar-ui';
|
|
33
|
+
|
|
34
|
+
protected componentConfig: DasarComponentConfig = {
|
|
35
|
+
button: { appearance: 'solid', size: 'md' },
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
protected tokenConfig: DasarThemeConfig['tokens'] = {
|
|
39
|
+
light: {
|
|
40
|
+
button: { radius: '8px' },
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## 3. Set a global theme from code
|
|
46
|
+
|
|
47
|
+
To theme the whole page from a service instead of a provider, inject `DasarThemeService` and call `setGlobalTheme`:
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
import { inject } from '@angular/core';
|
|
51
|
+
import { DasarThemeService } from 'dasar-ui';
|
|
52
|
+
|
|
53
|
+
const themes = inject(DasarThemeService);
|
|
54
|
+
themes.setGlobalTheme({
|
|
55
|
+
mode: 'light',
|
|
56
|
+
components: { button: { appearance: 'solid' } },
|
|
57
|
+
tokens: { light: { common: { primaryColor: '#2563eb' } } },
|
|
58
|
+
});
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
`setGlobalTheme` writes the mapped CSS variables onto `document.documentElement` (or a target element you pass) and toggles `data-theme="dark"` when `mode` is `'dark'`.
|
|
62
|
+
|
|
63
|
+
## 4. Toggle light and dark mode
|
|
64
|
+
|
|
65
|
+
The mode is a single value, `'light' | 'dark'`:
|
|
66
|
+
|
|
67
|
+
```html
|
|
68
|
+
<dasar-theme-provider [mode]="mode()">
|
|
69
|
+
<dasar-button (click)="toggle()">Theme: {{ mode() }}</dasar-button>
|
|
70
|
+
</dasar-theme-provider>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
import { signal } from '@angular/core';
|
|
75
|
+
import { DasarThemeMode } from 'dasar-ui';
|
|
76
|
+
|
|
77
|
+
protected mode = signal<DasarThemeMode>('light');
|
|
78
|
+
|
|
79
|
+
toggle() {
|
|
80
|
+
this.mode.update((m) => (m === 'light' ? 'dark' : 'light'));
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Dark mode works through the `[data-theme='dark']` CSS variable overrides plus the `tokens.dark` values you provide.
|
|
85
|
+
|
|
86
|
+
## Next steps
|
|
87
|
+
|
|
88
|
+
- [Installation](./installation.md)
|
|
89
|
+
- Theming overview in the docs app (`/theming`), with the full token, CSS variable and component config references
|
package/docs/index.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# dasar-ui docs
|
|
2
|
+
|
|
3
|
+
Markdown guides for the `dasar-ui` Angular component library.
|
|
4
|
+
|
|
5
|
+
- [Introduction](../README.md)
|
|
6
|
+
- [Installation](./installation.md)
|
|
7
|
+
- [Getting started](./getting-started.md)
|
|
8
|
+
|
|
9
|
+
The interactive documentation app serves the same pages with live examples, plus the theming reference (`/theming`).
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Installation
|
|
2
|
+
|
|
3
|
+
How to add `dasar-ui` to an Angular project.
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
- Angular 22 (`@angular/core`, `@angular/common`, `@angular/forms`, `@angular/platform-browser` `^22.1.0`)
|
|
8
|
+
- `rxjs` `^7.8.0`
|
|
9
|
+
- Node.js 20 or newer (Angular 22 works on Node 20 and 22)
|
|
10
|
+
|
|
11
|
+
## Install the package
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm i dasar-ui
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Import a component
|
|
18
|
+
|
|
19
|
+
`dasar-ui` components are standalone. Import them where you use them:
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import { DasarButtonComponent } from 'dasar-ui';
|
|
23
|
+
|
|
24
|
+
@Component({
|
|
25
|
+
imports: [DasarButtonComponent],
|
|
26
|
+
template: `<dasar-button variant="primary">Save</dasar-button>`,
|
|
27
|
+
})
|
|
28
|
+
export class App {}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Styles
|
|
32
|
+
|
|
33
|
+
Theme CSS variables ship with the components, so no extra setup is required. Each component stylesheet includes the shared theme, which defines the `:root` variables (`--theme-*`, `--font-*`, `--space-*`, `--radius-*`) and the `[data-theme='dark']` overrides.
|
|
34
|
+
|
|
35
|
+
Optional: to use the SCSS variables directly in your own styles, import the theme file from the published package:
|
|
36
|
+
|
|
37
|
+
```scss
|
|
38
|
+
@use 'dasar-ui/styles/theme.scss' as *;
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The published styles live in `dist/dasar-ui/styles/theme.scss` (source: `projects/dasar-ui/src/lib/styles/theme.scss`).
|
|
42
|
+
|
|
43
|
+
## Next steps
|
|
44
|
+
|
|
45
|
+
- [Getting started](./getting-started.md)
|
|
46
|
+
- Theming overview in the docs app (`/theming`)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dasar-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.2",
|
|
4
4
|
"author": "dxxta",
|
|
5
5
|
"packageManager": "npm@10.9.8",
|
|
6
6
|
"scripts": {
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"git:patch": "npx standard-version --release-as patch",
|
|
12
12
|
"git:minor": "npx standard-version --release-as minor",
|
|
13
13
|
"git:major": "npx standard-version --release-as major",
|
|
14
|
+
"release:publish": "cd dist/dasar-ui && npm publish --access public",
|
|
14
15
|
"release:build": "npm run build:library",
|
|
15
|
-
"release:publish": "npm publish dist/dasar-ui --access public",
|
|
16
16
|
"start": "ng serve documentation --port 5200",
|
|
17
17
|
"start:docs": "ng serve documentation --port 5200",
|
|
18
18
|
"build:docs": "ng build documentation",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"@types/node": "^20.17.19",
|
|
34
34
|
"@types/prismjs": "1.26.6",
|
|
35
35
|
"jsdom": "^28.0.0",
|
|
36
|
+
"marked": "18.1.1",
|
|
36
37
|
"ng-packagr": "^22.1.0",
|
|
37
38
|
"prettier": "^3.8.1",
|
|
38
39
|
"standard-version": "^9.5.0",
|
|
@@ -41,12 +42,12 @@
|
|
|
41
42
|
"vitest": "~4.0.8"
|
|
42
43
|
},
|
|
43
44
|
"dependencies": {
|
|
44
|
-
"@angular/platform-browser": "^22.1.0",
|
|
45
|
-
"@angular/platform-server": "^22.1.0",
|
|
46
|
-
"@angular/compiler": "^22.1.0",
|
|
47
45
|
"@angular/common": "^22.1.0",
|
|
48
|
-
"@angular/
|
|
46
|
+
"@angular/compiler": "^22.1.0",
|
|
49
47
|
"@angular/core": "^22.1.0",
|
|
48
|
+
"@angular/forms": "^22.1.0",
|
|
49
|
+
"@angular/platform-browser": "^22.1.0",
|
|
50
|
+
"@angular/platform-server": "^22.1.0",
|
|
50
51
|
"@angular/router": "^22.1.0",
|
|
51
52
|
"@angular/ssr": "^22.1.8",
|
|
52
53
|
"express": "^5.1.0",
|
|
@@ -234,14 +234,14 @@ export class DasarModal implements OnChanges, OnDestroy {
|
|
|
234
234
|
@Input({ alias: 'overlay-blur' }) overlayBlur = resolveThemeDefault(
|
|
235
235
|
'modal',
|
|
236
236
|
'overlayBlur',
|
|
237
|
-
|
|
237
|
+
null as string | null,
|
|
238
238
|
this.themeProvider,
|
|
239
239
|
this.themeService,
|
|
240
240
|
);
|
|
241
241
|
@Input({ alias: 'overlay-background' }) overlayBackground = resolveThemeDefault(
|
|
242
242
|
'modal',
|
|
243
243
|
'overlayBackground',
|
|
244
|
-
|
|
244
|
+
null as string | null,
|
|
245
245
|
this.themeProvider,
|
|
246
246
|
this.themeService,
|
|
247
247
|
);
|
|
@@ -44,6 +44,14 @@ describe('DasarOverlay', () => {
|
|
|
44
44
|
fixture.detectChanges();
|
|
45
45
|
expect(fixture.nativeElement.classList).toContain('dasar-overlay');
|
|
46
46
|
});
|
|
47
|
+
|
|
48
|
+
it('leaves the backdrop tokens free when no blur or background is set', () => {
|
|
49
|
+
fixture.detectChanges();
|
|
50
|
+
const backdrop = fixture.nativeElement.querySelector('.dasar-overlay-backdrop') as HTMLElement;
|
|
51
|
+
|
|
52
|
+
expect(backdrop.style.getPropertyValue('--overlay-blur')).toBe('');
|
|
53
|
+
expect(backdrop.style.getPropertyValue('--overlay-background')).toBe('');
|
|
54
|
+
});
|
|
47
55
|
});
|
|
48
56
|
|
|
49
57
|
describe('DasarOverlay interactions', () => {
|
|
@@ -39,14 +39,14 @@ export class DasarOverlay {
|
|
|
39
39
|
@Input() blur = resolveThemeDefault(
|
|
40
40
|
'overlay',
|
|
41
41
|
'blur',
|
|
42
|
-
|
|
42
|
+
null as string | null,
|
|
43
43
|
this.themeProvider,
|
|
44
44
|
this.themeService,
|
|
45
45
|
);
|
|
46
46
|
@Input() background = resolveThemeDefault(
|
|
47
47
|
'overlay',
|
|
48
48
|
'background',
|
|
49
|
-
|
|
49
|
+
null as string | null,
|
|
50
50
|
this.themeProvider,
|
|
51
51
|
this.themeService,
|
|
52
52
|
);
|
package/projects/dasar-ui/src/lib/components/dasar-theme-provider/dasar-theme-provider.spec.ts
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { Component, signal } from '@angular/core';
|
|
2
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
3
|
+
import { DasarThemeProviderComponent } from './dasar-theme-provider';
|
|
4
|
+
import { DasarThemeConfig, DasarThemeMode } from '@models/theme.model';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'app-theme-provider-host',
|
|
8
|
+
standalone: true,
|
|
9
|
+
imports: [DasarThemeProviderComponent],
|
|
10
|
+
template: `<dasar-theme-provider
|
|
11
|
+
[mode]="mode()"
|
|
12
|
+
[tokenConfig]="tokens()"
|
|
13
|
+
></dasar-theme-provider>`,
|
|
14
|
+
})
|
|
15
|
+
class ThemeProviderHost {
|
|
16
|
+
mode = signal<DasarThemeMode>('light');
|
|
17
|
+
tokens = signal<DasarThemeConfig['tokens']>({});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
describe('DasarThemeProviderComponent component tokens', () => {
|
|
21
|
+
let fixture: ComponentFixture<ThemeProviderHost>;
|
|
22
|
+
const host = () => fixture.nativeElement.querySelector('dasar-theme-provider') as HTMLElement;
|
|
23
|
+
|
|
24
|
+
beforeEach(async () => {
|
|
25
|
+
await TestBed.configureTestingModule({
|
|
26
|
+
imports: [ThemeProviderHost],
|
|
27
|
+
}).compileComponents();
|
|
28
|
+
|
|
29
|
+
fixture = TestBed.createComponent(ThemeProviderHost);
|
|
30
|
+
await fixture.whenStable();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('injects tabs, overlay and modal tokens on its host element', async () => {
|
|
34
|
+
fixture.componentInstance.tokens.set({
|
|
35
|
+
light: {
|
|
36
|
+
tabs: { listPaddingNormal: '11px', scrollFade: '20px' },
|
|
37
|
+
overlay: { background: 'rgba(9, 9, 9, 0.2)' },
|
|
38
|
+
modal: { titleColor: '#123456', elevatedShadow: 'none' },
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
await fixture.whenStable();
|
|
42
|
+
|
|
43
|
+
expect(host().style.getPropertyValue('--tabs-list-padding-normal')).toBe('11px');
|
|
44
|
+
expect(host().style.getPropertyValue('--tabs-scroll-fade')).toBe('20px');
|
|
45
|
+
expect(host().style.getPropertyValue('--overlay-background')).toBe('rgba(9, 9, 9, 0.2)');
|
|
46
|
+
expect(host().style.getPropertyValue('--modal-title-color')).toBe('#123456');
|
|
47
|
+
expect(host().style.getPropertyValue('--modal-elevated-shadow')).toBe('none');
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('falls back to the light tokens when the mode has none', async () => {
|
|
51
|
+
fixture.componentInstance.tokens.set({
|
|
52
|
+
light: { overlay: { blur: '3px' }, modal: { widthSm: '240px' } },
|
|
53
|
+
});
|
|
54
|
+
await fixture.whenStable();
|
|
55
|
+
|
|
56
|
+
fixture.componentInstance.mode.set('dark');
|
|
57
|
+
await fixture.whenStable();
|
|
58
|
+
|
|
59
|
+
expect(host().style.getPropertyValue('--overlay-blur')).toBe('3px');
|
|
60
|
+
expect(host().style.getPropertyValue('--modal-width-sm')).toBe('240px');
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('prefers the dark tokens for the dark mode', async () => {
|
|
64
|
+
fixture.componentInstance.tokens.set({
|
|
65
|
+
light: { modal: { widthSm: '240px' } },
|
|
66
|
+
dark: { modal: { widthSm: '320px' } },
|
|
67
|
+
});
|
|
68
|
+
await fixture.whenStable();
|
|
69
|
+
|
|
70
|
+
fixture.componentInstance.mode.set('dark');
|
|
71
|
+
await fixture.whenStable();
|
|
72
|
+
|
|
73
|
+
expect(host().style.getPropertyValue('--modal-width-sm')).toBe('320px');
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it('removes tokens that are no longer part of the config', async () => {
|
|
77
|
+
fixture.componentInstance.tokens.set({ light: { overlay: { blur: '3px' } } });
|
|
78
|
+
await fixture.whenStable();
|
|
79
|
+
expect(host().style.getPropertyValue('--overlay-blur')).toBe('3px');
|
|
80
|
+
|
|
81
|
+
fixture.componentInstance.tokens.set({ light: { overlay: { blur: '9px' } } });
|
|
82
|
+
await fixture.whenStable();
|
|
83
|
+
expect(host().style.getPropertyValue('--overlay-blur')).toBe('9px');
|
|
84
|
+
|
|
85
|
+
fixture.componentInstance.tokens.set({});
|
|
86
|
+
await fixture.whenStable();
|
|
87
|
+
expect(host().style.getPropertyValue('--overlay-blur')).toBe('');
|
|
88
|
+
});
|
|
89
|
+
});
|
|
@@ -16,6 +16,9 @@ import {
|
|
|
16
16
|
cardMap,
|
|
17
17
|
menuMap,
|
|
18
18
|
listMap,
|
|
19
|
+
tabsMap,
|
|
20
|
+
overlayMap,
|
|
21
|
+
modalMap,
|
|
19
22
|
} from '../../services/theme.service';
|
|
20
23
|
import {
|
|
21
24
|
InjectionToken,
|
|
@@ -235,6 +238,26 @@ export class DasarThemeProviderComponent implements OnChanges {
|
|
|
235
238
|
if (listTokens) {
|
|
236
239
|
this.injectMappedTokens({ element: hostElement, payload: listTokens, dictionary: listMap });
|
|
237
240
|
}
|
|
241
|
+
|
|
242
|
+
const tabsTokens = this.tokenConfig?.[currentMode]?.tabs || this.tokenConfig?.light?.tabs;
|
|
243
|
+
if (tabsTokens) {
|
|
244
|
+
this.injectMappedTokens({ element: hostElement, payload: tabsTokens, dictionary: tabsMap });
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
const overlayTokens =
|
|
248
|
+
this.tokenConfig?.[currentMode]?.overlay || this.tokenConfig?.light?.overlay;
|
|
249
|
+
if (overlayTokens) {
|
|
250
|
+
this.injectMappedTokens({
|
|
251
|
+
element: hostElement,
|
|
252
|
+
payload: overlayTokens,
|
|
253
|
+
dictionary: overlayMap,
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
const modalTokens = this.tokenConfig?.[currentMode]?.modal || this.tokenConfig?.light?.modal;
|
|
258
|
+
if (modalTokens) {
|
|
259
|
+
this.injectMappedTokens({ element: hostElement, payload: modalTokens, dictionary: modalMap });
|
|
260
|
+
}
|
|
238
261
|
}
|
|
239
262
|
|
|
240
263
|
private injectMappedTokens(params: {
|
|
@@ -607,6 +607,64 @@ export interface DasarThemeList {
|
|
|
607
607
|
prefixColor?: string;
|
|
608
608
|
suffixColor?: string;
|
|
609
609
|
}
|
|
610
|
+
export interface DasarThemeTabs {
|
|
611
|
+
listPaddingNormal?: string;
|
|
612
|
+
listPaddingCompact?: string;
|
|
613
|
+
gapNormal?: string;
|
|
614
|
+
gapCompact?: string;
|
|
615
|
+
contentGapNormal?: string;
|
|
616
|
+
contentGapCompact?: string;
|
|
617
|
+
listRadiusNone?: string;
|
|
618
|
+
listRadiusXs?: string;
|
|
619
|
+
listRadiusSm?: string;
|
|
620
|
+
listRadiusMd?: string;
|
|
621
|
+
listRadiusLg?: string;
|
|
622
|
+
listRadiusXl?: string;
|
|
623
|
+
listRadiusFull?: string;
|
|
624
|
+
scrollGap?: string;
|
|
625
|
+
scrollFade?: string;
|
|
626
|
+
scrollBtnPaddingX?: string;
|
|
627
|
+
}
|
|
628
|
+
export interface DasarThemeOverlay {
|
|
629
|
+
background?: string;
|
|
630
|
+
blur?: string;
|
|
631
|
+
}
|
|
632
|
+
export interface DasarThemeModal {
|
|
633
|
+
background?: string;
|
|
634
|
+
bodyColor?: string;
|
|
635
|
+
titleColor?: string;
|
|
636
|
+
titleFontWeight?: string;
|
|
637
|
+
headerBorder?: string;
|
|
638
|
+
actionsBackground?: string;
|
|
639
|
+
actionsBorder?: string;
|
|
640
|
+
actionsGap?: string;
|
|
641
|
+
outlineBorder?: string;
|
|
642
|
+
elevatedBorder?: string;
|
|
643
|
+
elevatedShadow?: string;
|
|
644
|
+
widthSm?: string;
|
|
645
|
+
widthMd?: string;
|
|
646
|
+
widthLg?: string;
|
|
647
|
+
fontSizeXs?: string;
|
|
648
|
+
fontSizeSm?: string;
|
|
649
|
+
fontSizeMd?: string;
|
|
650
|
+
fontSizeLg?: string;
|
|
651
|
+
fontSizeXl?: string;
|
|
652
|
+
radiusNone?: string;
|
|
653
|
+
radiusXs?: string;
|
|
654
|
+
radiusSm?: string;
|
|
655
|
+
radiusMd?: string;
|
|
656
|
+
radiusLg?: string;
|
|
657
|
+
radiusXl?: string;
|
|
658
|
+
radiusFull?: string;
|
|
659
|
+
compactHeaderPadding?: string;
|
|
660
|
+
compactBodyPadding?: string;
|
|
661
|
+
compactActionsPadding?: string;
|
|
662
|
+
normalHeaderPaddingHorizontal?: string;
|
|
663
|
+
normalHeaderPaddingVertical?: string;
|
|
664
|
+
normalBodyPaddingHorizontal?: string;
|
|
665
|
+
normalBodyPaddingVertical?: string;
|
|
666
|
+
normalActionsPadding?: string;
|
|
667
|
+
}
|
|
610
668
|
export interface DasarComponentCommonConfig {
|
|
611
669
|
size?: Extract<ScaleAttributeType, 'xs' | 'sm' | 'md' | 'lg' | 'xl'>;
|
|
612
670
|
radius?: ScaleAttributeType;
|
|
@@ -648,6 +706,9 @@ export interface DasarThemeConfig {
|
|
|
648
706
|
menu?: DasarThemeMenu;
|
|
649
707
|
table?: DasarThemeTable;
|
|
650
708
|
list?: DasarThemeList;
|
|
709
|
+
tabs?: DasarThemeTabs;
|
|
710
|
+
overlay?: DasarThemeOverlay;
|
|
711
|
+
modal?: DasarThemeModal;
|
|
651
712
|
};
|
|
652
713
|
dark?: {
|
|
653
714
|
common?: DasarThemeCommon;
|
|
@@ -661,6 +722,9 @@ export interface DasarThemeConfig {
|
|
|
661
722
|
menu?: DasarThemeMenu;
|
|
662
723
|
table?: DasarThemeTable;
|
|
663
724
|
list?: DasarThemeList;
|
|
725
|
+
tabs?: DasarThemeTabs;
|
|
726
|
+
overlay?: DasarThemeOverlay;
|
|
727
|
+
modal?: DasarThemeModal;
|
|
664
728
|
};
|
|
665
729
|
};
|
|
666
730
|
}
|