dasar-ui 1.5.0 → 1.9.0

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.
Files changed (67) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/README.md +40 -34
  3. package/docs/_config.yml +3 -0
  4. package/docs/getting-started.md +89 -0
  5. package/docs/index.md +9 -0
  6. package/docs/installation.md +46 -0
  7. package/package.json +6 -5
  8. package/projects/dasar-ui/package.json +1 -1
  9. package/projects/dasar-ui/src/lib/components/dasar-modal/dasar-modal.ts +2 -2
  10. package/projects/dasar-ui/src/lib/components/dasar-overlay/dasar-overlay.spec.ts +8 -0
  11. package/projects/dasar-ui/src/lib/components/dasar-overlay/dasar-overlay.ts +2 -2
  12. package/projects/dasar-ui/src/lib/components/dasar-theme-provider/dasar-theme-provider.spec.ts +89 -0
  13. package/projects/dasar-ui/src/lib/components/dasar-theme-provider/dasar-theme-provider.ts +23 -0
  14. package/projects/dasar-ui/src/lib/models/theme.model.ts +64 -0
  15. package/projects/dasar-ui/src/lib/services/theme.service.spec.ts +65 -0
  16. package/projects/dasar-ui/src/lib/services/theme.service.ts +70 -0
  17. package/projects/dasar-ui/src/public-api.ts +1 -0
  18. package/projects/documentation/src/app/app.html +33 -6
  19. package/projects/documentation/src/app/app.ts +36 -2
  20. package/projects/documentation/src/app/components/doc-customize-modal.component.ts +56 -2
  21. package/projects/documentation/src/app/components/doc-markdown.component.ts +154 -0
  22. package/projects/documentation/src/app/layouts/doc.layout.ts +23 -3
  23. package/projects/documentation/src/app/pages/getting-started/getting-started.page.ts +21 -0
  24. package/projects/documentation/src/app/pages/installation/installation.page.ts +18 -0
  25. package/projects/documentation/src/app/pages/introduction/introduction.page.ts +18 -0
  26. package/projects/documentation/src/app/pages/list/examples/advanced-dynamic/list-advanced-dynamic.example.html +29 -0
  27. package/projects/documentation/src/app/pages/list/examples/advanced-dynamic/list-advanced-dynamic.example.ts +33 -0
  28. package/projects/documentation/src/app/pages/list/examples/advanced-theme/list-advanced-theme.example.html +13 -0
  29. package/projects/documentation/src/app/pages/list/examples/advanced-theme/list-advanced-theme.example.ts +30 -0
  30. package/projects/documentation/src/app/pages/list/examples/basic/list-basic.example.html +5 -0
  31. package/projects/documentation/src/app/pages/list/examples/basic/list-basic.example.ts +12 -0
  32. package/projects/documentation/src/app/pages/list/examples/bordered-divider/list-bordered-divider.example.html +20 -0
  33. package/projects/documentation/src/app/pages/list/examples/bordered-divider/list-bordered-divider.example.ts +12 -0
  34. package/projects/documentation/src/app/pages/list/examples/custom-style/list-custom-style.example.html +11 -0
  35. package/projects/documentation/src/app/pages/list/examples/custom-style/list-custom-style.example.ts +19 -0
  36. package/projects/documentation/src/app/pages/list/examples/header-footer/list-header-footer.example.html +7 -0
  37. package/projects/documentation/src/app/pages/list/examples/header-footer/list-header-footer.example.ts +12 -0
  38. package/projects/documentation/src/app/pages/list/examples/interactive/list-interactive.example.html +20 -0
  39. package/projects/documentation/src/app/pages/list/examples/interactive/list-interactive.example.ts +22 -0
  40. package/projects/documentation/src/app/pages/list/examples/prefix-suffix/list-prefix-suffix.example.html +9 -0
  41. package/projects/documentation/src/app/pages/list/examples/prefix-suffix/list-prefix-suffix.example.ts +16 -0
  42. package/projects/documentation/src/app/pages/list/examples/size/list-size.example.html +20 -0
  43. package/projects/documentation/src/app/pages/list/examples/size/list-size.example.ts +12 -0
  44. package/projects/documentation/src/app/pages/list/list.page.html +95 -0
  45. package/projects/documentation/src/app/pages/list/list.page.ts +238 -0
  46. package/projects/documentation/src/app/pages/modal/modal.page.ts +15 -6
  47. package/projects/documentation/src/app/pages/tabs/tabs.page.ts +7 -0
  48. package/projects/documentation/src/app/pages/theming/examples/component-config/theming-component-config.example.html +13 -0
  49. package/projects/documentation/src/app/pages/theming/examples/component-config/theming-component-config.example.ts +20 -0
  50. package/projects/documentation/src/app/pages/theming/examples/css-override/theming-css-override.example.html +8 -0
  51. package/projects/documentation/src/app/pages/theming/examples/css-override/theming-css-override.example.scss +4 -0
  52. package/projects/documentation/src/app/pages/theming/examples/css-override/theming-css-override.example.ts +11 -0
  53. package/projects/documentation/src/app/pages/theming/examples/custom-tokens/theming-custom-tokens.example.html +13 -0
  54. package/projects/documentation/src/app/pages/theming/examples/custom-tokens/theming-custom-tokens.example.ts +33 -0
  55. package/projects/documentation/src/app/pages/theming/examples/global-theme/theming-global-theme.example.html +6 -0
  56. package/projects/documentation/src/app/pages/theming/examples/global-theme/theming-global-theme.example.ts +20 -0
  57. package/projects/documentation/src/app/pages/theming/examples/light-dark/theming-light-dark.example.html +15 -0
  58. package/projects/documentation/src/app/pages/theming/examples/light-dark/theming-light-dark.example.ts +31 -0
  59. package/projects/documentation/src/app/pages/theming/theming-component-config.page.ts +52 -0
  60. package/projects/documentation/src/app/pages/theming/theming-css-variables.page.ts +71 -0
  61. package/projects/documentation/src/app/pages/theming/theming-tokens.page.ts +56 -0
  62. package/projects/documentation/src/app/pages/theming/theming.data.ts +947 -0
  63. package/projects/documentation/src/app/pages/theming/theming.page.html +56 -0
  64. package/projects/documentation/src/app/pages/theming/theming.page.ts +144 -0
  65. package/projects/documentation/src/app/routes/app.routes.ts +63 -15
  66. package/projects/documentation/src/app/services/doc-customize.service.ts +12 -0
  67. package/projects/documentation/src/styles.scss +12 -0
