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.
Files changed (116) hide show
  1. package/README.md +19 -14
  2. package/fesm2022/dasar-ui.mjs +9664 -0
  3. package/fesm2022/dasar-ui.mjs.map +1 -0
  4. package/package.json +39 -42
  5. package/types/dasar-ui.d.ts +2114 -0
  6. package/.editorconfig +0 -17
  7. package/.nvmrc +0 -1
  8. package/.prettierrc +0 -12
  9. package/.vscode/extensions.json +0 -4
  10. package/.vscode/launch.json +0 -20
  11. package/.vscode/settings.json +0 -4
  12. package/.vscode/tasks.json +0 -42
  13. package/CHANGELOG.md +0 -18
  14. package/angular.json +0 -37
  15. package/projects/dasar-ui/README.md +0 -64
  16. package/projects/dasar-ui/ng-package.json +0 -10
  17. package/projects/dasar-ui/package.json +0 -27
  18. package/projects/dasar-ui/src/lib/components/dasar-button/dasar-button.html +0 -9
  19. package/projects/dasar-ui/src/lib/components/dasar-button/dasar-button.scss +0 -352
  20. package/projects/dasar-ui/src/lib/components/dasar-button/dasar-button.spec.ts +0 -21
  21. package/projects/dasar-ui/src/lib/components/dasar-button/dasar-button.ts +0 -154
  22. package/projects/dasar-ui/src/lib/components/dasar-button-group/dasar-button-group.html +0 -1
  23. package/projects/dasar-ui/src/lib/components/dasar-button-group/dasar-button-group.scss +0 -69
  24. package/projects/dasar-ui/src/lib/components/dasar-button-group/dasar-button-group.spec.ts +0 -21
  25. package/projects/dasar-ui/src/lib/components/dasar-button-group/dasar-button-group.ts +0 -30
  26. package/projects/dasar-ui/src/lib/components/dasar-calendar/dasar-calendar.html +0 -158
  27. package/projects/dasar-ui/src/lib/components/dasar-calendar/dasar-calendar.scss +0 -371
  28. package/projects/dasar-ui/src/lib/components/dasar-calendar/dasar-calendar.spec.ts +0 -21
  29. package/projects/dasar-ui/src/lib/components/dasar-calendar/dasar-calendar.ts +0 -458
  30. package/projects/dasar-ui/src/lib/components/dasar-card/dasar-card.html +0 -80
  31. package/projects/dasar-ui/src/lib/components/dasar-card/dasar-card.scss +0 -184
  32. package/projects/dasar-ui/src/lib/components/dasar-card/dasar-card.spec.ts +0 -21
  33. package/projects/dasar-ui/src/lib/components/dasar-card/dasar-card.ts +0 -294
  34. package/projects/dasar-ui/src/lib/components/dasar-chip/dasar-chip.html +0 -42
  35. package/projects/dasar-ui/src/lib/components/dasar-chip/dasar-chip.scss +0 -38
  36. package/projects/dasar-ui/src/lib/components/dasar-chip/dasar-chip.ts +0 -207
  37. package/projects/dasar-ui/src/lib/components/dasar-datepicker/dasar-datepicker.html +0 -102
  38. package/projects/dasar-ui/src/lib/components/dasar-datepicker/dasar-datepicker.scss +0 -301
  39. package/projects/dasar-ui/src/lib/components/dasar-datepicker/dasar-datepicker.spec.ts +0 -21
  40. package/projects/dasar-ui/src/lib/components/dasar-datepicker/dasar-datepicker.ts +0 -527
  41. package/projects/dasar-ui/src/lib/components/dasar-icon/dasar-icon.html +0 -1
  42. package/projects/dasar-ui/src/lib/components/dasar-icon/dasar-icon.registry.ts +0 -5089
  43. package/projects/dasar-ui/src/lib/components/dasar-icon/dasar-icon.scss +0 -24
  44. package/projects/dasar-ui/src/lib/components/dasar-icon/dasar-icon.spec.ts +0 -21
  45. package/projects/dasar-ui/src/lib/components/dasar-icon/dasar-icon.ts +0 -97
  46. package/projects/dasar-ui/src/lib/components/dasar-input/dasar-input.html +0 -54
  47. package/projects/dasar-ui/src/lib/components/dasar-input/dasar-input.scss +0 -281
  48. package/projects/dasar-ui/src/lib/components/dasar-input/dasar-input.spec.ts +0 -21
  49. package/projects/dasar-ui/src/lib/components/dasar-input/dasar-input.ts +0 -323
  50. package/projects/dasar-ui/src/lib/components/dasar-menu/dasar-menu.html +0 -63
  51. package/projects/dasar-ui/src/lib/components/dasar-menu/dasar-menu.scss +0 -195
  52. package/projects/dasar-ui/src/lib/components/dasar-menu/dasar-menu.spec.ts +0 -21
  53. package/projects/dasar-ui/src/lib/components/dasar-menu/dasar-menu.ts +0 -240
  54. package/projects/dasar-ui/src/lib/components/dasar-number-input/dasar-number-input.html +0 -90
  55. package/projects/dasar-ui/src/lib/components/dasar-number-input/dasar-number-input.scss +0 -358
  56. package/projects/dasar-ui/src/lib/components/dasar-number-input/dasar-number-input.spec.ts +0 -21
  57. package/projects/dasar-ui/src/lib/components/dasar-number-input/dasar-number-input.ts +0 -337
  58. package/projects/dasar-ui/src/lib/components/dasar-pagination/dasar-pagination.html +0 -98
  59. package/projects/dasar-ui/src/lib/components/dasar-pagination/dasar-pagination.scss +0 -51
  60. package/projects/dasar-ui/src/lib/components/dasar-pagination/dasar-pagination.spec.ts +0 -21
  61. package/projects/dasar-ui/src/lib/components/dasar-pagination/dasar-pagination.ts +0 -99
  62. package/projects/dasar-ui/src/lib/components/dasar-pin/dasar-pin.css +0 -0
  63. package/projects/dasar-ui/src/lib/components/dasar-pin/dasar-pin.html +0 -1
  64. package/projects/dasar-ui/src/lib/components/dasar-pin/dasar-pin.spec.ts +0 -21
  65. package/projects/dasar-ui/src/lib/components/dasar-pin/dasar-pin.ts +0 -9
  66. package/projects/dasar-ui/src/lib/components/dasar-pivot-table/dasar-pivot-table.html +0 -163
  67. package/projects/dasar-ui/src/lib/components/dasar-pivot-table/dasar-pivot-table.scss +0 -283
  68. package/projects/dasar-ui/src/lib/components/dasar-pivot-table/dasar-pivot-table.ts +0 -230
  69. package/projects/dasar-ui/src/lib/components/dasar-radio/dasar-radio.css +0 -0
  70. package/projects/dasar-ui/src/lib/components/dasar-radio/dasar-radio.html +0 -1
  71. package/projects/dasar-ui/src/lib/components/dasar-radio/dasar-radio.spec.ts +0 -21
  72. package/projects/dasar-ui/src/lib/components/dasar-radio/dasar-radio.ts +0 -9
  73. package/projects/dasar-ui/src/lib/components/dasar-select/dasar-select.html +0 -185
  74. package/projects/dasar-ui/src/lib/components/dasar-select/dasar-select.scss +0 -347
  75. package/projects/dasar-ui/src/lib/components/dasar-select/dasar-select.spec.ts +0 -21
  76. package/projects/dasar-ui/src/lib/components/dasar-select/dasar-select.ts +0 -497
  77. package/projects/dasar-ui/src/lib/components/dasar-slider/dasar-slider.css +0 -0
  78. package/projects/dasar-ui/src/lib/components/dasar-slider/dasar-slider.html +0 -1
  79. package/projects/dasar-ui/src/lib/components/dasar-slider/dasar-slider.spec.ts +0 -21
  80. package/projects/dasar-ui/src/lib/components/dasar-slider/dasar-slider.ts +0 -9
  81. package/projects/dasar-ui/src/lib/components/dasar-table/dasar-table.html +0 -162
  82. package/projects/dasar-ui/src/lib/components/dasar-table/dasar-table.scss +0 -283
  83. package/projects/dasar-ui/src/lib/components/dasar-table/dasar-table.spec.ts +0 -21
  84. package/projects/dasar-ui/src/lib/components/dasar-table/dasar-table.ts +0 -380
  85. package/projects/dasar-ui/src/lib/components/dasar-tabs/dasar-tabs.html +0 -41
  86. package/projects/dasar-ui/src/lib/components/dasar-tabs/dasar-tabs.scss +0 -126
  87. package/projects/dasar-ui/src/lib/components/dasar-tabs/dasar-tabs.spec.ts +0 -21
  88. package/projects/dasar-ui/src/lib/components/dasar-tabs/dasar-tabs.ts +0 -72
  89. package/projects/dasar-ui/src/lib/components/dasar-textarea/dasar-textarea.html +0 -43
  90. package/projects/dasar-ui/src/lib/components/dasar-textarea/dasar-textarea.scss +0 -189
  91. package/projects/dasar-ui/src/lib/components/dasar-textarea/dasar-textarea.spec.ts +0 -21
  92. package/projects/dasar-ui/src/lib/components/dasar-textarea/dasar-textarea.ts +0 -139
  93. package/projects/dasar-ui/src/lib/components/dasar-theme-provider/dasar-theme-provider.ts +0 -286
  94. package/projects/dasar-ui/src/lib/components/dasar-toast/dasar-toast.css +0 -0
  95. package/projects/dasar-ui/src/lib/components/dasar-toast/dasar-toast.html +0 -1
  96. package/projects/dasar-ui/src/lib/components/dasar-toast/dasar-toast.spec.ts +0 -21
  97. package/projects/dasar-ui/src/lib/components/dasar-toast/dasar-toast.ts +0 -9
  98. package/projects/dasar-ui/src/lib/components/dasar-toggle/dasar-toggle.css +0 -0
  99. package/projects/dasar-ui/src/lib/components/dasar-toggle/dasar-toggle.html +0 -1
  100. package/projects/dasar-ui/src/lib/components/dasar-toggle/dasar-toggle.spec.ts +0 -21
  101. package/projects/dasar-ui/src/lib/components/dasar-toggle/dasar-toggle.ts +0 -9
  102. package/projects/dasar-ui/src/lib/components/dasar-tooltip/dasar-tooltip.css +0 -0
  103. package/projects/dasar-ui/src/lib/components/dasar-tooltip/dasar-tooltip.html +0 -1
  104. package/projects/dasar-ui/src/lib/components/dasar-tooltip/dasar-tooltip.spec.ts +0 -21
  105. package/projects/dasar-ui/src/lib/components/dasar-tooltip/dasar-tooltip.ts +0 -9
  106. package/projects/dasar-ui/src/lib/models/theme.model.ts +0 -643
  107. package/projects/dasar-ui/src/lib/models/type.model.ts +0 -11
  108. package/projects/dasar-ui/src/lib/services/theme.service.ts +0 -643
  109. package/projects/dasar-ui/src/lib/styles/theme.ts +0 -70
  110. package/projects/dasar-ui/src/lib/utils/common.ts +0 -175
  111. package/projects/dasar-ui/src/public-api.ts +0 -23
  112. package/projects/dasar-ui/tsconfig.lib.json +0 -21
  113. package/projects/dasar-ui/tsconfig.lib.prod.json +0 -11
  114. package/projects/dasar-ui/tsconfig.spec.json +0 -11
  115. package/tsconfig.json +0 -37
  116. /package/{projects/dasar-ui/src/lib/styles → styles}/theme.scss +0 -0
