@salas-ds/cli 0.1.0 → 0.2.1
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/dist/index.js +296 -94
- package/package.json +4 -5
- package/templates/angular/accordion/accordion-content.component.ts +9 -0
- package/templates/angular/accordion/accordion-item.component.ts +138 -0
- package/templates/angular/accordion/accordion-trigger.component.ts +9 -0
- package/templates/angular/accordion/accordion.component.ts +120 -0
- package/templates/angular/accordion/accordion.module.ts +21 -0
- package/templates/angular/autocomplete/autocomplete.component.ts +707 -0
- package/templates/angular/autocomplete/autocomplete.module.ts +8 -0
- package/templates/angular/avatar/avatar-badge.component.ts +18 -0
- package/templates/angular/avatar/avatar-fallback.component.ts +39 -0
- package/templates/angular/avatar/avatar-group-count.component.ts +46 -0
- package/templates/angular/avatar/avatar-group.component.ts +33 -0
- package/templates/angular/avatar/avatar-image.component.ts +57 -0
- package/templates/angular/avatar/avatar.component.ts +73 -0
- package/templates/angular/avatar/avatar.module.ts +27 -0
- package/templates/angular/badge/badge.component.ts +84 -0
- package/templates/angular/badge/badge.module.ts +9 -0
- package/templates/angular/button/button.component.ts +24 -4
- package/templates/angular/card/card.component.ts +100 -0
- package/templates/angular/card/card.module.ts +8 -0
- package/templates/angular/checkbox/checkbox.component.ts +172 -0
- package/templates/angular/checkbox/checkbox.module.ts +8 -0
- package/templates/angular/datepicker/datepicker.component.ts +660 -0
- package/templates/angular/datepicker/datepicker.module.ts +8 -0
- package/templates/angular/dialog/dialog-content.component.ts +9 -0
- package/templates/angular/dialog/dialog-description.component.ts +17 -0
- package/templates/angular/dialog/dialog-footer.component.ts +17 -0
- package/templates/angular/dialog/dialog-header.component.ts +14 -0
- package/templates/angular/dialog/dialog-title.component.ts +18 -0
- package/templates/angular/dialog/dialog-trigger.component.ts +9 -0
- package/templates/angular/dialog/dialog.component.ts +212 -0
- package/templates/angular/dialog/dialog.module.ts +31 -0
- package/templates/angular/input/input.component.ts +229 -0
- package/templates/angular/input/input.module.ts +8 -0
- package/templates/angular/scroll-area/scroll-area.component.ts +72 -0
- package/templates/angular/scroll-area/scroll-area.module.ts +9 -0
- package/templates/angular/scroll-area/scroll-bar.component.ts +15 -0
- package/templates/angular/select/select.component.ts +292 -0
- package/templates/angular/select/select.module.ts +8 -0
- package/templates/angular/separator/separator.component.ts +63 -0
- package/templates/angular/separator/separator.module.ts +9 -0
- package/templates/angular/sheet/sheet-content.component.ts +13 -0
- package/templates/angular/sheet/sheet-description.component.ts +29 -0
- package/templates/angular/sheet/sheet-footer.component.ts +27 -0
- package/templates/angular/sheet/sheet-header.component.ts +26 -0
- package/templates/angular/sheet/sheet-title.component.ts +31 -0
- package/templates/angular/sheet/sheet-trigger.component.ts +11 -0
- package/templates/angular/sheet/sheet.component.ts +251 -0
- package/templates/angular/sheet/sheet.module.ts +30 -0
- package/templates/angular/sidebar/sidebar-content.component.ts +25 -0
- package/templates/angular/sidebar/sidebar-footer.component.ts +20 -0
- package/templates/angular/sidebar/sidebar-group-content.component.ts +16 -0
- package/templates/angular/sidebar/sidebar-group-label.component.ts +20 -0
- package/templates/angular/sidebar/sidebar-group.component.ts +14 -0
- package/templates/angular/sidebar/sidebar-header.component.ts +25 -0
- package/templates/angular/sidebar/sidebar-inset.component.ts +85 -0
- package/templates/angular/sidebar/sidebar-menu-button.component.ts +75 -0
- package/templates/angular/sidebar/sidebar-menu-item.component.ts +14 -0
- package/templates/angular/sidebar/sidebar-menu.component.ts +19 -0
- package/templates/angular/sidebar/sidebar-provider.component.ts +77 -0
- package/templates/angular/sidebar/sidebar-trigger.component.ts +58 -0
- package/templates/angular/sidebar/sidebar.component.ts +228 -0
- package/templates/angular/sidebar/sidebar.module.ts +48 -0
- package/templates/angular/sidebar/sidebar.service.ts +93 -0
- package/templates/angular/skeleton/skeleton.component.ts +44 -0
- package/templates/angular/skeleton/skeleton.module.ts +8 -0
- package/templates/angular/spinner/spinner.component.ts +75 -0
- package/templates/angular/spinner/spinner.module.ts +8 -0
- package/templates/angular/table/table-body.component.ts +23 -0
- package/templates/angular/table/table-caption.component.ts +29 -0
- package/templates/angular/table/table-cell.component.ts +49 -0
- package/templates/angular/table/table-footer.component.ts +32 -0
- package/templates/angular/table/table-head.component.ts +48 -0
- package/templates/angular/table/table-header.component.ts +28 -0
- package/templates/angular/table/table-row.component.ts +36 -0
- package/templates/angular/table/table.component.ts +35 -0
- package/templates/angular/table/table.module.ts +33 -0
- package/templates/angular/tabs/tabs-content.component.ts +71 -0
- package/templates/angular/tabs/tabs-list.component.ts +70 -0
- package/templates/angular/tabs/tabs-trigger.component.ts +149 -0
- package/templates/angular/tabs/tabs.component.ts +155 -0
- package/templates/angular/tabs/tabs.module.ts +21 -0
- package/templates/angular/textarea/textarea.component.ts +268 -0
- package/templates/angular/textarea/textarea.module.ts +8 -0
- package/templates/angular/toast/toast.module.ts +8 -0
- package/templates/angular/toast/toast.service.ts +104 -0
- package/templates/angular/toast/toaster.component.ts +329 -0
- package/templates/angular/tooltip/tooltip-content.component.ts +43 -0
- package/templates/angular/tooltip/tooltip-trigger.component.ts +13 -0
- package/templates/angular/tooltip/tooltip.component.ts +243 -0
- package/templates/angular/tooltip/tooltip.module.ts +10 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Component, ViewEncapsulation } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'salas-dialog-header',
|
|
5
|
+
standalone: true,
|
|
6
|
+
encapsulation: ViewEncapsulation.None,
|
|
7
|
+
template: `<div class="salas-dialog-header"><ng-content></ng-content></div>`,
|
|
8
|
+
styles: [`
|
|
9
|
+
.salas-dialog-header {
|
|
10
|
+
padding-right: 1.5rem;
|
|
11
|
+
}
|
|
12
|
+
`],
|
|
13
|
+
})
|
|
14
|
+
export class SalasDialogHeaderComponent {}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Component, ViewEncapsulation } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'salas-dialog-title',
|
|
5
|
+
standalone: true,
|
|
6
|
+
encapsulation: ViewEncapsulation.None,
|
|
7
|
+
template: `<h2 class="salas-dialog-title"><ng-content></ng-content></h2>`,
|
|
8
|
+
styles: [`
|
|
9
|
+
.salas-dialog-title {
|
|
10
|
+
margin: 0;
|
|
11
|
+
font-size: 1.125rem;
|
|
12
|
+
font-weight: 600;
|
|
13
|
+
line-height: 1.4;
|
|
14
|
+
color: var(--salas-text);
|
|
15
|
+
}
|
|
16
|
+
`],
|
|
17
|
+
})
|
|
18
|
+
export class SalasDialogTitleComponent {}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'salas-dialog-trigger',
|
|
5
|
+
standalone: true,
|
|
6
|
+
template: '<ng-content></ng-content>',
|
|
7
|
+
styles: [`:host { display: inline-block; cursor: pointer; }`],
|
|
8
|
+
})
|
|
9
|
+
export class SalasDialogTriggerComponent {}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import {
|
|
2
|
+
|
|
3
|
+
export type DialogSize = 'default' | 'sm';
|
|
4
|
+
|
|
5
|
+
export interface DialogProps {
|
|
6
|
+
/**
|
|
7
|
+
* Controlled open state. If provided, the dialog becomes controlled and
|
|
8
|
+
* will not manage its own internal state.
|
|
9
|
+
*/
|
|
10
|
+
open?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Width of the dialog panel. Accepts any valid CSS width value (e.g. '480px', '32rem', '50%').
|
|
13
|
+
*/
|
|
14
|
+
width?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Height of the dialog panel. Accepts any valid CSS height value.
|
|
17
|
+
*/
|
|
18
|
+
height?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Named size preset. When provided, defines sensible defaults for width and padding.
|
|
21
|
+
*/
|
|
22
|
+
size?: DialogSize;
|
|
23
|
+
/**
|
|
24
|
+
* If true, closes the dialog when the user clicks on the overlay.
|
|
25
|
+
*/
|
|
26
|
+
closeOnOverlayClick?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* If true, hides the X close button in the top-right corner.
|
|
29
|
+
*/
|
|
30
|
+
hideCloseButton?: boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
Component,
|
|
34
|
+
Input,
|
|
35
|
+
Output,
|
|
36
|
+
EventEmitter,
|
|
37
|
+
ViewEncapsulation,
|
|
38
|
+
HostListener,
|
|
39
|
+
} from '@angular/core';
|
|
40
|
+
|
|
41
|
+
@Component({
|
|
42
|
+
selector: 'salas-dialog',
|
|
43
|
+
standalone: true,
|
|
44
|
+
imports: [],
|
|
45
|
+
encapsulation: ViewEncapsulation.None,
|
|
46
|
+
template: `
|
|
47
|
+
<div class="salas-dialog-trigger-wrapper" (click)="openDialog()">
|
|
48
|
+
<ng-content select="salas-dialog-trigger"></ng-content>
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
@if (isOpen) {
|
|
52
|
+
<div class="salas-dialog-overlay" (click)="onOverlayClick()"></div>
|
|
53
|
+
<div class="salas-dialog-container" (click)="onContainerClick($event)">
|
|
54
|
+
<div
|
|
55
|
+
class="salas-dialog-panel"
|
|
56
|
+
[class.salas-dialog-panel--sm]="effectiveSize === 'sm'"
|
|
57
|
+
[style.width]="width ?? null"
|
|
58
|
+
[style.max-width]="width ? 'none' : null"
|
|
59
|
+
[style.height]="height ?? null"
|
|
60
|
+
role="alertdialog"
|
|
61
|
+
aria-modal="true"
|
|
62
|
+
>
|
|
63
|
+
@if (!hideCloseButton) {
|
|
64
|
+
<button
|
|
65
|
+
type="button"
|
|
66
|
+
class="salas-dialog-close"
|
|
67
|
+
aria-label="Close"
|
|
68
|
+
(click)="closeDialog()"
|
|
69
|
+
>
|
|
70
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>
|
|
71
|
+
</button>
|
|
72
|
+
}
|
|
73
|
+
<ng-content select="salas-dialog-content"></ng-content>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
}
|
|
77
|
+
`,
|
|
78
|
+
styles: [`
|
|
79
|
+
.salas-dialog-trigger-wrapper {
|
|
80
|
+
display: inline-block;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.salas-dialog-overlay {
|
|
84
|
+
position: fixed;
|
|
85
|
+
inset: 0;
|
|
86
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
87
|
+
z-index: 50;
|
|
88
|
+
animation: salas-dialog-fade-in 0.15s ease;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.salas-dialog-container {
|
|
92
|
+
position: fixed;
|
|
93
|
+
inset: 0;
|
|
94
|
+
display: flex;
|
|
95
|
+
align-items: center;
|
|
96
|
+
justify-content: center;
|
|
97
|
+
padding: 1rem;
|
|
98
|
+
z-index: 51;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.salas-dialog-panel {
|
|
102
|
+
position: relative;
|
|
103
|
+
background-color: var(--salas-bg-elevated, #fff);
|
|
104
|
+
color: var(--salas-text, #111827);
|
|
105
|
+
border-radius: 0.75rem;
|
|
106
|
+
border: 1px solid var(--salas-gray-200, #e5e7eb);
|
|
107
|
+
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
|
|
108
|
+
padding: 1.5rem;
|
|
109
|
+
width: 100%;
|
|
110
|
+
max-width: 32rem;
|
|
111
|
+
max-height: 85vh;
|
|
112
|
+
overflow: auto;
|
|
113
|
+
animation: salas-dialog-scale-in 0.15s ease;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.salas-dialog-panel--sm {
|
|
117
|
+
max-width: 22rem;
|
|
118
|
+
padding: 1.25rem;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.salas-dialog-close {
|
|
122
|
+
position: absolute;
|
|
123
|
+
top: 1rem;
|
|
124
|
+
right: 1rem;
|
|
125
|
+
display: flex;
|
|
126
|
+
align-items: center;
|
|
127
|
+
justify-content: center;
|
|
128
|
+
width: 1.5rem;
|
|
129
|
+
height: 1.5rem;
|
|
130
|
+
border: none;
|
|
131
|
+
background: transparent;
|
|
132
|
+
color: var(--salas-text-muted, #6b7280);
|
|
133
|
+
cursor: pointer;
|
|
134
|
+
border-radius: 0.25rem;
|
|
135
|
+
padding: 0;
|
|
136
|
+
transition: color 0.15s, background-color 0.15s;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.salas-dialog-close:hover {
|
|
140
|
+
background-color: var(--salas-gray-100, #f3f4f6);
|
|
141
|
+
color: var(--salas-text, #111827);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
:host-context([data-theme="dark"]) .salas-dialog-panel {
|
|
145
|
+
border-color: var(--salas-gray-200);
|
|
146
|
+
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
@keyframes salas-dialog-fade-in {
|
|
150
|
+
from { opacity: 0; }
|
|
151
|
+
to { opacity: 1; }
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
@keyframes salas-dialog-scale-in {
|
|
155
|
+
from { opacity: 0; transform: scale(0.96); }
|
|
156
|
+
to { opacity: 1; transform: scale(1); }
|
|
157
|
+
}
|
|
158
|
+
`],
|
|
159
|
+
})
|
|
160
|
+
export class SalasDialogComponent {
|
|
161
|
+
@Input() open?: boolean;
|
|
162
|
+
@Input() width?: string;
|
|
163
|
+
@Input() height?: string;
|
|
164
|
+
@Input() size?: DialogSize;
|
|
165
|
+
@Input() closeOnOverlayClick = true;
|
|
166
|
+
@Input() hideCloseButton = false;
|
|
167
|
+
|
|
168
|
+
@Output() openChange = new EventEmitter<boolean>();
|
|
169
|
+
|
|
170
|
+
internalOpen = false;
|
|
171
|
+
|
|
172
|
+
get isOpen(): boolean {
|
|
173
|
+
return this.open ?? this.internalOpen;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
get effectiveSize(): DialogSize {
|
|
177
|
+
return this.size ?? 'default';
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
openDialog(): void {
|
|
181
|
+
if (this.open === undefined) {
|
|
182
|
+
this.internalOpen = true;
|
|
183
|
+
}
|
|
184
|
+
this.openChange.emit(true);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
closeDialog(): void {
|
|
188
|
+
if (this.open === undefined) {
|
|
189
|
+
this.internalOpen = false;
|
|
190
|
+
}
|
|
191
|
+
this.openChange.emit(false);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
onOverlayClick(): void {
|
|
195
|
+
if (this.closeOnOverlayClick) {
|
|
196
|
+
this.closeDialog();
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
onContainerClick(event: MouseEvent): void {
|
|
201
|
+
if ((event.target as HTMLElement).classList.contains('salas-dialog-container') && this.closeOnOverlayClick) {
|
|
202
|
+
this.closeDialog();
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
@HostListener('document:keydown.escape')
|
|
207
|
+
onEscapeKey(): void {
|
|
208
|
+
if (this.isOpen) {
|
|
209
|
+
this.closeDialog();
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { SalasDialogComponent } from './dialog.component';
|
|
3
|
+
import { SalasDialogTriggerComponent } from './dialog-trigger.component';
|
|
4
|
+
import { SalasDialogContentComponent } from './dialog-content.component';
|
|
5
|
+
import { SalasDialogHeaderComponent } from './dialog-header.component';
|
|
6
|
+
import { SalasDialogTitleComponent } from './dialog-title.component';
|
|
7
|
+
import { SalasDialogDescriptionComponent } from './dialog-description.component';
|
|
8
|
+
import { SalasDialogFooterComponent } from './dialog-footer.component';
|
|
9
|
+
|
|
10
|
+
@NgModule({
|
|
11
|
+
imports: [
|
|
12
|
+
SalasDialogComponent,
|
|
13
|
+
SalasDialogTriggerComponent,
|
|
14
|
+
SalasDialogContentComponent,
|
|
15
|
+
SalasDialogHeaderComponent,
|
|
16
|
+
SalasDialogTitleComponent,
|
|
17
|
+
SalasDialogDescriptionComponent,
|
|
18
|
+
SalasDialogFooterComponent,
|
|
19
|
+
],
|
|
20
|
+
exports: [
|
|
21
|
+
SalasDialogComponent,
|
|
22
|
+
SalasDialogTriggerComponent,
|
|
23
|
+
SalasDialogContentComponent,
|
|
24
|
+
SalasDialogHeaderComponent,
|
|
25
|
+
SalasDialogTitleComponent,
|
|
26
|
+
SalasDialogDescriptionComponent,
|
|
27
|
+
SalasDialogFooterComponent,
|
|
28
|
+
],
|
|
29
|
+
})
|
|
30
|
+
export class SalasDialogModule {}
|
|
31
|
+
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { Component, Input, forwardRef, ViewChild, ElementRef, AfterViewInit } from '@angular/core';
|
|
2
|
+
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
3
|
+
import { cn } from '../utils';
|
|
4
|
+
import { LucideAngularModule } from 'lucide-angular';
|
|
5
|
+
import { CommonModule } from '@angular/common';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Input component types
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export type InputSize = 'sm' | 'md' | 'lg';
|
|
12
|
+
export type InputVariant = 'default' | 'error' | 'success';
|
|
13
|
+
|
|
14
|
+
export interface InputProps {
|
|
15
|
+
size?: InputSize;
|
|
16
|
+
variant?: InputVariant;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
readonly?: boolean;
|
|
19
|
+
required?: boolean;
|
|
20
|
+
placeholder?: string;
|
|
21
|
+
type?: 'text' | 'email' | 'password' | 'number' | 'tel' | 'url' | 'search';
|
|
22
|
+
value?: string;
|
|
23
|
+
name?: string;
|
|
24
|
+
id?: string;
|
|
25
|
+
autocomplete?: string;
|
|
26
|
+
maxlength?: number;
|
|
27
|
+
minlength?: number;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@Component({
|
|
32
|
+
selector: 'salas-input',
|
|
33
|
+
standalone: true,
|
|
34
|
+
imports: [CommonModule, LucideAngularModule],
|
|
35
|
+
template: `
|
|
36
|
+
<div [class]="wrapperClasses">
|
|
37
|
+
<input
|
|
38
|
+
[id]="id"
|
|
39
|
+
[name]="name"
|
|
40
|
+
[type]="type"
|
|
41
|
+
[placeholder]="placeholder"
|
|
42
|
+
[disabled]="disabled"
|
|
43
|
+
[readonly]="readonly"
|
|
44
|
+
[required]="required"
|
|
45
|
+
[attr.maxlength]="maxlength ?? null"
|
|
46
|
+
[attr.minlength]="minlength ?? null"
|
|
47
|
+
[autocomplete]="autocomplete"
|
|
48
|
+
[class]="inputClasses"
|
|
49
|
+
(input)="onInput($event)"
|
|
50
|
+
(blur)="onBlur()"
|
|
51
|
+
(focus)="onFocus()"
|
|
52
|
+
[attr.aria-invalid]="variant === 'error'"
|
|
53
|
+
[attr.aria-describedby]="id ? id + '-hint' : null"
|
|
54
|
+
#inputRef
|
|
55
|
+
/>
|
|
56
|
+
@if (variant === 'error') {
|
|
57
|
+
<lucide-icon name="x" [size]="iconSize" class="salas-input-icon salas-input-icon--error" />
|
|
58
|
+
}
|
|
59
|
+
@if (variant === 'success') {
|
|
60
|
+
<lucide-icon name="check" [size]="iconSize" class="salas-input-icon salas-input-icon--success" />
|
|
61
|
+
}
|
|
62
|
+
</div>
|
|
63
|
+
`,
|
|
64
|
+
styles: [`
|
|
65
|
+
.salas-input-wrapper {
|
|
66
|
+
position: relative;
|
|
67
|
+
display: inline-block;
|
|
68
|
+
width: 100%;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.salas-input {
|
|
72
|
+
width: 100%;
|
|
73
|
+
border-radius: 0.375rem;
|
|
74
|
+
border: 1px solid var(--salas-gray-300);
|
|
75
|
+
background-color: white;
|
|
76
|
+
padding: 0 0.75rem;
|
|
77
|
+
font-size: 0.875rem;
|
|
78
|
+
transition: all 0.2s;
|
|
79
|
+
outline: none;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.salas-input::placeholder {
|
|
83
|
+
color: var(--salas-gray-400);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.salas-input:focus {
|
|
87
|
+
border-color: var(--salas-primary-500);
|
|
88
|
+
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.salas-input:disabled {
|
|
92
|
+
background-color: var(--salas-gray-50);
|
|
93
|
+
cursor: not-allowed;
|
|
94
|
+
opacity: 0.6;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.salas-input:read-only {
|
|
98
|
+
background-color: var(--salas-gray-50);
|
|
99
|
+
cursor: default;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/* Variants */
|
|
103
|
+
.salas-input--error {
|
|
104
|
+
border-color: var(--salas-destructive-500);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.salas-input--error:focus {
|
|
108
|
+
border-color: var(--salas-destructive-500);
|
|
109
|
+
box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.salas-input--success {
|
|
113
|
+
border-color: var(--salas-success-500);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.salas-input--success:focus {
|
|
117
|
+
border-color: var(--salas-success-500);
|
|
118
|
+
box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/* Sizes */
|
|
122
|
+
.salas-input--sm {
|
|
123
|
+
height: 2rem;
|
|
124
|
+
padding: 0 0.625rem;
|
|
125
|
+
font-size: 0.8125rem;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.salas-input--md {
|
|
129
|
+
height: 2.5rem;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.salas-input--lg {
|
|
133
|
+
height: 3rem;
|
|
134
|
+
padding: 0 1rem;
|
|
135
|
+
font-size: 1rem;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.salas-input-icon {
|
|
139
|
+
position: absolute;
|
|
140
|
+
right: 0.75rem;
|
|
141
|
+
top: 50%;
|
|
142
|
+
transform: translateY(-50%);
|
|
143
|
+
pointer-events: none;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.salas-input-icon--error {
|
|
147
|
+
color: var(--salas-destructive-500);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.salas-input-icon--success {
|
|
151
|
+
color: var(--salas-success-500);
|
|
152
|
+
}
|
|
153
|
+
`],
|
|
154
|
+
providers: [
|
|
155
|
+
{
|
|
156
|
+
provide: NG_VALUE_ACCESSOR,
|
|
157
|
+
useExisting: forwardRef(() => SalasInputComponent),
|
|
158
|
+
multi: true,
|
|
159
|
+
},
|
|
160
|
+
],
|
|
161
|
+
})
|
|
162
|
+
export class SalasInputComponent implements ControlValueAccessor, InputProps, AfterViewInit {
|
|
163
|
+
@ViewChild('inputRef', { static: false }) inputRef?: ElementRef<HTMLInputElement>;
|
|
164
|
+
|
|
165
|
+
@Input() size: InputSize = 'md';
|
|
166
|
+
@Input() variant: InputVariant = 'default';
|
|
167
|
+
@Input() disabled = false;
|
|
168
|
+
@Input() readonly = false;
|
|
169
|
+
@Input() required = false;
|
|
170
|
+
@Input() placeholder = '';
|
|
171
|
+
@Input() type: InputProps['type'] = 'text';
|
|
172
|
+
@Input() name = '';
|
|
173
|
+
@Input() id = '';
|
|
174
|
+
@Input() autocomplete = '';
|
|
175
|
+
@Input() maxlength?: number;
|
|
176
|
+
@Input() minlength?: number;
|
|
177
|
+
|
|
178
|
+
private onChange: (value: string) => void = () => {};
|
|
179
|
+
private onTouched: () => void = () => {};
|
|
180
|
+
|
|
181
|
+
get wrapperClasses(): string {
|
|
182
|
+
return cn('salas-input-wrapper');
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
get inputClasses(): string {
|
|
186
|
+
return cn(
|
|
187
|
+
'salas-input',
|
|
188
|
+
`salas-input--${this.size}`,
|
|
189
|
+
this.variant !== 'default' && `salas-input--${this.variant}`
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
get iconSize(): number {
|
|
194
|
+
return this.size === 'sm' ? 16 : this.size === 'lg' ? 20 : 18;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
ngAfterViewInit(): void {}
|
|
198
|
+
|
|
199
|
+
onInput(event: Event): void {
|
|
200
|
+
const target = event.target as HTMLInputElement;
|
|
201
|
+
this.onChange(target.value);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
onBlur(): void {
|
|
205
|
+
this.onTouched();
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
onFocus(): void {}
|
|
209
|
+
|
|
210
|
+
// ControlValueAccessor
|
|
211
|
+
writeValue(value: string | null | undefined): void {
|
|
212
|
+
const newValue = value ?? '';
|
|
213
|
+
if (this.inputRef?.nativeElement) {
|
|
214
|
+
this.inputRef.nativeElement.value = newValue;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
registerOnChange(fn: (value: string) => void): void {
|
|
219
|
+
this.onChange = fn;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
registerOnTouched(fn: () => void): void {
|
|
223
|
+
this.onTouched = fn;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
setDisabledState(isDisabled: boolean): void {
|
|
227
|
+
this.disabled = isDisabled;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Component, Input, ViewEncapsulation } from '@angular/core';
|
|
2
|
+
import { cn } from '../utils';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'salas-scroll-area',
|
|
6
|
+
standalone: true,
|
|
7
|
+
imports: [],
|
|
8
|
+
encapsulation: ViewEncapsulation.None,
|
|
9
|
+
host: {
|
|
10
|
+
'[style.display]': '"block"',
|
|
11
|
+
'[style.overflow]': '"hidden"',
|
|
12
|
+
'[style.position]': '"relative"',
|
|
13
|
+
},
|
|
14
|
+
template: `
|
|
15
|
+
<div class="salas-scroll-area-viewport" [class.salas-scroll-area-viewport--horizontal]="orientation === 'horizontal' || orientation === 'both'">
|
|
16
|
+
<ng-content></ng-content>
|
|
17
|
+
</div>
|
|
18
|
+
<ng-content select="salas-scroll-bar"></ng-content>
|
|
19
|
+
`,
|
|
20
|
+
styles: [`
|
|
21
|
+
.salas-scroll-area-viewport {
|
|
22
|
+
width: 100%;
|
|
23
|
+
height: 100%;
|
|
24
|
+
overflow-y: auto;
|
|
25
|
+
overflow-x: hidden;
|
|
26
|
+
scrollbar-width: thin;
|
|
27
|
+
scrollbar-color: var(--salas-gray-300) transparent;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.salas-scroll-area-viewport--horizontal {
|
|
31
|
+
overflow-x: auto;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.salas-scroll-area-viewport::-webkit-scrollbar {
|
|
35
|
+
width: 0.5rem;
|
|
36
|
+
height: 0.5rem;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.salas-scroll-area-viewport::-webkit-scrollbar-track {
|
|
40
|
+
background: transparent;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.salas-scroll-area-viewport::-webkit-scrollbar-thumb {
|
|
44
|
+
background-color: var(--salas-gray-300);
|
|
45
|
+
border-radius: 9999px;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.salas-scroll-area-viewport::-webkit-scrollbar-thumb:hover {
|
|
49
|
+
background-color: var(--salas-gray-400);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.salas-scroll-area-viewport::-webkit-scrollbar-corner {
|
|
53
|
+
background: transparent;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* Dark theme */
|
|
57
|
+
[data-theme='dark'] .salas-scroll-area-viewport {
|
|
58
|
+
scrollbar-color: var(--salas-gray-700) transparent;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
[data-theme='dark'] .salas-scroll-area-viewport::-webkit-scrollbar-thumb {
|
|
62
|
+
background-color: var(--salas-gray-700);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
[data-theme='dark'] .salas-scroll-area-viewport::-webkit-scrollbar-thumb:hover {
|
|
66
|
+
background-color: var(--salas-gray-600);
|
|
67
|
+
}
|
|
68
|
+
`],
|
|
69
|
+
})
|
|
70
|
+
export class SalasScrollAreaComponent {
|
|
71
|
+
@Input() orientation: 'vertical' | 'horizontal' | 'both' = 'vertical';
|
|
72
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { SalasScrollAreaComponent } from './scroll-area.component';
|
|
3
|
+
import { SalasScrollBarComponent } from './scroll-bar.component';
|
|
4
|
+
|
|
5
|
+
@NgModule({
|
|
6
|
+
imports: [SalasScrollAreaComponent, SalasScrollBarComponent],
|
|
7
|
+
exports: [SalasScrollAreaComponent, SalasScrollBarComponent],
|
|
8
|
+
})
|
|
9
|
+
export class SalasScrollAreaModule {}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Component, Input, ViewEncapsulation } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'salas-scroll-bar',
|
|
5
|
+
standalone: true,
|
|
6
|
+
imports: [],
|
|
7
|
+
encapsulation: ViewEncapsulation.None,
|
|
8
|
+
host: {
|
|
9
|
+
style: 'display: none;',
|
|
10
|
+
},
|
|
11
|
+
template: ``,
|
|
12
|
+
})
|
|
13
|
+
export class SalasScrollBarComponent {
|
|
14
|
+
@Input() orientation: 'horizontal' | 'vertical' = 'vertical';
|
|
15
|
+
}
|