@@ -0,0 +1,56 @@
1
+ <docs-layout
2
+ title="Theming"
3
+ description="Three layers with a fixed precedence: CSS variables, theme tokens, then component config. Tokens and config can be scoped with dasar-theme-provider or applied globally with setGlobalTheme."
4
+ [apiData]="apiProps"
5
+ >
6
+ <doc-example-component
7
+ [codes]="[
8
+ { label: 'HTML', lang: 'html', value: customTokensHtml },
9
+ { label: 'TypeScript', lang: 'typescript', value: customTokensTs },
10
+ ]"
11
+ title="Custom Tokens"
12
+ >
13
+ <app-theming-custom-tokens-example />
14
+ </doc-example-component>
15
+
16
+ <doc-example-component
17
+ [codes]="[
18
+ { label: 'HTML', lang: 'html', value: componentConfigHtml },
19
+ { label: 'TypeScript', lang: 'typescript', value: componentConfigTs },
20
+ ]"
21
+ title="Component Config"
22
+ >
23
+ <app-theming-component-config-example />
24
+ </doc-example-component>
25
+
26
+ <doc-example-component
27
+ [codes]="[
28
+ { label: 'HTML', lang: 'html', value: lightDarkHtml },
29
+ { label: 'TypeScript', lang: 'typescript', value: lightDarkTs },
30
+ ]"
31
+ title="Light & Dark"
32
+ >
33
+ <app-theming-light-dark-example />
34
+ </doc-example-component>
35
+
36
+ <doc-example-component
37
+ [codes]="[
38
+ { label: 'HTML', lang: 'html', value: globalThemeHtml },
39
+ { label: 'TypeScript', lang: 'typescript', value: globalThemeTs },
40
+ ]"
41
+ title="Global Theme"
42
+ >
43
+ <app-theming-global-theme-example />
44
+ </doc-example-component>
45
+
46
+ <doc-example-component
47
+ [codes]="[
48
+ { label: 'HTML', lang: 'html', value: cssOverrideHtml },
49
+ { label: 'TypeScript', lang: 'typescript', value: cssOverrideTs },
50
+ { label: 'CSS', lang: 'css', value: cssOverrideCss },
51
+ ]"
52
+ title="CSS Override"
53
+ >
54
+ <app-theming-css-override-example />
55
+ </doc-example-component>
56
+ </docs-layout>
@@ -0,0 +1,144 @@
1
+ import { Component } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { DocsLayoutComponent, DocApiProperty } from '../../layouts/doc.layout';
4
+ import { DocExampleComponent } from '../../components/doc-example.component';
5
+
6
+ import { ThemingCustomTokensExample } from './examples/custom-tokens/theming-custom-tokens.example';
7
+ import { ThemingComponentConfigExample } from './examples/component-config/theming-component-config.example';
8
+ import { ThemingLightDarkExample } from './examples/light-dark/theming-light-dark.example';
9
+ import { ThemingGlobalThemeExample } from './examples/global-theme/theming-global-theme.example';
10
+ import { ThemingCssOverrideExample } from './examples/css-override/theming-css-override.example';
11
+
12
+ // @ts-ignore
13
+ import customTokensHtml from './examples/custom-tokens/theming-custom-tokens.example.html' with {
14
+ loader: 'text',
15
+ };
16
+ // @ts-ignore
17
+ import customTokensTs from './examples/custom-tokens/theming-custom-tokens.example.ts' with {
18
+ loader: 'text',
19
+ };
20
+
21
+ // @ts-ignore
22
+ import componentConfigHtml from './examples/component-config/theming-component-config.example.html' with {
23
+ loader: 'text',
24
+ };
25
+ // @ts-ignore
26
+ import componentConfigTs from './examples/component-config/theming-component-config.example.ts' with {
27
+ loader: 'text',
28
+ };
29
+
30
+ // @ts-ignore
31
+ import lightDarkHtml from './examples/light-dark/theming-light-dark.example.html' with {
32
+ loader: 'text',
33
+ };
34
+ // @ts-ignore
35
+ import lightDarkTs from './examples/light-dark/theming-light-dark.example.ts' with {
36
+ loader: 'text',
37
+ };
38
+
39
+ // @ts-ignore
40
+ import globalThemeHtml from './examples/global-theme/theming-global-theme.example.html' with {
41
+ loader: 'text',
42
+ };
43
+ // @ts-ignore
44
+ import globalThemeTs from './examples/global-theme/theming-global-theme.example.ts' with {
45
+ loader: 'text',
46
+ };
47
+
48
+ // @ts-ignore
49
+ import cssOverrideHtml from './examples/css-override/theming-css-override.example.html' with {
50
+ loader: 'text',
51
+ };
52
+ // @ts-ignore
53
+ import cssOverrideTs from './examples/css-override/theming-css-override.example.ts' with {
54
+ loader: 'text',
55
+ };
56
+ // @ts-ignore
57
+ import cssOverrideCss from './examples/css-override/theming-css-override.example.scss' with {
58
+ loader: 'text',
59
+ };
60
+
61
+ @Component({
62
+ imports: [
63
+ CommonModule,
64
+ DocsLayoutComponent,
65
+ DocExampleComponent,
66
+ ThemingCustomTokensExample,
67
+ ThemingComponentConfigExample,
68
+ ThemingLightDarkExample,
69
+ ThemingGlobalThemeExample,
70
+ ThemingCssOverrideExample,
71
+ ],
72
+ templateUrl: './theming.page.html',
73
+ selector: 'app-theming-page',
74
+ standalone: true,
75
+ })
76
+ export class ThemingDocPage {
77
+ protected customTokensHtml = customTokensHtml;
78
+ protected customTokensTs = customTokensTs;
79
+
80
+ protected componentConfigHtml = componentConfigHtml;
81
+ protected componentConfigTs = componentConfigTs;
82
+
83
+ protected lightDarkHtml = lightDarkHtml;
84
+ protected lightDarkTs = lightDarkTs;
85
+
86
+ protected globalThemeHtml = globalThemeHtml;
87
+ protected globalThemeTs = globalThemeTs;
88
+
89
+ protected cssOverrideHtml = cssOverrideHtml;
90
+ protected cssOverrideTs = cssOverrideTs;
91
+ protected cssOverrideCss = cssOverrideCss as unknown as string;
92
+
93
+ protected readonly apiProps: DocApiProperty[] = [
94
+ {
95
+ name: 'CSS variables',
96
+ type: 'layer 1',
97
+ defaultValue: '-',
98
+ description:
99
+ 'Lowest level. Every component reads var(--<component>-*) with a fallback. Override them in plain CSS, optionally scoped to a wrapper class. Full list on the CSS Variables page.',
100
+ },
101
+ {
102
+ name: 'theme tokens',
103
+ type: 'layer 2',
104
+ defaultValue: '-',
105
+ description:
106
+ 'Middle level. Token keys map to CSS variables through the *Map objects (for example listMap). Set them per mode with tokens.light / tokens.dark in setGlobalTheme or [tokenConfig]. Full list on the Theme Tokens page.',
107
+ },
108
+ {
109
+ name: 'component config',
110
+ type: 'layer 3',
111
+ defaultValue: '-',
112
+ description:
113
+ 'Highest level. Defaults for inputs such as size, appearance or bordered, set with components in setGlobalTheme or [componentConfig]. Explicit inputs on a component always win. Full list on the Component Config page.',
114
+ },
115
+ {
116
+ name: '[tokenConfig]',
117
+ type: "DasarThemeConfig['tokens']",
118
+ defaultValue: '-',
119
+ description:
120
+ 'On dasar-theme-provider. Scoped tokens: { light: { button: { ... } }, dark: { ... } }.',
121
+ },
122
+ {
123
+ name: '[componentConfig]',
124
+ type: 'DasarComponentConfig',
125
+ defaultValue: '-',
126
+ description:
127
+ 'On dasar-theme-provider. Scoped defaults: { button: { appearance: "outline" } }.',
128
+ },
129
+ {
130
+ name: '[mode]',
131
+ type: "'light' | 'dark'",
132
+ defaultValue: "'light'",
133
+ description:
134
+ 'On dasar-theme-provider. Picks the light or dark token set and toggles data-theme="dark".',
135
+ },
136
+ {
137
+ name: 'setGlobalTheme',
138
+ type: 'DasarThemeService method',
139
+ defaultValue: '-',
140
+ description:
141
+ 'Global theming: setGlobalTheme({ mode, colors, components, tokens }, targetElement?). Writes variables onto document.documentElement by default.',
142
+ },
143
+ ];
144
+ }
@@ -1,87 +1,135 @@
1
+ import { ThemingComponentConfigDocPage } from '../pages/theming/theming-component-config.page';
2
+ import { ThemingCssVariablesDocPage } from '../pages/theming/theming-css-variables.page';
3
+ import { GettingStartedDocPage } from '../pages/getting-started/getting-started.page';
4
+ import { IntroductionDocPage } from '../pages/introduction/introduction.page';
5
+ import { InstallationDocPage } from '../pages/installation/installation.page';
1
6
  import { NumberInputDocPage } from '../pages/number-input/number-input.page';
