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,240 +0,0 @@
1
- import {
2
- booleanAttribute,
3
- Component,
4
- HostBinding,
5
- Input,
6
- Output,
7
- EventEmitter,
8
- ViewEncapsulation,
9
- TemplateRef,
10
- ChangeDetectorRef,
11
- inject,
12
- HostListener,
13
- ElementRef,
14
- signal,
15
- Directive,
16
- ContentChild,
17
- } from '@angular/core';
18
- import { CommonModule } from '@angular/common';
19
-
20
- import { DASAR_THEME_PROVIDER } from '../dasar-theme-provider/dasar-theme-provider';
21
- import { ClassType, StyleType, ScaleAttributeType } from '../../models/type.model';
22
- import { DasarThemeService } from '../../services/theme.service';
23
- import { DasarIconComponent } from '../dasar-icon/dasar-icon';
24
- import { resolveThemeDefault } from '../../utils/common';
25
-
26
- export type DasarMenuPlacementType = 'bottom-start' | 'bottom-end' | 'top-start' | 'top-end';
27
- export type DasarMenuSizeType = Extract<ScaleAttributeType, 'sm' | 'md' | 'lg'>;
28
- export type DasarMenuAppearanceType = 'none' | 'outline' | 'filled';
29
- export type DasarMenuRadiusType = ScaleAttributeType;
30
-
31
- export interface DasarMenuItem {
32
- label: string;
33
- value: any;
34
- iconName?: string;
35
- disabled?: boolean;
36
- divider?: boolean;
37
- [key: string]: any;
38
- }
39
-
40
- export interface DasarMenuConfig {
41
- placement?: DasarMenuPlacementType;
42
- appearance?: DasarMenuAppearanceType;
43
- radius?: DasarMenuRadiusType;
44
- label?: string;
45
- size?: DasarMenuSizeType;
46
- items?: DasarMenuItem[];
47
- containerStyle?: StyleType;
48
- panelStyle?: StyleType;
49
- itemStyle?: StyleType;
50
- containerClass?: ClassType;
51
- panelClass?: ClassType;
52
- itemClass?: ClassType;
53
- disabled?: boolean;
54
- fluid?: boolean;
55
- }
56
-
57
- @Directive({ selector: '[prefix-slot]', standalone: true })
58
- export class DasarMenuPrefixSlot {}
59
- @Directive({ selector: '[suffix-slot]', standalone: true })
60
- export class DasarMenuSuffixSlot {}
61
- @Directive({ selector: '[menu-label-slot]', standalone: true })
62
- export class DasarMenuLabelSlot {}
63
- @Directive({ selector: '[menu-item-template]', standalone: true })
64
- export class DasarMenuItemTemplate {
65
- constructor(public templateRef: TemplateRef<any>) {}
66
- }
67
- @Component({
68
- imports: [CommonModule, DasarIconComponent],
69
- encapsulation: ViewEncapsulation.None,
70
- styleUrls: ['./dasar-menu.scss'],
71
- templateUrl: './dasar-menu.html',
72
- selector: 'dasar-menu',
73
- standalone: true,
74
- })
75
- export class DasarMenu {
76
- @ContentChild(DasarMenuItemTemplate) providedMenuItem?: DasarMenuItemTemplate;
77
- @ContentChild(DasarMenuLabelSlot) providedMenuLabel?: DasarMenuLabelSlot;
78
- @ContentChild(DasarMenuPrefixSlot) providedMenuPrefix?: DasarMenuPrefixSlot;
79
- @ContentChild(DasarMenuSuffixSlot) providedMenuSuffix?: DasarMenuSuffixSlot;
80
-
81
- private themeProvider = inject(DASAR_THEME_PROVIDER, { optional: true });
82
- private themeService = inject(DasarThemeService, { optional: true });
83
- private cdr = inject(ChangeDetectorRef);
84
- private elementRef = inject(ElementRef);
85
- isOpen = signal<boolean>(false);
86
-
87
- @Input() placement = resolveThemeDefault(
88
- 'menu',
89
- 'placement',
90
- 'bottom-start',
91
- this.themeProvider,
92
- this.themeService,
93
- );
94
-
95
- @Input() appearance = resolveThemeDefault(
96
- 'menu',
97
- 'appearance',
98
- 'outline',
99
- this.themeProvider,
100
- this.themeService,
101
- );
102
-
103
- @Input() radius = resolveThemeDefault(
104
- 'menu',
105
- 'radius',
106
- 'md',
107
- this.themeProvider,
108
- this.themeService,
109
- );
110
-
111
- @Input() size = resolveThemeDefault('menu', 'size', 'md', this.themeProvider, this.themeService);
112
- @Input() label = resolveThemeDefault(
113
- 'menu',
114
- 'label',
115
- undefined,
116
- this.themeProvider,
117
- this.themeService,
118
- );
119
- @Input() items = resolveThemeDefault('menu', 'items', [], this.themeProvider, this.themeService);
120
- @Input() containerStyle = resolveThemeDefault(
121
- 'menu',
122
- 'containerStyle',
123
- null,
124
- this.themeProvider,
125
- this.themeService,
126
- );
127
- @Input() panelStyle = resolveThemeDefault(
128
- 'menu',
129
- 'panelStyle',
130
- null,
131
- this.themeProvider,
132
- this.themeService,
133
- );
134
- @Input() itemStyle = resolveThemeDefault(
135
- 'menu',
136
- 'itemStyle',
137
- null,
138
- this.themeProvider,
139
- this.themeService,
140
- );
141
- @Input() containerClass = resolveThemeDefault(
142
- 'menu',
143
- 'containerClass',
144
- null,
145
- this.themeProvider,
146
- this.themeService,
147
- );
148
- @Input() panelClass = resolveThemeDefault(
149
- 'menu',
150
- 'panelClass',
151
- null,
152
- this.themeProvider,
153
- this.themeService,
154
- );
155
- @Input() itemClass = resolveThemeDefault(
156
- 'menu',
157
- 'itemClass',
158
- null,
159
- this.themeProvider,
160
- this.themeService,
161
- );
162
- @Input({ transform: booleanAttribute }) disabled = resolveThemeDefault(
163
- 'menu',
164
- 'disabled',
165
- false,
166
- this.themeProvider,
167
- this.themeService,
168
- );
169
- @Input({ transform: booleanAttribute }) fluid = resolveThemeDefault(
170
- 'menu',
171
- 'fluid',
172
- false,
173
- this.themeProvider,
174
- this.themeService,
175
- );
176
-
177
- @Output() onItemClick = new EventEmitter<DasarMenuItem>();
178
- @Output() onPanelOpen = new EventEmitter<void>();
179
- @Output() onPanelClose = new EventEmitter<void>();
180
-
181
- @HostBinding('class.dasar-menu') readonly baseClass = true;
182
- @HostListener('document:click', ['$event'])
183
- onDocumentClick(event: MouseEvent): void {
184
- if (!this.elementRef.nativeElement.contains(event.target)) {
185
- if (this.isOpen()) {
186
- this.close();
187
- }
188
- }
189
- }
190
- @HostListener('document:dasar-menu:opened', ['$event'])
191
- onGlobalSelectOpened(event: any): void {
192
- if (event.detail !== this && this.isOpen()) {
193
- this.close();
194
- }
195
- }
196
-
197
- get hasMenuLabel(): boolean {
198
- return !!this.providedMenuLabel;
199
- }
200
- get hasMenuItem(): boolean {
201
- return !!this.providedMenuItem;
202
- }
203
-
204
- toggle(event?: Event): void {
205
- if (event) event.stopPropagation();
206
- if (this.disabled) return;
207
- if (this.isOpen()) {
208
- this.close();
209
- } else {
210
- this.open();
211
- }
212
- }
213
- open(): void {
214
- if (this.disabled || this.isOpen()) return;
215
- this.isOpen.set(true);
216
- this.onPanelClose.emit();
217
- // Broadcast globally that this menu instance just opened
218
- const openEvent = new CustomEvent('dasar-menu:opened', { detail: this });
219
- document.dispatchEvent(openEvent);
220
- }
221
- close(): void {
222
- if (!this.isOpen()) return;
223
- this.isOpen.set(false);
224
- this.onPanelClose.emit();
225
- }
226
- onItemSelect(item: DasarMenuItem, event: Event): void {
227
- event.stopPropagation();
228
- if (item.disabled || item.divider) return;
229
- this.onItemClick.emit(item);
230
- this.close();
231
- }
232
- }
233
-
234
- export const DasarMenuComponent = [
235
- DasarMenuLabelSlot,
236
- DasarMenuItemTemplate,
237
- DasarMenuPrefixSlot,
238
- DasarMenuSuffixSlot,
239
- DasarMenu,
240
- ] as const;
@@ -1,90 +0,0 @@
1
- <div class="dasar-number-input-wrapper">
2
- @if (label) {
3
- <div class="dasar-number-input-label-row">
4
- @if (label) {
5
- <label class="dasar-number-input-label">{{ label }}</label>
6
- }
7
- @if (labelRight || hasExtraLabelSlot) {
8
- <div class="dasar-number-input-label-right">
9
- @if (hasExtraLabelSlot) {
10
- <ng-content select="[extra-label-slot]"></ng-content>
11
- } @else {
12
- <span>{{ labelRight }}</span>
13
- }
14
- </div>
15
- }
16
- </div>
17
- }
18
- <div
19
- class="dasar-number-input-container size-{{ size }} appearance-{{ appearance }} radius-{{
20
- radius
21
- }}"
22
- [class.hide-overflow]="hideOverflow"
23
- [class.disabled]="disabled"
24
- [class.error]="error"
25
- [ngClass]="containerClass"
26
- [ngStyle]="containerStyle"
27
- >
28
- <ng-content select="[prefix-slot]"></ng-content>
29
- <input
30
- [id]="label"
31
- class="dasar-number-input-native"
32
- type="number"
33
- [ngClass]="inputClass"
34
- [ngStyle]="inputStyle"
35
- [placeholder]="placeholder"
36
- [disabled]="disabled"
37
- [value]="value"
38
- [step]="step"
39
- [min]="min"
40
- [max]="max"
41
- (input)="onInput($event)"
42
- (focus)="onFocus($event)"
43
- (blur)="onBlur($event)"
44
- />
45
- <div class="dasar-number-input-actions-group">
46
- <div class="asar-number-input-action-zone" (click)="onDecrement($event)">
47
- @if (hasDecrementSlot) {
48
- <ng-content select="[decrement-slot]"></ng-content>
49
- } @else {
50
- <dasar-button
51
- variant="ghost"
52
- radius="none"
53
- [disabled]="disabled"
54
- [size]="size"
55
- tabindex="-1"
56
- icon-only
57
- >
58
- <dasar-icon name="minus"></dasar-icon>
59
- </dasar-button>
60
- }
61
- </div>
62
- <div class="dasar-number-input-action-zone" (click)="onIncrement($event)">
63
- @if (hasIncrementSlot) {
64
- <ng-content select="[increment-slot]"></ng-content>
65
- } @else {
66
- <dasar-button
67
- variant="ghost"
68
- radius="none"
69
- [disabled]="disabled"
70
- [size]="size"
71
- tabindex="-1"
72
- icon-only
73
- >
74
- <dasar-icon name="plus"></dasar-icon>
75
- </dasar-button>
76
- }
77
- </div>
78
- </div>
79
- </div>
80
- @if (hint) {
81
- <div
82
- class="dasar-number-input-hint"
83
- [class.error]="error"
84
- [ngClass]="hintClass"
85
- [ngStyle]="hintStyle"
86
- >
87
- {{ hint }}
88
- </div>
89
- }
90
- </div>
@@ -1,358 +0,0 @@
1
- @use '../../styles/theme.scss' as *;
2
-
3
- .dasar-number-input {
4
- display: inline-flex;
5
- flex-direction: column;
6
- position: relative;
7
- width: fit-content;
8
-
9
- &.full-width {
10
- width: 100%;
11
- }
12
-
13
- &.disabled {
14
- cursor: not-allowed;
15
- }
16
- }
17
-
18
- .dasar-number-input-wrapper {
19
- gap: var(--number-input-wrapper-gap, var(--space-1));
20
- flex-direction: column;
21
- display: flex;
22
- }
23
-
24
- .dasar-number-input-label-row {
25
- font-weight: var(--number-input-label-font-weight, var(--font-weight-medium));
26
- color: var(--number-input-label-color, var(--theme-text-primary-color));
27
- justify-content: space-between;
28
- align-items: center;
29
- line-height: var(--line-height-tight); // Updated
30
- display: flex;
31
-
32
- .dasar-number-input-label {
33
- font-size: var(--number-input-label-font-size, var(--font-size-md));
34
- }
35
-
36
- .dasar-number-input-label-right {
37
- color: var(--input-label-right-color, var(--theme-text-secondary-color));
38
- font-size: var(--input-label-right-font-size, var(--font-size-sm));
39
- font-weight: var(--font-weight-regular);
40
- display: inline-flex;
41
- align-items: center;
42
- gap: var(--space-1);
43
- }
44
- }
45
-
46
- .dasar-number-input-container {
47
- background-color: var(--number-input-bg, var(--theme-bg-hover-color));
48
- border-radius: var(--number-input-radius-sm, var(--radius-sm));
49
- box-sizing: border-box;
50
- font-family: inherit;
51
- display: inline-flex;
52
- align-items: stretch;
53
- overflow: hidden;
54
- width: 100%;
55
-
56
- &.hide-overflow {
57
- overflow: hidden;
58
- }
59
-
60
- &.appearance-outline {
61
- border: 1px solid var(--number-input-outline-border, var(--theme-border-strong-color));
62
- background-color: var(--number-input-outline-bg, transparent);
63
-
64
- &:hover:not(.disabled) {
65
- border-color: var(--number-input-outline-hover-border, var(--theme-primary-color));
66
- transition: all 0.2s ease;
67
- }
68
-
69
- &:focus-within {
70
- border-color: var(--number-input-outline-focus-border, var(--theme-primary-color));
71
- box-shadow: 0 0 0 3px
72
- var(--number-input-outline-focus-ring, var(--theme-primary-surface-color));
73
- }
74
- }
75
-
76
- &.appearance-filled {
77
- border: 1px solid var(--number-input-filled-border, transparent);
78
- background-color: var(--number-input-filled-bg, var(--theme-bg-hover-color));
79
-
80
- &:hover:not(.disabled) {
81
- background-color: var(--number-input-filled-hover-bg, var(--theme-border-subtle-color));
82
- transition: all 0.2s ease;
83
- }
84
-
85
- &:focus-within {
86
- background-color: var(--number-input-filled-focus-bg, var(--theme-bg-surface-color));
87
- border-color: var(--number-input-filled-focus-border, var(--theme-primary-color));
88
- box-shadow: 0 0 0 3px
89
- var(--number-input-filled-focus-ring, var(--theme-primary-surface-color));
90
- }
91
- }
92
-
93
- &.error {
94
- border-color: var(--number-input-error-border, var(--theme-danger-color)) !important;
95
-
96
- &:focus-within {
97
- box-shadow: 0 0 0 3px var(--number-input-error-focus-ring, var(--theme-danger-surface-color));
98
- }
99
- }
100
-
101
- &.disabled {
102
- background-color: var(--number-input-disabled-bg, var(--theme-bg-hover-color)) !important;
103
- border-color: var(--number-input-disabled-border, transparent) !important;
104
- cursor: not-allowed;
105
- opacity: var(--number-input-disabled-opacity, 0.7);
106
-
107
- .dasar-action-zone {
108
- pointer-events: none;
109
- }
110
- }
111
-
112
- &.size-xs {
113
- font-size: var(--font-size-xs);
114
- height: var(--number-input-height-xs, var(--space-6));
115
- padding: 0 var(--number-input-padding-horizontal-xs, var(--space-base));
116
-
117
- .dasar-number-input-native {
118
- font-size: var(--number-input-font-size-xs, var(--font-size-xs));
119
- }
120
-
121
- &:has(.dasar-number-input-actions-group) {
122
- padding-right: 0;
123
- }
124
-
125
- &:has([decrement-slot], [increment-slot]) {
126
- padding-right: 0;
127
-
128
- .dasar-number-input-native {
129
- padding-right: var(--number-input-padding-horizontal-xs, var(--space-base));
130
- }
131
- }
132
-
133
- &:has([prefix]) {
134
- padding-left: 0;
135
-
136
- .dasar-number-input-native {
137
- padding-left: var(--number-input-padding-horizontal-xs, var(--space-base));
138
- }
139
- }
140
- }
141
-
142
- &.size-sm {
143
- font-size: var(--font-size-sm);
144
- height: var(--number-input-height-sm, var(--space-8));
145
- padding: 0 var(--number-input-padding-horizontal-sm, var(--space-3));
146
-
147
- .dasar-number-input-native {
148
- font-size: var(--number-input-font-size-sm, var(--font-size-sm));
149
- }
150
-
151
- &:has(.dasar-number-input-actions-group) {
152
- padding-right: 0;
153
- }
154
-
155
- &:has([decrement-slot], [increment-slot]) {
156
- padding-right: 0;
157
-
158
- .dasar-number-input-native {
159
- padding-right: var(--number-input-padding-horizontal-sm, var(--space-3));
160
- }
161
- }
162
-
163
- &:has([prefix]) {
164
- padding-left: 0;
165
-
166
- .dasar-number-input-native {
167
- padding-left: var(--number-input-padding-horizontal-sm, var(--space-3));
168
- }
169
- }
170
- }
171
-
172
- &.size-md {
173
- padding: 0 var(--number-input-padding-horizontal-md, var(--space-4));
174
- height: var(--number-input-height-md, var(--space-10));
175
- font-size: var(--font-size-base);
176
-
177
- .dasar-number-input-native {
178
- font-size: var(--number-input-font-size-md, var(--font-size-base));
179
- }
180
-
181
- &:has(.dasar-number-input-actions-group) {
182
- padding-right: 0;
183
- }
184
-
185
- &:has([decrement-slot], [increment-slot]) {
186
- padding-right: 0;
187
-
188
- .dasar-number-input-native {
189
- padding-right: var(--number-input-padding-horizontal-md, var(--space-4));
190
- }
191
- }
192
-
193
- &:has([prefix]) {
194
- padding-left: 0;
195
-
196
- .dasar-number-input-native {
197
- padding-left: var(--number-input-padding-horizontal-md, var(--space-4));
198
- }
199
- }
200
- }
201
-
202
- &.size-lg {
203
- font-size: var(--font-size-lg);
204
- height: var(--number-input-height-lg, var(--space-12));
205
- padding: 0 var(--number-input-padding-horizontal-lg, var(--space-5));
206
-
207
- .dasar-number-input-native {
208
- font-size: var(--number-input-font-size-lg, var(--font-size-lg));
209
- }
210
-
211
- &:has(.dasar-number-input-actions-group) {
212
- padding-right: 0;
213
- }
214
-
215
- &:has([decrement-slot], [increment-slot]) {
216
- padding-right: 0;
217
-
218
- .dasar-number-input-native {
219
- padding-right: var(--number-input-padding-horizontal-lg, var(--space-5));
220
- }
221
- }
222
-
223
- &:has([prefix]) {
224
- padding-left: 0;
225
-
226
- .dasar-number-input-native {
227
- padding-left: var(--number-input-padding-horizontal-lg, var(--space-5));
228
- }
229
- }
230
- }
231
-
232
- &.size-xl {
233
- font-size: var(--font-size-xl);
234
- height: var(--number-input-height-xl, var(--space-16));
235
- padding: 0 var(--number-input-padding-horizontal-xl, var(--space-6));
236
-
237
- .dasar-number-input-native {
238
- font-size: var(--number-input-font-size-xl, var(--font-size-xl));
239
- }
240
-
241
- &:not(.dasar-number-input-actions-group) {
242
- padding-right: 0;
243
- }
244
-
245
- &:has([decrement-slot], [increment-slot]) {
246
- padding-right: 0;
247
-
248
- .dasar-number-input-native {
249
- padding-right: var(--number-input-padding-horizontal-xl, var(--space-6));
250
- }
251
- }
252
-
253
- &:has([prefix]) {
254
- padding-left: 0;
255
-
256
- .dasar-number-input-native {
257
- padding-left: var(--number-input-padding-horizontal-xl, var(--space-6));
258
- }
259
- }
260
- }
261
-
262
- &.radius-none {
263
- border-radius: var(--number-input-radius-none, var(--radius-none));
264
- }
265
- &.radius-sm {
266
- border-radius: var(--number-input-radius-sm, var(--radius-xs));
267
- }
268
- &.radius-md {
269
- border-radius: var(--number-input-radius-md, var(--radius-md));
270
- }
271
- &.radius-lg {
272
- border-radius: var(--number-input-radius-lg, var(--radius-2xl));
273
- }
274
- &.radius-full {
275
- border-radius: var(--number-input-radius-full, var(--radius-full));
276
- }
277
- }
278
-
279
- .dasar-number-input-native {
280
- color: var(--number-input-color, var(--theme-text-primary-color));
281
- background: transparent;
282
- font-family: inherit;
283
- text-align: left;
284
- outline: none;
285
- border: none;
286
- min-width: 0;
287
- width: 100%;
288
- flex: 1;
289
-
290
- &::placeholder {
291
- color: var(--number-input-placeholder-color, var(--theme-text-secondary-color));
292
- }
293
-
294
- &:disabled {
295
- color: var(--number-input-disabled-color, var(--theme-text-disabled-color));
296
- cursor: not-allowed;
297
- }
298
-
299
- &:-webkit-autofill,
300
- &:-webkit-autofill:hover,
301
- &:-webkit-autofill:focus {
302
- -webkit-box-shadow: 0 0 0 30px
303
- var(--number-input-autofill-background, var(--theme-bg-default-color)) inset !important;
304
- -webkit-text-fill-color: var(
305
- --number-input-autofill-color,
306
- var(--theme-text-primary-color)
307
- ) !important;
308
- }
309
-
310
- &::-webkit-outer-spin-button,
311
- &::-webkit-inner-spin-button {
312
- -webkit-appearance: none;
313
- margin: 0;
314
- }
315
-
316
- &[type='number'] {
317
- --moz-appearance: textfield;
318
- }
319
- }
320
-
321
- .dasar-number-input-actions-group {
322
- display: flex;
323
- align-items: stretch;
324
- }
325
-
326
- .dasar-number-input-action-zone {
327
- justify-content: center;
328
- align-items: center;
329
- user-select: none;
330
- cursor: pointer;
331
- display: flex;
332
-
333
- &:hover {
334
- background-color: var(--number-input-action-hover-background, rgba(0, 0, 0, 0.05));
335
- transition: all 0.2s ease;
336
- }
337
- // ::ng-deep dasar-button {
338
- // width: 100%;
339
- // height: 100%;
340
- // border-radius: var(--radius-none);
341
- // }
342
- }
343
-
344
- .dasar-number-input-hint {
345
- font-size: var(--number-input-hint-font-size, var(--font-size-xs));
346
- color: var(--number-input-hint-color, var(--theme-text-secondary-color));
347
- line-height: var(--line-height-normal); // Updated
348
- margin-top: calc(var(--space-0-5) * -1);
349
-
350
- &.error {
351
- color: var(--number-input-hint-error-color, var(--theme-danger-color));
352
- }
353
-
354
- &.disabled {
355
- opacity: var(--number-input-disabled-opacity, 0.7);
356
- cursor: not-allowed;
357
- }
358
- }
@@ -1,21 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
- import { DasarNumberInput } from './dasar-number-input';
3
-
4
- describe('DasarNumberinput', () => {
5
- let component: DasarNumberInput;
6
- let fixture: ComponentFixture<DasarNumberInput>;
7
-
8
- beforeEach(async () => {
9
- await TestBed.configureTestingModule({
10
- imports: [DasarNumberInput],
11
- }).compileComponents();
12
-
13
- fixture = TestBed.createComponent(DasarNumberInput);
14
- component = fixture.componentInstance;
15
- await fixture.whenStable();
16
- });
17
-
18
- it('should create', () => {
19
- expect(component).toBeTruthy();
20
- });
21
- });