@@ -1,323 +0,0 @@
1
- import {
2
- booleanAttribute,
3
- Component,
4
- HostBinding,
5
- Input,
6
- forwardRef,
7
- ViewEncapsulation,
8
- TemplateRef,
9
- EventEmitter,
10
- Output,
11
- inject,
12
- ChangeDetectorRef,
13
- Directive,
14
- ContentChild,
15
- } from '@angular/core';
16
- import { ControlValueAccessor, NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
17
- import { CommonModule } from '@angular/common';
18
-
19
- import { DASAR_THEME_PROVIDER } from '../dasar-theme-provider/dasar-theme-provider';
20
- import { ClassType, StyleType, ScaleAttributeType } from '../../models/type.model';
21
- import { DasarThemeService } from '../../services/theme.service';
22
- import { resolveThemeDefault } from '../../utils/common';
23
-
24
- export type DasarInputType = 'text' | 'password' | 'email' | 'number' | 'search' | 'url' | 'tel';
25
- export type DasarInputMaskType = 'thousand' | 'date' | 'decimal' | ((val: string) => string);
26
- export type DasarInputSizeType = Extract<ScaleAttributeType, 'sm' | 'md' | 'lg'>;
27
- export type DasarInputAppearanceType = 'outline' | 'filled';
28
- export type DasarInputRadiusType = ScaleAttributeType;
29
-
30
- export interface DasarInputConfig {
31
- appearance?: DasarInputAppearanceType;
32
- labelRight?: string;
33
- radius?: DasarInputRadiusType;
34
- size?: DasarInputSizeType;
35
- type?: DasarInputType;
36
- mask?: DasarInputMaskType;
37
- hint?: string;
38
- placeholder?: string;
39
- label?: string;
40
- fullWidth?: boolean;
41
- disabled?: boolean;
42
- readonly?: boolean;
43
- fluid?: boolean;
44
- error?: boolean;
45
- containerClass?: ClassType;
46
- inputClass?: ClassType;
47
- hostClass?: ClassType;
48
- hintClass?: ClassType;
49
- containerStyle?: StyleType;
50
- inputStyle?: StyleType;
51
- hostStyle?: StyleType;
52
- hintStyle?: StyleType;
53
- hideOverflow?: boolean;
54
- }
55
-
56
- @Directive({ selector: '[extra-label-slot]', standalone: true })
57
- export class DasarInputExtraLabelSlot {}
58
- @Directive({ selector: '[prefix-slot]', standalone: true })
59
- export class DasarInputPrefixSlot {}
60
- @Directive({ selector: '[suffix-slot]', standalone: true })
61
- export class DasarInputSuffixSlot {}
62
-
63
- @Component({
64
- providers: [
65
- {
66
- provide: NG_VALUE_ACCESSOR,
67
- useExisting: forwardRef(() => DasarInput),
68
- multi: true,
69
- },
70
- ],
71
- encapsulation: ViewEncapsulation.None,
72
- imports: [CommonModule, FormsModule],
73
- templateUrl: './dasar-input.html',
74
- styleUrls: ['./dasar-input.scss'],
75
- selector: 'dasar-input',
76
- standalone: true,
77
- })
78
- export class DasarInput implements ControlValueAccessor {
79
- @ContentChild(DasarInputExtraLabelSlot) extraLabelSlot?: DasarInputExtraLabelSlot;
80
-
81
- private themeProvider = inject(DASAR_THEME_PROVIDER, { optional: true });
82
- private themeService = inject(DasarThemeService, { optional: true });
83
- private cdr = inject(ChangeDetectorRef);
84
-
85
- @Input() appearance: DasarInputAppearanceType = resolveThemeDefault(
86
- 'input',
87
- 'appearance',
88
- 'outline',
89
- this.themeProvider,
90
- this.themeService,
91
- );
92
- @Input({ alias: 'label-right' }) labelRight = resolveThemeDefault(
93
- 'input',
94
- 'labelRight',
95
- undefined,
96
- this.themeProvider,
97
- this.themeService,
98
- );
99
- @Input() radius = resolveThemeDefault(
100
- 'input',
101
- 'radius',
102
- 'md',
103
- this.themeProvider,
104
- this.themeService,
105
- );
106
- @Input() size = resolveThemeDefault('input', 'size', 'md', this.themeProvider, this.themeService);
107
- @Input() type = resolveThemeDefault(
108
- 'input',
109
- 'type',
110
- 'text',
111
- this.themeProvider,
112
- this.themeService,
113
- );
114
- @Input() mask = resolveThemeDefault(
115
- 'input',
116
- 'mask',
117
- undefined,
118
- this.themeProvider,
119
- this.themeService,
120
- );
121
- @Input() hint = resolveThemeDefault('input', 'hint', '', this.themeProvider, this.themeService);
122
- @Input() placeholder = resolveThemeDefault(
123
- 'input',
124
- 'placeholder',
125
- '',
126
- this.themeProvider,
127
- this.themeService,
128
- );
129
- @Input() label = resolveThemeDefault(
130
- 'input',
131
- 'label',
132
- undefined,
133
- this.themeProvider,
134
- this.themeService,
135
- );
136
- @Input({ alias: 'full-width', transform: booleanAttribute }) fullWidth = resolveThemeDefault(
137
- 'input',
138
- 'fullWidth',
139
- false,
140
- this.themeProvider,
141
- this.themeService,
142
- );
143
- @Input({ transform: booleanAttribute }) disabled = resolveThemeDefault(
144
- 'input',
145
- 'disabled',
146
- false,
147
- this.themeProvider,
148
- this.themeService,
149
- );
150
- @Input({ transform: booleanAttribute }) readonly = resolveThemeDefault(
151
- 'input',
152
- 'readonly',
153
- false,
154
- this.themeProvider,
155
- this.themeService,
156
- );
157
- @Input({ transform: booleanAttribute }) fluid = resolveThemeDefault(
158
- 'input',
159
- 'fluid',
160
- false,
161
- this.themeProvider,
162
- this.themeService,
163
- );
164
- @Input({ transform: booleanAttribute }) error = resolveThemeDefault(
165
- 'input',
166
- 'error',
167
- false,
168
- this.themeProvider,
169
- this.themeService,
170
- );
171
- @Input({ alias: 'container-class' }) containerClass = resolveThemeDefault(
172
- 'input',
173
- 'containerClass',
174
- null,
175
- this.themeProvider,
176
- this.themeService,
177
- );
178
- @Input({ alias: 'input-class' }) inputClass = resolveThemeDefault(
179
- 'input',
180
- 'inputClass',
181
- null,
182
- this.themeProvider,
183
- this.themeService,
184
- );
185
- @Input({ alias: 'host-class' }) hostClass = resolveThemeDefault(
186
- 'input',
187
- 'hostClass',
188
- null,
189
- this.themeProvider,
190
- this.themeService,
191
- );
192
- @Input({ alias: 'hint-class' }) hintClass = resolveThemeDefault(
193
- 'input',
194
- 'hintClass',
195
- null,
196
- this.themeProvider,
197
- this.themeService,
198
- );
199
- @Input({ alias: 'container-style' }) containerStyle = resolveThemeDefault(
200
- 'input',
201
- 'containerStyle',
202
- null,
203
- this.themeProvider,
204
- this.themeService,
205
- );
206
- @Input({ alias: 'input-style' }) inputStyle = resolveThemeDefault(
207
- 'input',
208
- 'inputStyle',
209
- null,
210
- this.themeProvider,
211
- this.themeService,
212
- );
213
- @Input({ alias: 'host-style' }) hostStyle = resolveThemeDefault(
214
- 'input',
215
- 'hostStyle',
216
- null,
217
- this.themeProvider,
218
- this.themeService,
219
- );
220
- @Input({ alias: 'hint-style' }) hintStyle = resolveThemeDefault(
221
- 'input',
222
- 'hintStyle',
223
- null,
224
- this.themeProvider,
225
- this.themeService,
226
- );
227
- @Input({ alias: 'hide-overflow', transform: booleanAttribute }) hideOverflow =
228
- resolveThemeDefault('card', 'hideOverflow', false, this.themeProvider, this.themeService);
229
-
230
- onTouched: any = () => {};
231
- onChange: any = () => {};
232
- private _value: any = '';
233
-
234
- @Input()
235
- get value(): any {
236
- return this._value;
237
- }
238
- set value(val: any) {
239
- if (this._value !== val) {
240
- this._value = val ?? '';
241
- this.cdr.markForCheck();
242
- }
243
- }
244
- @Output() valueChange = new EventEmitter<any>();
245
-
246
- @HostBinding('class')
247
- get hostClasses(): string {
248
- const classes = ['dasar-input'];
249
- if (this.fullWidth) classes.push('full-width');
250
- if (this.disabled) classes.push('disabled');
251
- return classes.join(' ');
252
- }
253
-
254
- private formatValue(val: string): string {
255
- if (!this.mask || val === null || val === undefined) {
256
- return val;
257
- }
258
- const stringVal = String(val);
259
- if (typeof this.mask === 'function') {
260
- return this.mask(stringVal);
261
- }
262
- if (this.mask === 'thousand') {
263
- const digits = stringVal.replace(/\D/g, '');
264
- return digits.replace(/\B(?=(\d{3})+(?!\d))/g, '.');
265
- }
266
- if (this.mask === 'decimal') {
267
- let clean = stringVal.replace(/[^0-9,]/g, '');
268
- const parts = clean.split(',');
269
- let integerPart = parts[0];
270
- let decimalPart = parts.length > 1 ? ',' + parts[1].substring(0, 5) : '';
271
- if (integerPart) {
272
- integerPart = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, '.');
273
- }
274
- return integerPart + decimalPart;
275
- }
276
- if (this.mask === 'date') {
277
- const digits = stringVal.replace(/\D/g, '').substring(0, 8);
278
- if (digits.length >= 5) {
279
- return `${digits.substring(0, 2)}/${digits.substring(2, 4)}/${digits.substring(4)}`;
280
- } else if (digits.length >= 3) {
281
- return `${digits.substring(0, 2)}/${digits.substring(2)}`;
282
- }
283
- return digits;
284
- }
285
- return stringVal;
286
- }
287
- writeValue(value: any): void {
288
- // this.value = value ?? '';
289
- const rawString = value !== null && value !== undefined ? String(value) : '';
290
- this._value = this.formatValue(rawString);
291
- this.cdr.markForCheck();
292
- }
293
- registerOnChange(fn: any): void {
294
- this.onChange = fn;
295
- }
296
- registerOnTouched(fn: any): void {
297
- this.onTouched = fn;
298
- }
299
- setDisabledState(isDisabled: boolean): void {
300
- this.disabled = isDisabled;
301
- }
302
- onInput(event: Event): void {
303
- // const val = (event.target as HTMLInputElement).value;
304
- // this.value = val;
305
- // this.onChange(val);
306
- const inputEl = event.target as HTMLInputElement;
307
- const formattedVal = this.formatValue(inputEl.value);
308
- inputEl.value = formattedVal;
309
- this._value = formattedVal;
310
- this.onChange(formattedVal);
311
- this.valueChange.emit(formattedVal);
312
- }
313
- onBlur(): void {
314
- this.onTouched();
315
- }
316
- }
317
-
318
- export const DasarInputComponent = [
319
- DasarInput,
320
- DasarInputExtraLabelSlot,
321
- DasarInputPrefixSlot,
322
- DasarInputSuffixSlot,
323
- ] as const;
@@ -1,63 +0,0 @@
1
- <div
2
- class="dasar-menu-wrapper"
3
- [ngClass]="containerClass"
4
- [ngStyle]="containerStyle"
5
- [class.fluid]="fluid"
6
- >
7
- <div
8
- class="appearance-{{ appearance }} size-{{ size }} radius-{{ radius }}"
9
- (click)="toggle($event)"
10
- [class.dasar-menu-trigger]="true"
11
- [class.disabled]="disabled"
12
- [class.fluid]="fluid"
13
- >
14
- <ng-content select="[prefix-slot]"></ng-content>
15
- <div class="dasar-menu-label-container">
16
- @if (hasMenuLabel) {
17
- <ng-content select="[menu-label-slot]"></ng-content>
18
- } @else if (label) {
19
- <span class="dasar-menu-text-label">{{ label }}</span>
20
- } @else {
21
- <ng-content></ng-content>
22
- }
23
- </div>
24
- <ng-content select="[suffix-slot]"></ng-content>
25
- </div>
26
- @if (isOpen() && !disabled) {
27
- <div
28
- class="dasar-menu-panel placement-{{ placement }}"
29
- [ngClass]="panelClass"
30
- [ngStyle]="panelStyle"
31
- >
32
- @for (item of items; track item.value; let i = $index) {
33
- @if (item.divider) {
34
- <div class="dasar-menu-divider"></div>
35
- } @else {
36
- <div
37
- class="dasar-menu-item"
38
- [class.disabled]="item.disabled"
39
- [ngClass]="itemClass"
40
- (click)="onItemSelect(item, $event)"
41
- >
42
- @if (hasMenuItem) {
43
- <!-- <ng-container
44
- *ngTemplateOutlet="providedMenuItem; context: { $implicit: item, index: i }"
45
- ></ng-container> -->
46
- <ng-container
47
- *ngTemplateOutlet="
48
- providedMenuItem!.templateRef;
49
- context: { $implicit: item, index: i }
50
- "
51
- ></ng-container>
52
- } @else {
53
- @if (item.iconName) {
54
- <dasar-icon [name]="item.iconName" size="sm"></dasar-icon>
55
- }
56
- <span class="dasar-menu-item-label">{{ item.label }}</span>
57
- }
58
- </div>
59
- }
60
- }
61
- </div>
62
- }
63
- </div>
@@ -1,195 +0,0 @@
1
- @use '../../styles/theme.scss' as *;
2
-
3
- .dasar-menu {
4
- display: inline-flex;
5
- position: relative;
6
- }
7
-
8
- .dasar-menu-wrapper {
9
- display: inline-flex;
10
- flex-direction: column;
11
- position: relative;
12
- }
13
-
14
- .dasar-menu-trigger {
15
- padding: 0 var(--menu-trigger-padding-horizontal, var(--space-base));
16
- display: inline-flex;
17
- align-items: center;
18
- gap: var(--menu-trigger-gap, var(--space-base));
19
- cursor: pointer;
20
- user-select: none;
21
-
22
- &.appearance-outline {
23
- border: 1px solid var(--menu-outline-border, var(--theme-border-strong-color));
24
- background-color: var(--menu-outline-background, transparent);
25
-
26
- &:hover:not(.disabled) {
27
- border-color: var(--menu-outline-hover-border, var(--theme-primary-color));
28
- }
29
-
30
- &.open,
31
- &:focus-within {
32
- border-color: var(--menu-outline-focus-border, var(--theme-primary-color));
33
- box-shadow: 0 0 0 3px var(--menu-outline-focus-ring, var(--theme-primary-surface-color));
34
- }
35
- }
36
-
37
- &.appearance-filled {
38
- border: 1px solid var(--menu-filled-border, transparent);
39
- background-color: var(--menu-filled-background, var(--theme-bg-hover-color));
40
-
41
- &:hover:not(.disabled) {
42
- background-color: var(--menu-filled-hover-background, var(--theme-border-subtle-color));
43
- }
44
-
45
- &.open,
46
- &:focus-within {
47
- background-color: var(--menu-filled-focus-background, var(--theme-bg-surface-color));
48
- border-color: var(--menu-filled-focus-border, var(--theme-primary-color));
49
- box-shadow: 0 0 0 3px var(--menu-filled-focus-ring, var(--theme-primary-surface-color));
50
- }
51
- }
52
-
53
- &.disabled {
54
- opacity: var(--menu-disabled-opacity, 0.6);
55
- cursor: not-allowed;
56
- }
57
-
58
- &.size-xs {
59
- height: var(--select-height-xs, var(--space-6));
60
- font-size: var(--font-size-xs);
61
- }
62
- &.size-sm {
63
- height: var(--menu-height-sm, var(--space-8));
64
- font-size: var(--menu-font-size-sm, var(--font-size-sm));
65
- }
66
- &.size-md {
67
- height: var(--menu-height-md, var(--space-10));
68
- font-size: var(--menu-font-size-md, var(--font-size-base));
69
- }
70
- &.size-lg {
71
- height: var(--menu-height-lg, var(--space-12));
72
- font-size: var(--menu-font-size-lg, var(--font-size-lg));
73
- }
74
- &.size-xl {
75
- height: var(--select-height-xl, var(--space-16));
76
- }
77
-
78
- &.radius-none {
79
- border-radius: var(--menu-radius-none, var(--radius-none));
80
- }
81
- &.radius-xs {
82
- border-radius: var(--menu-radius-xs, var(--radius-xs));
83
- }
84
- &.radius-sm {
85
- border-radius: var(--menu-radius-sm, var(--radius-sm));
86
- }
87
- &.radius-md {
88
- border-radius: var(--menu-radius-md, var(--radius-md));
89
- }
90
- &.radius-lg {
91
- border-radius: var(--menu-radius-lg, var(--radius-lg));
92
- }
93
- &.radius-xl {
94
- border-radius: var(--menu-radius-xl, var(--radius-xl));
95
- }
96
- &.radius-full {
97
- border-radius: var(--menu-radius-full, var(--radius-full));
98
- }
99
-
100
- &.fluid {
101
- padding: 0 !important;
102
- margin: 0 !important;
103
- gap: 0 !important;
104
- }
105
- }
106
-
107
- .dasar-menu-panel {
108
- background-color: var(--menu-panel-background, var(--theme-bg-surface-color));
109
- border: 1px solid var(--menu-panel-border, var(--theme-border-subtle-color));
110
- border-radius: var(--menu-panel-radius, var(--radius-md));
111
- min-width: var(--menu-panel-min-width, 180px);
112
- position: absolute;
113
- box-shadow: var(
114
- --menu-panel-shadow,
115
- 0 10px 15px -3px rgba(0, 0, 0, 0.1),
116
- 0 4px 6px -4px rgba(0, 0, 0, 0.1)
117
- );
118
- padding: var(--menu-panel-padding, var(--space-1));
119
- z-index: var(--menu-panel-z-index, 100);
120
- display: flex;
121
- flex-direction: column;
122
- animation: fadeIn 0.15s ease-out forwards;
123
-
124
- &.placement-bottom-start {
125
- top: calc(100% + var(--menu-panel-offset, 6px));
126
- left: 0;
127
- }
128
- &.placement-bottom-end {
129
- top: calc(100% + var(--menu-panel-offset, 6px));
130
- right: 0;
131
- }
132
- &.placement-top-start {
133
- bottom: calc(100% + var(--menu-panel-offset, 6px));
134
- left: 0;
135
- }
136
- &.placement-top-end {
137
- bottom: calc(100% + var(--menu-panel-offset, 6px));
138
- right: 0;
139
- }
140
- }
141
-
142
- .dasar-menu-item {
143
- padding: var(--menu-item-padding-vertical, var(--space-base))
144
- var(--menu-item-padding-horizontal, var(--space-3));
145
- color: var(--menu-item-color, var(--theme-text-primary-color));
146
- border-radius: var(--menu-item-radius, var(--radius-xs));
147
- gap: var(--menu-item-gap, var(--space-base));
148
- transition: background-color 0.15s ease;
149
- align-items: center;
150
- cursor: pointer;
151
- display: flex;
152
-
153
- .size-xs & {
154
- font-size: var(--font-size-xs);
155
- }
156
- .size-sm & {
157
- font-size: var(--font-size-sm);
158
- }
159
- .size-md & {
160
- font-size: var(--font-size-base);
161
- }
162
- .size-lg & {
163
- font-size: var(--font-size-lg);
164
- }
165
- .size-xl & {
166
- font-size: var(--font-size-xl);
167
- }
168
-
169
- &:hover:not(.disabled) {
170
- background-color: var(--menu-item-hover-background, var(--theme-bg-hover-color));
171
- color: var(--menu-item-hover-color, var(--theme-text-primary-color));
172
- }
173
-
174
- &.disabled {
175
- color: var(--menu-item-disabled-color, var(--theme-text-disabled-color));
176
- cursor: not-allowed;
177
- }
178
- }
179
-
180
- .dasar-menu-divider {
181
- height: var(--menu-divider-height, 1px);
182
- background-color: var(--menu-divider-background, var(--theme-border-subtle-color));
183
- margin: var(--menu-divider-margin-vertical, var(--space-1)) 0;
184
- }
185
-
186
- @keyframes fadeIn {
187
- from {
188
- opacity: 0;
189
- transform: translateY(-4px);
190
- }
191
- to {
192
- opacity: 1;
193
- transform: translateY(0);
194
- }
195
- }
@@ -1,21 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
- import { DasarMenu } from './dasar-menu';
3
-
4
- describe('DasarMenu', () => {
5
- let component: DasarMenu;
6
- let fixture: ComponentFixture<DasarMenu>;
7
-
8
- beforeEach(async () => {
9
- await TestBed.configureTestingModule({
10
- imports: [DasarMenu],
11
- }).compileComponents();
12
-
13
- fixture = TestBed.createComponent(DasarMenu);
14
- component = fixture.componentInstance;
15
- await fixture.whenStable();
16
- });
17
-
18
- it('should create', () => {
19
- expect(component).toBeTruthy();
20
- });
21
- });