7
+ import { ThemingTokensDocPage } from '../pages/theming/theming-tokens.page';
2
8
  import { DatepickerDocPage } from '../pages/datepicker/datepicker.page';
3
9
  import { CalendarDocPage } from '../pages/calendar/calendar.page';
10
+ import { ThemingDocPage } from '../pages/theming/theming.page';
4
11
  import { ButtonDocPage } from '../pages/button/button.page';
5
12
  import { SelectDocPage } from '../pages/select/select.page';
6
13
  import { InputDocPage } from '../pages/input/input.page';
7
14
  import { TableDocPage } from '../pages/table/table.page';
15
+ import { ModalDocPage } from '../pages/modal/modal.page';
8
16
  import { ChipDocPage } from '../pages/chip/chip.page';
9
17
  import { IconDocPage } from '../pages/icon/icon.page';
10
18
  import { CardDocPage } from '../pages/card/card.page';
11
19
  import { MenuDocPage } from '../pages/menu/menu.page';
12
- import { ModalDocPage } from '../pages/modal/modal.page';
13
20
  import { TabsDocPage } from '../pages/tabs/tabs.page';
21
+ import { ListDocPage } from '../pages/list/list.page';
14
22
  import { Routes } from '@angular/router';
15
23
 
16
24
  export const routes: Routes = [
17
25
  {
18
26
  path: '',
19
- redirectTo: 'components/button',
27
+ redirectTo: 'introduction',
20
28
  pathMatch: 'full',
21
29
  },
30
+ {
31
+ path: 'introduction',
32
+ component: IntroductionDocPage,
33
+ title: 'Introduction | Dasar UI',
34
+ },
35
+ {
36
+ path: 'installation',
37
+ component: InstallationDocPage,
38
+ title: 'Installation | Dasar UI',
39
+ },
40
+ {
41
+ path: 'getting-started',
42
+ component: GettingStartedDocPage,
43
+ title: 'Getting Started | Dasar UI',
44
+ },
45
+ {
46
+ path: 'theming',
47
+ component: ThemingDocPage,
48
+ title: 'Theming | Dasar UI',
49
+ },
50
+ {
51
+ path: 'theming/tokens',
52
+ component: ThemingTokensDocPage,
53
+ title: 'Theme Tokens | Dasar UI',
54
+ },
55
+ {
56
+ path: 'theming/css-variables',
57
+ component: ThemingCssVariablesDocPage,
58
+ title: 'CSS Variables | Dasar UI',
59
+ },
60
+ {
61
+ path: 'theming/component-config',
62
+ component: ThemingComponentConfigDocPage,
63
+ title: 'Component Config | Dasar UI',
64
+ },
22
65
  {
23
66
  path: 'components/button',
24
67
  component: ButtonDocPage,
25
- title: 'Button Docs',
68
+ title: 'Button Docs | Dasar UI',
26
69
  },
27
70
  {
28
71
  path: 'components/icon',
29
72
  component: IconDocPage,
30
- title: 'Icon Docs',
73
+ title: 'Icon Docs | Dasar UI',
31
74
  },
32
75
  {
33
76
  path: 'components/chip',
34
77
  component: ChipDocPage,
35
- title: 'Chip Docs',
78
+ title: 'Chip Docs | Dasar UI',
36
79
  },
37
80
  {
38
81
  path: 'components/card',
39
82
  component: CardDocPage,
40
- title: 'Card Docs',
83
+ title: 'Card Docs | Dasar UI',
41
84
  },
42
85
  {
43
86
  path: 'components/modal',
44
87
  component: ModalDocPage,
45
- title: 'Modal Docs',
88
+ title: 'Modal Docs | Dasar UI',
46
89
  },
47
90
  {
48
91
  path: 'components/tabs',
49
92
  component: TabsDocPage,
50
- title: 'Tabs Docs',
93
+ title: 'Tabs Docs | Dasar UI',
94
+ },
95
+ {
96
+ path: 'components/list',
97
+ component: ListDocPage,
98
+ title: 'List Docs | Dasar UI',
51
99
  },
52
100
  {
53
101
  path: 'components/calendar',
54
102
  component: CalendarDocPage,
55
- title: 'Calendar Docs',
103
+ title: 'Calendar Docs | Dasar UI',
56
104
  },
57
105
  {
58
106
  path: 'components/datepicker',
59
107
  component: DatepickerDocPage,
60
- title: 'Datepicker Docs',
108
+ title: 'Datepicker Docs | Dasar UI',
61
109
  },
62
110
  {
63
111
  path: 'components/table',
64
112
  component: TableDocPage,
65
- title: 'Table Docs',
113
+ title: 'Table Docs | Dasar UI',
66
114
  },
67
115
  {
68
116
  path: 'components/select',
69
117
  component: SelectDocPage,
70
- title: 'Select Docs',
118
+ title: 'Select Docs | Dasar UI',
71
119
  },
72
120
  {
73
121
  path: 'components/input',
74
122
  component: InputDocPage,
75
- title: 'Input Docs',
123
+ title: 'Input Docs | Dasar UI',
76
124
  },
77
125
  {
78
126
  path: 'components/number-input',
79
127
  component: NumberInputDocPage,
80
- title: 'Number Input Docs',
128
+ title: 'Number Input Docs | Dasar UI',
81
129
  },
82
130
  {
83
131
  path: 'components/menu',
84
132
  component: MenuDocPage,
85
- title: 'Menu Docs',
133
+ title: 'Menu Docs | Dasar UI',
86
134
  },
87
135
  ];
