dasar-ui 1.1.0 → 1.3.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.
- package/README.md +19 -14
- package/fesm2022/dasar-ui.mjs +9664 -0
- package/fesm2022/dasar-ui.mjs.map +1 -0
- package/package.json +39 -42
- package/types/dasar-ui.d.ts +2114 -0
- package/.editorconfig +0 -17
- package/.nvmrc +0 -1
- package/.prettierrc +0 -12
- package/.vscode/extensions.json +0 -4
- package/.vscode/launch.json +0 -20
- package/.vscode/settings.json +0 -4
- package/.vscode/tasks.json +0 -42
- package/CHANGELOG.md +0 -18
- package/angular.json +0 -37
- package/projects/dasar-ui/README.md +0 -64
- package/projects/dasar-ui/ng-package.json +0 -10
- package/projects/dasar-ui/package.json +0 -27
- package/projects/dasar-ui/src/lib/components/dasar-button/dasar-button.html +0 -9
- package/projects/dasar-ui/src/lib/components/dasar-button/dasar-button.scss +0 -352
- package/projects/dasar-ui/src/lib/components/dasar-button/dasar-button.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-button/dasar-button.ts +0 -154
- package/projects/dasar-ui/src/lib/components/dasar-button-group/dasar-button-group.html +0 -1
- package/projects/dasar-ui/src/lib/components/dasar-button-group/dasar-button-group.scss +0 -69
- package/projects/dasar-ui/src/lib/components/dasar-button-group/dasar-button-group.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-button-group/dasar-button-group.ts +0 -30
- package/projects/dasar-ui/src/lib/components/dasar-calendar/dasar-calendar.html +0 -158
- package/projects/dasar-ui/src/lib/components/dasar-calendar/dasar-calendar.scss +0 -371
- package/projects/dasar-ui/src/lib/components/dasar-calendar/dasar-calendar.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-calendar/dasar-calendar.ts +0 -458
- package/projects/dasar-ui/src/lib/components/dasar-card/dasar-card.html +0 -80
- package/projects/dasar-ui/src/lib/components/dasar-card/dasar-card.scss +0 -184
- package/projects/dasar-ui/src/lib/components/dasar-card/dasar-card.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-card/dasar-card.ts +0 -294
- package/projects/dasar-ui/src/lib/components/dasar-chip/dasar-chip.html +0 -42
- package/projects/dasar-ui/src/lib/components/dasar-chip/dasar-chip.scss +0 -38
- package/projects/dasar-ui/src/lib/components/dasar-chip/dasar-chip.ts +0 -207
- package/projects/dasar-ui/src/lib/components/dasar-datepicker/dasar-datepicker.html +0 -102
- package/projects/dasar-ui/src/lib/components/dasar-datepicker/dasar-datepicker.scss +0 -301
- package/projects/dasar-ui/src/lib/components/dasar-datepicker/dasar-datepicker.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-datepicker/dasar-datepicker.ts +0 -527
- package/projects/dasar-ui/src/lib/components/dasar-icon/dasar-icon.html +0 -1
- package/projects/dasar-ui/src/lib/components/dasar-icon/dasar-icon.registry.ts +0 -5089
- package/projects/dasar-ui/src/lib/components/dasar-icon/dasar-icon.scss +0 -24
- package/projects/dasar-ui/src/lib/components/dasar-icon/dasar-icon.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-icon/dasar-icon.ts +0 -97
- package/projects/dasar-ui/src/lib/components/dasar-input/dasar-input.html +0 -54
- package/projects/dasar-ui/src/lib/components/dasar-input/dasar-input.scss +0 -281
- package/projects/dasar-ui/src/lib/components/dasar-input/dasar-input.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-input/dasar-input.ts +0 -323
- package/projects/dasar-ui/src/lib/components/dasar-menu/dasar-menu.html +0 -63
- package/projects/dasar-ui/src/lib/components/dasar-menu/dasar-menu.scss +0 -195
- package/projects/dasar-ui/src/lib/components/dasar-menu/dasar-menu.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-menu/dasar-menu.ts +0 -240
- package/projects/dasar-ui/src/lib/components/dasar-number-input/dasar-number-input.html +0 -90
- package/projects/dasar-ui/src/lib/components/dasar-number-input/dasar-number-input.scss +0 -358
- package/projects/dasar-ui/src/lib/components/dasar-number-input/dasar-number-input.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-number-input/dasar-number-input.ts +0 -337
- package/projects/dasar-ui/src/lib/components/dasar-pagination/dasar-pagination.html +0 -98
- package/projects/dasar-ui/src/lib/components/dasar-pagination/dasar-pagination.scss +0 -51
- package/projects/dasar-ui/src/lib/components/dasar-pagination/dasar-pagination.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-pagination/dasar-pagination.ts +0 -99
- package/projects/dasar-ui/src/lib/components/dasar-pin/dasar-pin.css +0 -0
- package/projects/dasar-ui/src/lib/components/dasar-pin/dasar-pin.html +0 -1
- package/projects/dasar-ui/src/lib/components/dasar-pin/dasar-pin.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-pin/dasar-pin.ts +0 -9
- package/projects/dasar-ui/src/lib/components/dasar-pivot-table/dasar-pivot-table.html +0 -163
- package/projects/dasar-ui/src/lib/components/dasar-pivot-table/dasar-pivot-table.scss +0 -283
- package/projects/dasar-ui/src/lib/components/dasar-pivot-table/dasar-pivot-table.ts +0 -230
- package/projects/dasar-ui/src/lib/components/dasar-radio/dasar-radio.css +0 -0
- package/projects/dasar-ui/src/lib/components/dasar-radio/dasar-radio.html +0 -1
- package/projects/dasar-ui/src/lib/components/dasar-radio/dasar-radio.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-radio/dasar-radio.ts +0 -9
- package/projects/dasar-ui/src/lib/components/dasar-select/dasar-select.html +0 -185
- package/projects/dasar-ui/src/lib/components/dasar-select/dasar-select.scss +0 -347
- package/projects/dasar-ui/src/lib/components/dasar-select/dasar-select.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-select/dasar-select.ts +0 -497
- package/projects/dasar-ui/src/lib/components/dasar-slider/dasar-slider.css +0 -0
- package/projects/dasar-ui/src/lib/components/dasar-slider/dasar-slider.html +0 -1
- package/projects/dasar-ui/src/lib/components/dasar-slider/dasar-slider.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-slider/dasar-slider.ts +0 -9
- package/projects/dasar-ui/src/lib/components/dasar-table/dasar-table.html +0 -162
- package/projects/dasar-ui/src/lib/components/dasar-table/dasar-table.scss +0 -283
- package/projects/dasar-ui/src/lib/components/dasar-table/dasar-table.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-table/dasar-table.ts +0 -380
- package/projects/dasar-ui/src/lib/components/dasar-tabs/dasar-tabs.html +0 -41
- package/projects/dasar-ui/src/lib/components/dasar-tabs/dasar-tabs.scss +0 -126
- package/projects/dasar-ui/src/lib/components/dasar-tabs/dasar-tabs.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-tabs/dasar-tabs.ts +0 -72
- package/projects/dasar-ui/src/lib/components/dasar-textarea/dasar-textarea.html +0 -43
- package/projects/dasar-ui/src/lib/components/dasar-textarea/dasar-textarea.scss +0 -189
- package/projects/dasar-ui/src/lib/components/dasar-textarea/dasar-textarea.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-textarea/dasar-textarea.ts +0 -139
- package/projects/dasar-ui/src/lib/components/dasar-theme-provider/dasar-theme-provider.ts +0 -286
- package/projects/dasar-ui/src/lib/components/dasar-toast/dasar-toast.css +0 -0
- package/projects/dasar-ui/src/lib/components/dasar-toast/dasar-toast.html +0 -1
- package/projects/dasar-ui/src/lib/components/dasar-toast/dasar-toast.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-toast/dasar-toast.ts +0 -9
- package/projects/dasar-ui/src/lib/components/dasar-toggle/dasar-toggle.css +0 -0
- package/projects/dasar-ui/src/lib/components/dasar-toggle/dasar-toggle.html +0 -1
- package/projects/dasar-ui/src/lib/components/dasar-toggle/dasar-toggle.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-toggle/dasar-toggle.ts +0 -9
- package/projects/dasar-ui/src/lib/components/dasar-tooltip/dasar-tooltip.css +0 -0
- package/projects/dasar-ui/src/lib/components/dasar-tooltip/dasar-tooltip.html +0 -1
- package/projects/dasar-ui/src/lib/components/dasar-tooltip/dasar-tooltip.spec.ts +0 -21
- package/projects/dasar-ui/src/lib/components/dasar-tooltip/dasar-tooltip.ts +0 -9
- package/projects/dasar-ui/src/lib/models/theme.model.ts +0 -643
- package/projects/dasar-ui/src/lib/models/type.model.ts +0 -11
- package/projects/dasar-ui/src/lib/services/theme.service.ts +0 -643
- package/projects/dasar-ui/src/lib/styles/theme.ts +0 -70
- package/projects/dasar-ui/src/lib/utils/common.ts +0 -175
- package/projects/dasar-ui/src/public-api.ts +0 -23
- package/projects/dasar-ui/tsconfig.lib.json +0 -21
- package/projects/dasar-ui/tsconfig.lib.prod.json +0 -11
- package/projects/dasar-ui/tsconfig.spec.json +0 -11
- package/tsconfig.json +0 -37
- /package/{projects/dasar-ui/src/lib/styles → styles}/theme.scss +0 -0
|
@@ -1,286 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DasarComponentConfig,
|
|
3
|
-
DasarThemeConfig,
|
|
4
|
-
DasarThemeColors,
|
|
5
|
-
DasarThemeMode,
|
|
6
|
-
DasarThemeCommon,
|
|
7
|
-
} from '@models/theme.model';
|
|
8
|
-
import {
|
|
9
|
-
datepickerMap,
|
|
10
|
-
calendarMap,
|
|
11
|
-
selectMap,
|
|
12
|
-
buttonMap,
|
|
13
|
-
commonMap,
|
|
14
|
-
inputMap,
|
|
15
|
-
chipMap,
|
|
16
|
-
cardMap,
|
|
17
|
-
menuMap,
|
|
18
|
-
} from '../../services/theme.service';
|
|
19
|
-
import {
|
|
20
|
-
InjectionToken,
|
|
21
|
-
SimpleChanges,
|
|
22
|
-
ElementRef,
|
|
23
|
-
forwardRef,
|
|
24
|
-
Component,
|
|
25
|
-
OnChanges,
|
|
26
|
-
Input,
|
|
27
|
-
inject,
|
|
28
|
-
effect,
|
|
29
|
-
signal,
|
|
30
|
-
} from '@angular/core';
|
|
31
|
-
import { dasarVariables, dasarVariablesTypography } from '../../styles/theme';
|
|
32
|
-
import { CommonModule } from '@angular/common';
|
|
33
|
-
|
|
34
|
-
export const DASAR_THEME_PROVIDER = new InjectionToken<DasarThemeProviderComponent>(
|
|
35
|
-
'DASAR_THEME_PROVIDER',
|
|
36
|
-
);
|
|
37
|
-
export const defaultLightCommonTokens: DasarThemeCommon = {
|
|
38
|
-
...dasarVariablesTypography,
|
|
39
|
-
primaryColor: dasarVariables.colors.primary.base,
|
|
40
|
-
primaryHoverColor: dasarVariables.colors.primary[700],
|
|
41
|
-
primaryActiveColor: dasarVariables.colors.primary[800],
|
|
42
|
-
primarySurfaceColor: dasarVariables.colors.primary[50],
|
|
43
|
-
textPrimaryColor: dasarVariables.colors.neutral[900],
|
|
44
|
-
textSecondaryColor: dasarVariables.colors.neutral[500],
|
|
45
|
-
textDisabledColor: dasarVariables.colors.neutral[400],
|
|
46
|
-
textInverseColor: dasarVariables.colors.neutral[50],
|
|
47
|
-
bgWindowColor: dasarVariables.colors.neutral[50],
|
|
48
|
-
bgDefaultColor: dasarVariables.colors.neutral[50],
|
|
49
|
-
bgSurfaceColor: dasarVariables.colors.neutral[50],
|
|
50
|
-
bgHoverColor: dasarVariables.colors.neutral[100],
|
|
51
|
-
borderSubtleColor: dasarVariables.colors.neutral[200],
|
|
52
|
-
borderStrongColor: dasarVariables.colors.neutral[300],
|
|
53
|
-
};
|
|
54
|
-
export const defaultDarkCommonTokens: DasarThemeCommon = {
|
|
55
|
-
...dasarVariablesTypography,
|
|
56
|
-
primaryColor: dasarVariables.colors.primary[300],
|
|
57
|
-
primaryHoverColor: dasarVariables.colors.primary[200],
|
|
58
|
-
primaryActiveColor: dasarVariables.colors.primary[100],
|
|
59
|
-
primarySurfaceColor: 'rgba(96, 165, 250, 0.1)',
|
|
60
|
-
textPrimaryColor: dasarVariables.colors.neutral[50],
|
|
61
|
-
textSecondaryColor: dasarVariables.colors.neutral[300],
|
|
62
|
-
textDisabledColor: dasarVariables.colors.neutral[500],
|
|
63
|
-
textInverseColor: dasarVariables.colors.neutral[900],
|
|
64
|
-
bgWindowColor: dasarVariables.colors.neutral[900],
|
|
65
|
-
bgDefaultColor: dasarVariables.colors.neutral[900],
|
|
66
|
-
bgSurfaceColor: dasarVariables.colors.neutral[800],
|
|
67
|
-
bgHoverColor: dasarVariables.colors.neutral[700],
|
|
68
|
-
borderSubtleColor: dasarVariables.colors.neutral[700],
|
|
69
|
-
borderStrongColor: dasarVariables.colors.neutral[700],
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
@Component({
|
|
73
|
-
imports: [CommonModule],
|
|
74
|
-
selector: 'dasar-theme-provider',
|
|
75
|
-
standalone: true,
|
|
76
|
-
host: {
|
|
77
|
-
'[attr.data-theme]': 'activeMode()',
|
|
78
|
-
},
|
|
79
|
-
template: `
|
|
80
|
-
<div class="dasar-theme-wrapper">
|
|
81
|
-
<ng-content></ng-content>
|
|
82
|
-
</div>
|
|
83
|
-
`,
|
|
84
|
-
styles: [
|
|
85
|
-
`
|
|
86
|
-
:host {
|
|
87
|
-
display: block;
|
|
88
|
-
height: 100%;
|
|
89
|
-
padding: 0;
|
|
90
|
-
margin: 0;
|
|
91
|
-
}
|
|
92
|
-
.dasar-theme-wrapper {
|
|
93
|
-
background-color: var(--theme-bg-window-color);
|
|
94
|
-
font-weight: var(--font-weight-regular);
|
|
95
|
-
line-height: var(--line-height-normal);
|
|
96
|
-
font-size: var(--font-size-base);
|
|
97
|
-
color: var(--theme-text-color);
|
|
98
|
-
font-family: var(--font-sans);
|
|
99
|
-
transition: background-color 0.3s ease;
|
|
100
|
-
-webkit-font-smoothing: antialiased;
|
|
101
|
-
-moz-osx-font-smoothing: grayscale;
|
|
102
|
-
display: block;
|
|
103
|
-
height: 100%;
|
|
104
|
-
padding: 0;
|
|
105
|
-
margin: 0;
|
|
106
|
-
}
|
|
107
|
-
`,
|
|
108
|
-
],
|
|
109
|
-
providers: [
|
|
110
|
-
{
|
|
111
|
-
provide: DASAR_THEME_PROVIDER,
|
|
112
|
-
useExisting: forwardRef(() => DasarThemeProviderComponent),
|
|
113
|
-
},
|
|
114
|
-
],
|
|
115
|
-
})
|
|
116
|
-
export class DasarThemeProviderComponent implements OnChanges {
|
|
117
|
-
private parentProvider = inject(DASAR_THEME_PROVIDER, { optional: true, skipSelf: true });
|
|
118
|
-
public activeMode = signal<DasarThemeMode>('light');
|
|
119
|
-
private previouslyInjectedVars: string[] = [];
|
|
120
|
-
|
|
121
|
-
@Input() componentConfig?: DasarComponentConfig;
|
|
122
|
-
@Input() tokenConfig?: DasarThemeConfig['tokens'];
|
|
123
|
-
@Input() colorConfig?: DasarThemeConfig['colors'];
|
|
124
|
-
@Input() mode: DasarThemeMode = 'light';
|
|
125
|
-
|
|
126
|
-
constructor(private el: ElementRef) {
|
|
127
|
-
if (this.parentProvider) {
|
|
128
|
-
effect(() => {
|
|
129
|
-
const parentMode = this.parentProvider!.activeMode();
|
|
130
|
-
const hostElement = this.el.nativeElement;
|
|
131
|
-
this.activeMode.set(parentMode);
|
|
132
|
-
this.applyTokenConfig(hostElement);
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
ngOnChanges(changes: SimpleChanges) {
|
|
138
|
-
const hostElement = this.el.nativeElement;
|
|
139
|
-
if (changes['mode'] && !this.parentProvider) {
|
|
140
|
-
this.activeMode.set(this.mode);
|
|
141
|
-
this.applyTokenConfig(hostElement);
|
|
142
|
-
}
|
|
143
|
-
if (changes['tokenConfig']) {
|
|
144
|
-
this.applyTokenConfig(hostElement);
|
|
145
|
-
}
|
|
146
|
-
if (changes['colorConfig'] && this.colorConfig) {
|
|
147
|
-
this.injectColors(hostElement, this.colorConfig);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
public getResolvedCommonTokens(mode: DasarThemeMode): DasarThemeCommon {
|
|
152
|
-
const baseCommonTokens = mode === 'light' ? defaultLightCommonTokens : defaultDarkCommonTokens;
|
|
153
|
-
const overrideCommonTokens = this.tokenConfig?.[mode]?.common || {};
|
|
154
|
-
return { ...baseCommonTokens, ...overrideCommonTokens };
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
private applyTokenConfig(hostElement: any) {
|
|
158
|
-
this.previouslyInjectedVars.forEach((cssVar) => {
|
|
159
|
-
hostElement.style.removeProperty(cssVar);
|
|
160
|
-
});
|
|
161
|
-
this.previouslyInjectedVars = [];
|
|
162
|
-
|
|
163
|
-
const currentMode = this.activeMode();
|
|
164
|
-
// const baseCommonTokens =
|
|
165
|
-
// currentMode === 'light' ? defaultLightCommonTokens : defaultDarkCommonTokens;
|
|
166
|
-
// const overrideCommonTokens = this.tokenConfig?.[currentMode]?.common || {};
|
|
167
|
-
// this.injectMappedTokens({
|
|
168
|
-
// payload: { ...baseCommonTokens, ...overrideCommonTokens },
|
|
169
|
-
// element: hostElement,
|
|
170
|
-
// dictionary: commonMap,
|
|
171
|
-
// removable: true,
|
|
172
|
-
// });
|
|
173
|
-
|
|
174
|
-
const baseCommonTokens = this.parentProvider
|
|
175
|
-
? this.parentProvider.getResolvedCommonTokens(currentMode)
|
|
176
|
-
: currentMode === 'light'
|
|
177
|
-
? defaultLightCommonTokens
|
|
178
|
-
: defaultDarkCommonTokens;
|
|
179
|
-
const overrideCommonTokens = this.tokenConfig?.[currentMode]?.common || {};
|
|
180
|
-
const commonTokens = { ...baseCommonTokens, ...overrideCommonTokens };
|
|
181
|
-
if (commonTokens) {
|
|
182
|
-
this.injectMappedTokens({
|
|
183
|
-
element: hostElement,
|
|
184
|
-
payload: commonTokens,
|
|
185
|
-
dictionary: commonMap,
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
// const commonTokens =
|
|
190
|
-
// this.tokenConfig?.[currentMode]?.common ||
|
|
191
|
-
// (currentMode === 'light' ? defaultLightCommonTokens : defaultDarkCommonTokens);
|
|
192
|
-
// if (commonTokens) {
|
|
193
|
-
// this.injectMappedTokens({
|
|
194
|
-
// element: hostElement,
|
|
195
|
-
// payload: commonTokens,
|
|
196
|
-
// dictionary: commonMap,
|
|
197
|
-
// });
|
|
198
|
-
// }
|
|
199
|
-
|
|
200
|
-
const buttonTokens = this.tokenConfig?.[currentMode]?.button || this.tokenConfig?.light?.button;
|
|
201
|
-
if (buttonTokens) {
|
|
202
|
-
this.injectMappedTokens({
|
|
203
|
-
element: hostElement,
|
|
204
|
-
payload: buttonTokens,
|
|
205
|
-
dictionary: buttonMap,
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
const inputTokens = this.tokenConfig?.[currentMode]?.input || this.tokenConfig?.light?.input;
|
|
209
|
-
if (inputTokens) {
|
|
210
|
-
this.injectMappedTokens({ element: hostElement, payload: inputTokens, dictionary: inputMap });
|
|
211
|
-
}
|
|
212
|
-
const calendarTokens =
|
|
213
|
-
this.tokenConfig?.[currentMode]?.calendar || this.tokenConfig?.light?.calendar;
|
|
214
|
-
if (calendarTokens) {
|
|
215
|
-
this.injectMappedTokens({
|
|
216
|
-
element: hostElement,
|
|
217
|
-
payload: calendarTokens,
|
|
218
|
-
dictionary: calendarMap,
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
const datepickerTokens =
|
|
222
|
-
this.tokenConfig?.[currentMode]?.datepicker || this.tokenConfig?.light?.datepicker;
|
|
223
|
-
if (datepickerTokens) {
|
|
224
|
-
this.injectMappedTokens({
|
|
225
|
-
element: hostElement,
|
|
226
|
-
payload: datepickerTokens,
|
|
227
|
-
dictionary: datepickerMap,
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
const chipTokens = this.tokenConfig?.[currentMode]?.chip || this.tokenConfig?.light?.chip;
|
|
231
|
-
if (chipTokens) {
|
|
232
|
-
this.injectMappedTokens({ element: hostElement, payload: chipTokens, dictionary: chipMap });
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
const selectTokens = this.tokenConfig?.[currentMode]?.select || this.tokenConfig?.light?.select;
|
|
236
|
-
if (selectTokens) {
|
|
237
|
-
this.injectMappedTokens({
|
|
238
|
-
element: hostElement,
|
|
239
|
-
payload: selectTokens,
|
|
240
|
-
dictionary: selectMap,
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
const cardTokens = this.tokenConfig?.[currentMode]?.card || this.tokenConfig?.light?.card;
|
|
244
|
-
if (cardTokens) {
|
|
245
|
-
this.injectMappedTokens({ element: hostElement, payload: cardTokens, dictionary: cardMap });
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
const menuTokens = this.tokenConfig?.[currentMode]?.menu || this.tokenConfig?.light?.menu;
|
|
249
|
-
if (menuTokens) {
|
|
250
|
-
this.injectMappedTokens({ element: hostElement, payload: menuTokens, dictionary: menuMap });
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
private injectMappedTokens(params: {
|
|
255
|
-
dictionary: Record<string, string>;
|
|
256
|
-
removable?: boolean;
|
|
257
|
-
element: HTMLElement;
|
|
258
|
-
payload: any;
|
|
259
|
-
}) {
|
|
260
|
-
const removable = params.removable ?? true;
|
|
261
|
-
Object.entries(params.payload).forEach(([key, value]) => {
|
|
262
|
-
const cssVar = params.dictionary[key];
|
|
263
|
-
if (cssVar && value !== undefined && value !== null) {
|
|
264
|
-
params.element.style.setProperty(cssVar, String(value));
|
|
265
|
-
if (removable) {
|
|
266
|
-
this.previouslyInjectedVars.push(cssVar);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
});
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
private injectColors(element: HTMLElement, colors: DasarThemeColors) {
|
|
273
|
-
Object.entries(colors).forEach(([paletteName, shades]) => {
|
|
274
|
-
if (shades && typeof shades === 'object') {
|
|
275
|
-
Object.entries(shades).forEach(([shadeKey, value]) => {
|
|
276
|
-
if (value !== undefined && value !== null) {
|
|
277
|
-
const cssVar = `--dasar-${paletteName}-${shadeKey}`;
|
|
278
|
-
// this.renderer.setStyle(element, cssVar, String(value));
|
|
279
|
-
element.style.setProperty(cssVar, String(value));
|
|
280
|
-
this.previouslyInjectedVars.push(cssVar);
|
|
281
|
-
}
|
|
282
|
-
});
|
|
283
|
-
}
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
|
-
}
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<p>dasar-toast works!</p>
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
import { DasarToast } from './dasar-toast';
|
|
3
|
-
|
|
4
|
-
describe('DasarToast', () => {
|
|
5
|
-
let component: DasarToast;
|
|
6
|
-
let fixture: ComponentFixture<DasarToast>;
|
|
7
|
-
|
|
8
|
-
beforeEach(async () => {
|
|
9
|
-
await TestBed.configureTestingModule({
|
|
10
|
-
imports: [DasarToast],
|
|
11
|
-
}).compileComponents();
|
|
12
|
-
|
|
13
|
-
fixture = TestBed.createComponent(DasarToast);
|
|
14
|
-
component = fixture.componentInstance;
|
|
15
|
-
await fixture.whenStable();
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('should create', () => {
|
|
19
|
-
expect(component).toBeTruthy();
|
|
20
|
-
});
|
|
21
|
-
});
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<p>dasar-toggle works!</p>
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
import { DasarToggle } from './dasar-toggle';
|
|
3
|
-
|
|
4
|
-
describe('DasarToggle', () => {
|
|
5
|
-
let component: DasarToggle;
|
|
6
|
-
let fixture: ComponentFixture<DasarToggle>;
|
|
7
|
-
|
|
8
|
-
beforeEach(async () => {
|
|
9
|
-
await TestBed.configureTestingModule({
|
|
10
|
-
imports: [DasarToggle],
|
|
11
|
-
}).compileComponents();
|
|
12
|
-
|
|
13
|
-
fixture = TestBed.createComponent(DasarToggle);
|
|
14
|
-
component = fixture.componentInstance;
|
|
15
|
-
await fixture.whenStable();
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('should create', () => {
|
|
19
|
-
expect(component).toBeTruthy();
|
|
20
|
-
});
|
|
21
|
-
});
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<p>dasar-tooltip works!</p>
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
import { DasarTooltip } from './dasar-tooltip';
|
|
3
|
-
|
|
4
|
-
describe('DasarTooltip', () => {
|
|
5
|
-
let component: DasarTooltip;
|
|
6
|
-
let fixture: ComponentFixture<DasarTooltip>;
|
|
7
|
-
|
|
8
|
-
beforeEach(async () => {
|
|
9
|
-
await TestBed.configureTestingModule({
|
|
10
|
-
imports: [DasarTooltip],
|
|
11
|
-
}).compileComponents();
|
|
12
|
-
|
|
13
|
-
fixture = TestBed.createComponent(DasarTooltip);
|
|
14
|
-
component = fixture.componentInstance;
|
|
15
|
-
await fixture.whenStable();
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('should create', () => {
|
|
19
|
-
expect(component).toBeTruthy();
|
|
20
|
-
});
|
|
21
|
-
});
|