@salas-ds/cli 0.1.0 → 0.2.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/dist/index.js +253 -86
- 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 +18 -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 +20 -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 +68 -0
- package/templates/angular/sidebar/sidebar-trigger.component.ts +58 -0
- package/templates/angular/sidebar/sidebar.component.ts +196 -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,58 @@
|
|
|
1
|
+
import { Component, Optional } from '@angular/core';
|
|
2
|
+
import { SidebarService } from './sidebar.service';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'salas-sidebar-trigger',
|
|
6
|
+
standalone: true,
|
|
7
|
+
imports: [],
|
|
8
|
+
template: `
|
|
9
|
+
<button type="button" class="salas-sidebar-trigger" [class.salas-sidebar-trigger--right]="isRight" (click)="onClick()" aria-label="Toggle sidebar">
|
|
10
|
+
@if (isRight) {
|
|
11
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
12
|
+
<rect width="18" height="18" x="3" y="3" rx="2"/>
|
|
13
|
+
<path d="M15 3v18"/>
|
|
14
|
+
</svg>
|
|
15
|
+
} @else {
|
|
16
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
17
|
+
<rect width="18" height="18" x="3" y="3" rx="2"/>
|
|
18
|
+
<path d="M9 3v18"/>
|
|
19
|
+
</svg>
|
|
20
|
+
}
|
|
21
|
+
</button>
|
|
22
|
+
`,
|
|
23
|
+
styles: [`
|
|
24
|
+
.salas-sidebar-trigger {
|
|
25
|
+
display: inline-flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
width: 2.5rem;
|
|
29
|
+
height: 2.5rem;
|
|
30
|
+
border-radius: 0.375rem;
|
|
31
|
+
border: none;
|
|
32
|
+
background-color: transparent;
|
|
33
|
+
color: var(--salas-text);
|
|
34
|
+
cursor: pointer;
|
|
35
|
+
transition: background-color 0.2s, color 0.2s;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.salas-sidebar-trigger:hover {
|
|
39
|
+
background-color: var(--salas-gray-100);
|
|
40
|
+
color: var(--salas-text);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.salas-sidebar-trigger svg {
|
|
44
|
+
display: block;
|
|
45
|
+
}
|
|
46
|
+
`],
|
|
47
|
+
})
|
|
48
|
+
export class SalasSidebarTriggerComponent {
|
|
49
|
+
constructor(@Optional() private sidebar: SidebarService | null) {}
|
|
50
|
+
|
|
51
|
+
get isRight(): boolean {
|
|
52
|
+
return this.sidebar?.side === 'right';
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
onClick(): void {
|
|
56
|
+
this.sidebar?.toggleSidebar();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { Component, Input, Optional, OnInit, ViewEncapsulation } from '@angular/core';
|
|
2
|
+
import { cn } from '../utils';
|
|
3
|
+
import { SidebarService } from './sidebar.service';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Sidebar component types (shadcn-style)
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export type SidebarSide = 'left' | 'right';
|
|
10
|
+
export type SidebarVariant = 'sidebar' | 'floating' | 'inset';
|
|
11
|
+
export type SidebarCollapsible = 'offcanvas' | 'icon' | 'none';
|
|
12
|
+
|
|
13
|
+
export interface SidebarProps {
|
|
14
|
+
side?: SidebarSide;
|
|
15
|
+
variant?: SidebarVariant;
|
|
16
|
+
collapsible?: SidebarCollapsible;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface SidebarProviderProps {
|
|
20
|
+
defaultOpen?: boolean;
|
|
21
|
+
open?: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@Component({
|
|
26
|
+
selector: 'salas-sidebar',
|
|
27
|
+
standalone: true,
|
|
28
|
+
imports: [],
|
|
29
|
+
encapsulation: ViewEncapsulation.None,
|
|
30
|
+
template: `
|
|
31
|
+
<aside
|
|
32
|
+
[class]="sidebarClasses"
|
|
33
|
+
[attr.data-side]="side"
|
|
34
|
+
[attr.data-state]="effectiveState"
|
|
35
|
+
[attr.data-collapsible]="collapsible"
|
|
36
|
+
[attr.data-variant]="variant"
|
|
37
|
+
[attr.data-mobile]="sidebar?.isMobile ?? false"
|
|
38
|
+
>
|
|
39
|
+
<ng-content></ng-content>
|
|
40
|
+
</aside>
|
|
41
|
+
`,
|
|
42
|
+
styles: [`
|
|
43
|
+
:host {
|
|
44
|
+
display: block;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.salas-sidebar {
|
|
48
|
+
--salas-sidebar-width: 16rem;
|
|
49
|
+
--salas-sidebar-width-icon: 3rem;
|
|
50
|
+
background-color: var(--salas-bg-elevated);
|
|
51
|
+
color: var(--salas-text);
|
|
52
|
+
border-right: 1px solid var(--salas-gray-200);
|
|
53
|
+
display: flex;
|
|
54
|
+
flex-direction: column;
|
|
55
|
+
height: 100%;
|
|
56
|
+
min-height: 100vh;
|
|
57
|
+
position: fixed;
|
|
58
|
+
top: 0;
|
|
59
|
+
z-index: 10;
|
|
60
|
+
transition: width 0.2s ease, transform 0.2s ease, left 0.2s ease, right 0.2s ease;
|
|
61
|
+
width: var(--salas-sidebar-width);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.salas-sidebar[data-side="left"] {
|
|
65
|
+
left: 0;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.salas-sidebar[data-side="right"] {
|
|
69
|
+
right: 0;
|
|
70
|
+
border-right: none;
|
|
71
|
+
border-left: 1px solid var(--salas-gray-200);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.salas-sidebar[data-collapsible="offcanvas"][data-mobile="true"][data-state="collapsed"] {
|
|
75
|
+
transform: translateX(-100%);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.salas-sidebar[data-side="right"][data-collapsible="offcanvas"][data-mobile="true"][data-state="collapsed"] {
|
|
79
|
+
transform: translateX(100%);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.salas-sidebar[data-collapsible="offcanvas"][data-mobile="false"][data-state="collapsed"] {
|
|
83
|
+
transform: translateX(-100%);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.salas-sidebar[data-side="right"][data-collapsible="offcanvas"][data-mobile="false"][data-state="collapsed"] {
|
|
87
|
+
transform: translateX(100%);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.salas-sidebar[data-collapsible="icon"][data-state="collapsed"] {
|
|
91
|
+
width: var(--salas-sidebar-width-icon);
|
|
92
|
+
overflow: hidden;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.salas-sidebar[data-variant="floating"] {
|
|
96
|
+
margin: 0.5rem;
|
|
97
|
+
border-radius: 0.5rem;
|
|
98
|
+
height: calc(100vh - 1rem);
|
|
99
|
+
border: 1px solid var(--salas-gray-200);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.salas-sidebar[data-variant="inset"] {
|
|
103
|
+
position: relative;
|
|
104
|
+
height: 100%;
|
|
105
|
+
border-radius: 0.5rem;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/* Collapsed state: hide everything except icons */
|
|
109
|
+
.salas-sidebar[data-collapsible="icon"][data-state="collapsed"] salas-sidebar-header {
|
|
110
|
+
display: none !important;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.salas-sidebar[data-collapsible="icon"][data-state="collapsed"] salas-sidebar-footer {
|
|
114
|
+
display: none !important;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.salas-sidebar[data-collapsible="icon"][data-state="collapsed"] salas-sidebar-group-label {
|
|
118
|
+
display: none !important;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.salas-sidebar[data-collapsible="icon"][data-state="collapsed"] .salas-sidebar-content {
|
|
122
|
+
padding: 0.25rem 0 !important;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.salas-sidebar[data-collapsible="icon"][data-state="collapsed"] .salas-sidebar-group {
|
|
126
|
+
margin-bottom: 0 !important;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.salas-sidebar[data-collapsible="icon"][data-state="collapsed"] .salas-sidebar-group-content {
|
|
130
|
+
gap: 0.25rem !important;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.salas-sidebar[data-collapsible="icon"][data-state="collapsed"] .salas-sidebar-menu {
|
|
134
|
+
padding: 0 !important;
|
|
135
|
+
align-items: center !important;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.salas-sidebar[data-collapsible="icon"][data-state="collapsed"] salas-sidebar-menu-button {
|
|
139
|
+
display: flex !important;
|
|
140
|
+
justify-content: center !important;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.salas-sidebar[data-collapsible="icon"][data-state="collapsed"] .salas-sidebar-menu-button {
|
|
144
|
+
justify-content: center !important;
|
|
145
|
+
padding: 0.5rem !important;
|
|
146
|
+
gap: 0 !important;
|
|
147
|
+
overflow: hidden !important;
|
|
148
|
+
width: auto !important;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.salas-sidebar[data-collapsible="icon"][data-state="collapsed"] .salas-sidebar-menu-button > *:not(.salas-sidebar-menu-icon) {
|
|
152
|
+
display: none !important;
|
|
153
|
+
width: 0 !important;
|
|
154
|
+
height: 0 !important;
|
|
155
|
+
overflow: hidden !important;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.salas-sidebar[data-collapsible="icon"][data-state="collapsed"] .salas-sidebar-menu-icon {
|
|
159
|
+
flex-shrink: 0 !important;
|
|
160
|
+
}
|
|
161
|
+
`],
|
|
162
|
+
})
|
|
163
|
+
export class SalasSidebarComponent implements SidebarProps, OnInit {
|
|
164
|
+
@Input() side: SidebarSide = 'left';
|
|
165
|
+
@Input() variant: SidebarVariant = 'sidebar';
|
|
166
|
+
@Input() collapsible: SidebarCollapsible = 'icon';
|
|
167
|
+
|
|
168
|
+
constructor(@Optional() public sidebar: SidebarService | null) {}
|
|
169
|
+
|
|
170
|
+
ngOnInit(): void {
|
|
171
|
+
if (this.sidebar) {
|
|
172
|
+
this.sidebar.collapsible = this.collapsible;
|
|
173
|
+
this.sidebar.side = this.side;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
get effectiveState(): string {
|
|
178
|
+
if (!this.sidebar) return 'expanded';
|
|
179
|
+
if (this.sidebar.isMobile) {
|
|
180
|
+
return this.sidebar.openMobile ? 'expanded' : 'collapsed';
|
|
181
|
+
}
|
|
182
|
+
if (this.collapsible === 'offcanvas') {
|
|
183
|
+
return this.sidebar.open ? 'expanded' : 'collapsed';
|
|
184
|
+
}
|
|
185
|
+
return this.sidebar.state;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
get sidebarClasses(): string {
|
|
189
|
+
return cn(
|
|
190
|
+
'salas-sidebar',
|
|
191
|
+
`salas-sidebar--${this.side}`,
|
|
192
|
+
this.variant !== 'sidebar' && `salas-sidebar--${this.variant}`,
|
|
193
|
+
`salas-sidebar--collapsible-${this.collapsible}`
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { SalasSidebarProviderComponent } from './sidebar-provider.component';
|
|
3
|
+
import { SalasSidebarComponent } from './sidebar.component';
|
|
4
|
+
import { SalasSidebarHeaderComponent } from './sidebar-header.component';
|
|
5
|
+
import { SalasSidebarFooterComponent } from './sidebar-footer.component';
|
|
6
|
+
import { SalasSidebarContentComponent } from './sidebar-content.component';
|
|
7
|
+
import { SalasSidebarGroupComponent } from './sidebar-group.component';
|
|
8
|
+
import { SalasSidebarGroupLabelComponent } from './sidebar-group-label.component';
|
|
9
|
+
import { SalasSidebarGroupContentComponent } from './sidebar-group-content.component';
|
|
10
|
+
import { SalasSidebarTriggerComponent } from './sidebar-trigger.component';
|
|
11
|
+
import { SalasSidebarMenuComponent } from './sidebar-menu.component';
|
|
12
|
+
import { SalasSidebarMenuItemComponent } from './sidebar-menu-item.component';
|
|
13
|
+
import { SalasSidebarMenuButtonComponent } from './sidebar-menu-button.component';
|
|
14
|
+
import { SalasSidebarInsetComponent } from './sidebar-inset.component';
|
|
15
|
+
|
|
16
|
+
@NgModule({
|
|
17
|
+
imports: [
|
|
18
|
+
SalasSidebarProviderComponent,
|
|
19
|
+
SalasSidebarComponent,
|
|
20
|
+
SalasSidebarHeaderComponent,
|
|
21
|
+
SalasSidebarFooterComponent,
|
|
22
|
+
SalasSidebarContentComponent,
|
|
23
|
+
SalasSidebarGroupComponent,
|
|
24
|
+
SalasSidebarGroupLabelComponent,
|
|
25
|
+
SalasSidebarGroupContentComponent,
|
|
26
|
+
SalasSidebarTriggerComponent,
|
|
27
|
+
SalasSidebarMenuComponent,
|
|
28
|
+
SalasSidebarMenuItemComponent,
|
|
29
|
+
SalasSidebarMenuButtonComponent,
|
|
30
|
+
SalasSidebarInsetComponent,
|
|
31
|
+
],
|
|
32
|
+
exports: [
|
|
33
|
+
SalasSidebarProviderComponent,
|
|
34
|
+
SalasSidebarComponent,
|
|
35
|
+
SalasSidebarHeaderComponent,
|
|
36
|
+
SalasSidebarFooterComponent,
|
|
37
|
+
SalasSidebarContentComponent,
|
|
38
|
+
SalasSidebarGroupComponent,
|
|
39
|
+
SalasSidebarGroupLabelComponent,
|
|
40
|
+
SalasSidebarGroupContentComponent,
|
|
41
|
+
SalasSidebarTriggerComponent,
|
|
42
|
+
SalasSidebarMenuComponent,
|
|
43
|
+
SalasSidebarMenuItemComponent,
|
|
44
|
+
SalasSidebarMenuButtonComponent,
|
|
45
|
+
SalasSidebarInsetComponent,
|
|
46
|
+
],
|
|
47
|
+
})
|
|
48
|
+
export class SalasSidebarModule {}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
export type SidebarState = 'expanded' | 'collapsed';
|
|
4
|
+
|
|
5
|
+
@Injectable()
|
|
6
|
+
export class SidebarService {
|
|
7
|
+
private _open = true;
|
|
8
|
+
private _openMobile = false;
|
|
9
|
+
private _isMobile = false;
|
|
10
|
+
private _state: SidebarState = 'expanded';
|
|
11
|
+
private _collapsible: 'offcanvas' | 'icon' | 'none' = 'icon';
|
|
12
|
+
private _side: 'left' | 'right' = 'left';
|
|
13
|
+
private onOpenChangeCallback: ((open: boolean) => void) | null = null;
|
|
14
|
+
|
|
15
|
+
get open(): boolean {
|
|
16
|
+
return this._open;
|
|
17
|
+
}
|
|
18
|
+
set open(value: boolean) {
|
|
19
|
+
this._open = value;
|
|
20
|
+
this.onOpenChangeCallback?.(value);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
get openMobile(): boolean {
|
|
24
|
+
return this._openMobile;
|
|
25
|
+
}
|
|
26
|
+
set openMobile(value: boolean) {
|
|
27
|
+
this._openMobile = value;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
get isMobile(): boolean {
|
|
31
|
+
return this._isMobile;
|
|
32
|
+
}
|
|
33
|
+
set isMobile(value: boolean) {
|
|
34
|
+
this._isMobile = value;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
get state(): SidebarState {
|
|
38
|
+
return this._state;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
get collapsible(): 'offcanvas' | 'icon' | 'none' {
|
|
42
|
+
return this._collapsible;
|
|
43
|
+
}
|
|
44
|
+
set collapsible(value: 'offcanvas' | 'icon' | 'none') {
|
|
45
|
+
this._collapsible = value;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
get side(): 'left' | 'right' {
|
|
49
|
+
return this._side;
|
|
50
|
+
}
|
|
51
|
+
set side(value: 'left' | 'right') {
|
|
52
|
+
this._side = value;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
setOpen(value: boolean): void {
|
|
56
|
+
this.open = value;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
setOpenMobile(value: boolean): void {
|
|
60
|
+
this._openMobile = value;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
setState(state: SidebarState): void {
|
|
64
|
+
this._state = state;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
toggleSidebar(): void {
|
|
68
|
+
if (this._isMobile) {
|
|
69
|
+
this._openMobile = !this._openMobile;
|
|
70
|
+
} else {
|
|
71
|
+
if (this._collapsible === 'icon') {
|
|
72
|
+
this._state = this._state === 'expanded' ? 'collapsed' : 'expanded';
|
|
73
|
+
} else {
|
|
74
|
+
this.open = !this.open;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
setOpenChange(callback: (open: boolean) => void): void {
|
|
80
|
+
this.onOpenChangeCallback = callback;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
init(defaultOpen: boolean, open?: boolean, onOpenChange?: (open: boolean) => void): void {
|
|
84
|
+
if (open !== undefined) {
|
|
85
|
+
this._open = open;
|
|
86
|
+
} else {
|
|
87
|
+
this._open = defaultOpen;
|
|
88
|
+
}
|
|
89
|
+
if (onOpenChange) {
|
|
90
|
+
this.onOpenChangeCallback = onOpenChange;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Component, Input, ViewEncapsulation } from '@angular/core';
|
|
2
|
+
import { cn } from '../utils';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'salas-skeleton',
|
|
6
|
+
standalone: true,
|
|
7
|
+
imports: [],
|
|
8
|
+
encapsulation: ViewEncapsulation.None,
|
|
9
|
+
host: {
|
|
10
|
+
'[class]': 'hostClasses',
|
|
11
|
+
},
|
|
12
|
+
template: ``,
|
|
13
|
+
styles: [`
|
|
14
|
+
@keyframes salas-skeleton-pulse {
|
|
15
|
+
0%, 100% { opacity: 1; }
|
|
16
|
+
50% { opacity: 0.5; }
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.salas-skeleton {
|
|
20
|
+
display: block;
|
|
21
|
+
border-radius: 0.375rem;
|
|
22
|
+
background-color: var(--salas-gray-200);
|
|
23
|
+
animation: salas-skeleton-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.salas-skeleton--circle {
|
|
27
|
+
border-radius: 9999px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
[data-theme='dark'] .salas-skeleton {
|
|
31
|
+
background-color: var(--salas-gray-800);
|
|
32
|
+
}
|
|
33
|
+
`],
|
|
34
|
+
})
|
|
35
|
+
export class SalasSkeletonComponent {
|
|
36
|
+
@Input() circle = false;
|
|
37
|
+
|
|
38
|
+
get hostClasses(): string {
|
|
39
|
+
return cn(
|
|
40
|
+
'salas-skeleton',
|
|
41
|
+
this.circle && 'salas-skeleton--circle',
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Component, Input, ViewEncapsulation } from '@angular/core';
|
|
2
|
+
import { cn } from '../utils';
|
|
3
|
+
|
|
4
|
+
export type SpinnerSize = 'sm' | 'default' | 'lg';
|
|
5
|
+
|
|
6
|
+
export interface SpinnerProps {
|
|
7
|
+
size?: SpinnerSize;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@Component({
|
|
12
|
+
selector: 'salas-spinner',
|
|
13
|
+
standalone: true,
|
|
14
|
+
imports: [],
|
|
15
|
+
encapsulation: ViewEncapsulation.None,
|
|
16
|
+
template: `
|
|
17
|
+
<svg
|
|
18
|
+
[class]="spinnerClasses"
|
|
19
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
20
|
+
viewBox="0 0 24 24"
|
|
21
|
+
fill="none"
|
|
22
|
+
stroke="currentColor"
|
|
23
|
+
stroke-width="2"
|
|
24
|
+
stroke-linecap="round"
|
|
25
|
+
stroke-linejoin="round"
|
|
26
|
+
role="status"
|
|
27
|
+
[attr.aria-label]="ariaLabel"
|
|
28
|
+
>
|
|
29
|
+
<path d="M21 12a9 9 0 1 1-6.219-8.56" />
|
|
30
|
+
</svg>
|
|
31
|
+
`,
|
|
32
|
+
styles: [`
|
|
33
|
+
.salas-spinner {
|
|
34
|
+
display: inline-block;
|
|
35
|
+
animation: spin 1s linear infinite;
|
|
36
|
+
color: var(--salas-primary-500);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.salas-spinner--sm {
|
|
40
|
+
width: 1rem;
|
|
41
|
+
height: 1rem;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.salas-spinner--default {
|
|
45
|
+
width: 1.25rem;
|
|
46
|
+
height: 1.25rem;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.salas-spinner--lg {
|
|
50
|
+
width: 1.5rem;
|
|
51
|
+
height: 1.5rem;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@keyframes spin {
|
|
55
|
+
from {
|
|
56
|
+
transform: rotate(0deg);
|
|
57
|
+
}
|
|
58
|
+
to {
|
|
59
|
+
transform: rotate(360deg);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
[data-theme='dark'] .salas-spinner {
|
|
64
|
+
color: var(--salas-primary-400);
|
|
65
|
+
}
|
|
66
|
+
`],
|
|
67
|
+
})
|
|
68
|
+
export class SalasSpinnerComponent implements SpinnerProps {
|
|
69
|
+
@Input() size: SpinnerSize = 'default';
|
|
70
|
+
@Input() ariaLabel = 'Loading';
|
|
71
|
+
|
|
72
|
+
get spinnerClasses(): string {
|
|
73
|
+
return cn('salas-spinner', `salas-spinner--${this.size}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Component, ViewEncapsulation } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'salas-table-body',
|
|
5
|
+
standalone: true,
|
|
6
|
+
imports: [],
|
|
7
|
+
encapsulation: ViewEncapsulation.None,
|
|
8
|
+
template: `
|
|
9
|
+
<tbody class="salas-table-body">
|
|
10
|
+
<ng-content></ng-content>
|
|
11
|
+
</tbody>
|
|
12
|
+
`,
|
|
13
|
+
styles: [`
|
|
14
|
+
salas-table-body {
|
|
15
|
+
display: contents;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.salas-table-body [data-slot="table-row"]:last-child {
|
|
19
|
+
border-bottom: 0;
|
|
20
|
+
}
|
|
21
|
+
`],
|
|
22
|
+
})
|
|
23
|
+
export class SalasTableBodyComponent {}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Component, ViewEncapsulation } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'salas-table-caption',
|
|
5
|
+
standalone: true,
|
|
6
|
+
imports: [],
|
|
7
|
+
encapsulation: ViewEncapsulation.None,
|
|
8
|
+
template: `
|
|
9
|
+
<caption class="salas-table-caption">
|
|
10
|
+
<ng-content></ng-content>
|
|
11
|
+
</caption>
|
|
12
|
+
`,
|
|
13
|
+
styles: [`
|
|
14
|
+
salas-table-caption {
|
|
15
|
+
display: contents;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.salas-table-caption {
|
|
19
|
+
margin-top: 1rem;
|
|
20
|
+
font-size: 0.875rem;
|
|
21
|
+
color: var(--salas-gray-500, #71717a);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
[data-theme='dark'] .salas-table-caption {
|
|
25
|
+
color: var(--salas-gray-400, #a1a1aa);
|
|
26
|
+
}
|
|
27
|
+
`],
|
|
28
|
+
})
|
|
29
|
+
export class SalasTableCaptionComponent {}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Component, Input, ViewEncapsulation } from '@angular/core';
|
|
2
|
+
import { cn } from '../utils';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'salas-table-cell',
|
|
6
|
+
standalone: true,
|
|
7
|
+
imports: [],
|
|
8
|
+
encapsulation: ViewEncapsulation.None,
|
|
9
|
+
template: `
|
|
10
|
+
<td [class]="cellClasses" data-slot="table-cell">
|
|
11
|
+
<ng-content></ng-content>
|
|
12
|
+
</td>
|
|
13
|
+
`,
|
|
14
|
+
styles: [`
|
|
15
|
+
salas-table-cell {
|
|
16
|
+
display: contents;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.salas-table-cell {
|
|
20
|
+
padding: 0.75rem 1rem;
|
|
21
|
+
vertical-align: middle;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.salas-table-cell--right {
|
|
25
|
+
text-align: right;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.salas-table-cell--center {
|
|
29
|
+
text-align: center;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.salas-table-cell--font-medium {
|
|
33
|
+
font-weight: 500;
|
|
34
|
+
}
|
|
35
|
+
`],
|
|
36
|
+
})
|
|
37
|
+
export class SalasTableCellComponent {
|
|
38
|
+
@Input() align: 'left' | 'right' | 'center' = 'left';
|
|
39
|
+
@Input() fontWeight: 'normal' | 'medium' = 'normal';
|
|
40
|
+
|
|
41
|
+
get cellClasses(): string {
|
|
42
|
+
return cn(
|
|
43
|
+
'salas-table-cell',
|
|
44
|
+
this.align === 'right' && 'salas-table-cell--right',
|
|
45
|
+
this.align === 'center' && 'salas-table-cell--center',
|
|
46
|
+
this.fontWeight === 'medium' && 'salas-table-cell--font-medium',
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Component, ViewEncapsulation } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'salas-table-footer',
|
|
5
|
+
standalone: true,
|
|
6
|
+
imports: [],
|
|
7
|
+
encapsulation: ViewEncapsulation.None,
|
|
8
|
+
template: `
|
|
9
|
+
<tfoot class="salas-table-footer">
|
|
10
|
+
<ng-content></ng-content>
|
|
11
|
+
</tfoot>
|
|
12
|
+
`,
|
|
13
|
+
styles: [`
|
|
14
|
+
salas-table-footer {
|
|
15
|
+
display: contents;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.salas-table-footer {
|
|
19
|
+
border-top: 1px solid var(--salas-gray-200, #e4e4e7);
|
|
20
|
+
font-weight: 500;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.salas-table-footer [data-slot="table-row"]:last-child {
|
|
24
|
+
border-bottom: 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
[data-theme='dark'] .salas-table-footer {
|
|
28
|
+
border-top-color: var(--salas-gray-800, #27272a);
|
|
29
|
+
}
|
|
30
|
+
`],
|
|
31
|
+
})
|
|
32
|
+
export class SalasTableFooterComponent {}
|