@@ -14,6 +14,9 @@ export interface DocCustomizeSettings {
14
14
  tabsAppearance: 'solid' | 'subtle' | 'outline' | null;
15
15
  tabsSize: DocSize | null;
16
16
  tabsSpacing: 'normal' | 'compact' | null;
17
+ listSize: 'sm' | 'md' | 'lg' | null;
18
+ listBordered: boolean | null;
19
+ listDivider: boolean | null;
17
20
  primaryColor: string | null;
18
21
  fontSizeBase: string | null;
19
22
  fontSans: string | null;
@@ -28,6 +31,9 @@ export const DOC_DEFAULT_SETTINGS: DocCustomizeSettings = {
28
31
  tabsAppearance: null,
29
32
  tabsSize: null,
30
33
  tabsSpacing: null,
34
+ listSize: null,
35
+ listBordered: null,
36
+ listDivider: null,
31
37
  primaryColor: null,
32
38
  fontSizeBase: null,
33
39
  fontSans: null,
@@ -58,6 +64,12 @@ export class DocCustomizeService {
58
64
  if (s.tabsSize) config.tabs.size = s.tabsSize;
59
65
  if (s.tabsSpacing) config.tabs.spacing = s.tabsSpacing;
60
66
  }
67
+ if (s.listSize || s.listBordered !== null || s.listDivider !== null) {
68
+ config.list = {};
69
+ if (s.listSize) config.list.size = s.listSize;
70
+ if (s.listBordered !== null) config.list.bordered = s.listBordered;
71
+ if (s.listDivider !== null) config.list.showDivider = s.listDivider;
72
+ }
61
73
  return config;
62
74
  });
63
75
 
@@ -5,3 +5,15 @@ body {
5
5
  margin: 0;
6
6
  padding: 0;
7
7
  }
8
+
9
+ .docs-navbar-actions {
10
+ display: flex;
11
+ gap: 8px;
12
+ align-items: center;
13
+ }
14
+
15
+ @media (max-width: 640px) {
16
+ .docs-navbar-actions dasar-chip {
17
+ display: none;
18
+ }
19
+ }