@sarasanalytics-com/design-system 0.0.3
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/.editorconfig +16 -0
- package/.eslintrc.json +22 -0
- package/.storybook/main.ts +21 -0
- package/.storybook/manager.ts +17 -0
- package/.storybook/preview-head.html +5 -0
- package/.storybook/preview.ts +65 -0
- package/.storybook/tsconfig.doc.json +10 -0
- package/.storybook/tsconfig.json +11 -0
- package/.storybook/typings.d.ts +4 -0
- package/.vscode/extensions.json +7 -0
- package/.vscode/launch.json +20 -0
- package/.vscode/settings.json +13 -0
- package/.vscode/tasks.json +42 -0
- package/README.md +27 -0
- package/angular.json +189 -0
- package/build-storybook.log +39 -0
- package/documentation.json +0 -0
- package/package.json +74 -0
- package/projects/component-library/README.md +24 -0
- package/projects/component-library/ng-package.json +8 -0
- package/projects/component-library/package.json +12 -0
- package/projects/component-library/src/interfaces/avatar-interface.ts +6 -0
- package/projects/component-library/src/interfaces/button-interface.ts +12 -0
- package/projects/component-library/src/interfaces/chip-interface.ts +11 -0
- package/projects/component-library/src/interfaces/grid-interface.ts +24 -0
- package/projects/component-library/src/interfaces/select-interface.ts +19 -0
- package/projects/component-library/src/interfaces/tab-interface.ts +6 -0
- package/projects/component-library/src/lib/avatar/avatar.component.css +48 -0
- package/projects/component-library/src/lib/avatar/avatar.component.html +5 -0
- package/projects/component-library/src/lib/avatar/avatar.component.spec.ts +23 -0
- package/projects/component-library/src/lib/avatar/avatar.component.ts +50 -0
- package/projects/component-library/src/lib/button/button.component.css +145 -0
- package/projects/component-library/src/lib/button/button.component.html +11 -0
- package/projects/component-library/src/lib/button/button.component.spec.ts +23 -0
- package/projects/component-library/src/lib/button/button.component.ts +68 -0
- package/projects/component-library/src/lib/calendar-header/calendar-header.component.css +67 -0
- package/projects/component-library/src/lib/calendar-header/calendar-header.component.html +20 -0
- package/projects/component-library/src/lib/calendar-header/calendar-header.component.spec.ts +23 -0
- package/projects/component-library/src/lib/calendar-header/calendar-header.component.ts +196 -0
- package/projects/component-library/src/lib/chips/chips.component.css +129 -0
- package/projects/component-library/src/lib/chips/chips.component.html +17 -0
- package/projects/component-library/src/lib/chips/chips.component.spec.ts +23 -0
- package/projects/component-library/src/lib/chips/chips.component.ts +55 -0
- package/projects/component-library/src/lib/component-library.component.spec.ts +23 -0
- package/projects/component-library/src/lib/component-library.component.ts +16 -0
- package/projects/component-library/src/lib/component-library.service.spec.ts +16 -0
- package/projects/component-library/src/lib/component-library.service.ts +9 -0
- package/projects/component-library/src/lib/datepicker/datepicker.component.css +33 -0
- package/projects/component-library/src/lib/datepicker/datepicker.component.html +11 -0
- package/projects/component-library/src/lib/datepicker/datepicker.component.spec.ts +23 -0
- package/projects/component-library/src/lib/datepicker/datepicker.component.ts +37 -0
- package/projects/component-library/src/lib/form-select/form-select.component.css +156 -0
- package/projects/component-library/src/lib/form-select/form-select.component.html +38 -0
- package/projects/component-library/src/lib/form-select/form-select.component.spec.ts +23 -0
- package/projects/component-library/src/lib/form-select/form-select.component.ts +54 -0
- package/projects/component-library/src/lib/grid-cell/grid-cell.component.css +78 -0
- package/projects/component-library/src/lib/grid-cell/grid-cell.component.html +31 -0
- package/projects/component-library/src/lib/grid-cell/grid-cell.component.spec.ts +23 -0
- package/projects/component-library/src/lib/grid-cell/grid-cell.component.ts +89 -0
- package/projects/component-library/src/lib/header/header.component.css +62 -0
- package/projects/component-library/src/lib/header/header.component.html +23 -0
- package/projects/component-library/src/lib/header/header.component.spec.ts +23 -0
- package/projects/component-library/src/lib/header/header.component.ts +28 -0
- package/projects/component-library/src/lib/stepper/stepper.component.css +96 -0
- package/projects/component-library/src/lib/stepper/stepper.component.html +14 -0
- package/projects/component-library/src/lib/stepper/stepper.component.spec.ts +23 -0
- package/projects/component-library/src/lib/stepper/stepper.component.ts +61 -0
- package/projects/component-library/src/lib/tabs/tabs.component.css +100 -0
- package/projects/component-library/src/lib/tabs/tabs.component.html +16 -0
- package/projects/component-library/src/lib/tabs/tabs.component.spec.ts +23 -0
- package/projects/component-library/src/lib/tabs/tabs.component.ts +37 -0
- package/projects/component-library/src/lib/toast/toast.component.css +108 -0
- package/projects/component-library/src/lib/toast/toast.component.html +25 -0
- package/projects/component-library/src/lib/toast/toast.component.spec.ts +23 -0
- package/projects/component-library/src/lib/toast/toast.component.ts +37 -0
- package/projects/component-library/src/lib/tool-tip/tool-tip.component.css +139 -0
- package/projects/component-library/src/lib/tool-tip/tool-tip.component.html +31 -0
- package/projects/component-library/src/lib/tool-tip/tool-tip.component.spec.ts +23 -0
- package/projects/component-library/src/lib/tool-tip/tool-tip.component.ts +37 -0
- package/projects/component-library/src/public-api.ts +25 -0
- package/projects/component-library/tsconfig.lib.json +14 -0
- package/projects/component-library/tsconfig.lib.prod.json +10 -0
- package/projects/component-library/tsconfig.spec.json +14 -0
- package/src/Saras-logo.svg +15 -0
- package/src/app/app.component.css +13 -0
- package/src/app/app.component.html +77 -0
- package/src/app/app.component.spec.ts +29 -0
- package/src/app/app.component.ts +505 -0
- package/src/app/app.config.ts +27 -0
- package/src/app/app.routes.ts +3 -0
- package/src/app/data.ts +52 -0
- package/src/app/kitchen-sink/kitchen-sink.component.css +29 -0
- package/src/app/kitchen-sink/kitchen-sink.component.html +7 -0
- package/src/app/kitchen-sink/kitchen-sink.component.spec.ts +23 -0
- package/src/app/kitchen-sink/kitchen-sink.component.ts +92 -0
- package/src/assets/.gitkeep +0 -0
- package/src/assets/Chevron.svg +5 -0
- package/src/assets/Frame.svg +5 -0
- package/src/assets/Grid.svg +5 -0
- package/src/assets/Location.svg +5 -0
- package/src/assets/Mail.svg +5 -0
- package/src/assets/Person.svg +5 -0
- package/src/assets/Scan.svg +5 -0
- package/src/assets/Sources.svg +5 -0
- package/src/assets/arrow.svg +5 -0
- package/src/assets/avatar.svg +12 -0
- package/src/assets/checkmark.svg +5 -0
- package/src/assets/crossmark.svg +5 -0
- package/src/assets/dot.svg +5 -0
- package/src/assets/negativemark.svg +5 -0
- package/src/assets/pointer-polygon.svg +3 -0
- package/src/assets/tick-icon.svg +5 -0
- package/src/assets/tick.svg +8 -0
- package/src/assets/warningmark.svg +5 -0
- package/src/custom-theme.scss +37 -0
- package/src/favicon.ico +0 -0
- package/src/index.html +23 -0
- package/src/main.ts +6 -0
- package/src/stories/GettingStarted.mdx +233 -0
- package/src/stories/KitchenSink.stories.ts +86 -0
- package/src/stories/avatar.stories.ts +45 -0
- package/src/stories/chips.stories.ts +61 -0
- package/src/stories/custom-button.stories.ts +74 -0
- package/src/stories/datepicker.stories.ts +78 -0
- package/src/stories/gridCell.stories.ts +234 -0
- package/src/stories/header.stories.ts +61 -0
- package/src/stories/selectInput.stories.ts +158 -0
- package/src/stories/stepper.stories.ts +92 -0
- package/src/stories/tabs.stories.ts +97 -0
- package/src/stories/toast.stories.ts +54 -0
- package/src/stories/tool-tip.stories.ts +45 -0
- package/src/styles.css +204 -0
- package/src/svg.d.ts +1 -0
- package/tsconfig.app.json +14 -0
- package/tsconfig.json +42 -0
- package/tsconfig.spec.json +14 -0
|
@@ -0,0 +1,505 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { RouterOutlet } from '@angular/router';
|
|
3
|
+
import { ButtonComponent } from '../../projects/component-library/src/lib/button/button.component';
|
|
4
|
+
import { KitchenSinkComponent } from './kitchen-sink/kitchen-sink.component';
|
|
5
|
+
import { ChipsComponent } from '../../projects/component-library/src/lib/chips/chips.component';
|
|
6
|
+
import { AvatarComponent } from '../../projects/component-library/src/lib/avatar/avatar.component';
|
|
7
|
+
import { GridCellComponent } from '../../projects/component-library/src/lib/grid-cell/grid-cell.component';
|
|
8
|
+
import { ColDef, GridReadyEvent } from 'ag-grid-community';
|
|
9
|
+
import { AgGridAngular } from 'ag-grid-angular';
|
|
10
|
+
import { FormlyFieldConfig } from '@ngx-formly/core';
|
|
11
|
+
import rawData from './data';
|
|
12
|
+
import { GridInterface } from '../../projects/component-library/src/interfaces/grid-interface';
|
|
13
|
+
import { FormsModule } from '@angular/forms';
|
|
14
|
+
import { ReactiveFormsModule } from '@angular/forms';
|
|
15
|
+
import { FormlyModule } from '@ngx-formly/core';
|
|
16
|
+
import { CommonModule } from '@angular/common';
|
|
17
|
+
import { NgSelectModule } from '@ng-select/ng-select';
|
|
18
|
+
import { ToolTipComponent } from '../../projects/component-library/src/lib/tool-tip/tool-tip.component';
|
|
19
|
+
import { ToastComponent } from '../../projects/component-library/src/lib/toast/toast.component';
|
|
20
|
+
import { HeaderComponent } from '../../projects/component-library/src/lib/header/header.component';
|
|
21
|
+
import { TabsComponent } from '../../projects/component-library/src/lib/tabs/tabs.component';
|
|
22
|
+
import { TabInterface } from '../../projects/component-library/src/interfaces/tab-interface';
|
|
23
|
+
import { DatepickerComponent } from '../../projects/component-library/src/lib/datepicker/datepicker.component';
|
|
24
|
+
import { Renderer2 } from '@angular/core';
|
|
25
|
+
import { SelectInterface } from '../../projects/component-library/src/interfaces/select-interface';
|
|
26
|
+
import { FormControl, FormGroup } from '@angular/forms';
|
|
27
|
+
import { StepperComponent } from '../../projects/component-library/src/public-api';
|
|
28
|
+
@Component({
|
|
29
|
+
selector: 'app-root',
|
|
30
|
+
standalone: true,
|
|
31
|
+
imports: [
|
|
32
|
+
CommonModule,
|
|
33
|
+
RouterOutlet,
|
|
34
|
+
|
|
35
|
+
ButtonComponent,
|
|
36
|
+
|
|
37
|
+
KitchenSinkComponent,
|
|
38
|
+
|
|
39
|
+
ChipsComponent,
|
|
40
|
+
|
|
41
|
+
AvatarComponent,
|
|
42
|
+
|
|
43
|
+
GridCellComponent,
|
|
44
|
+
AgGridAngular,
|
|
45
|
+
//imports for grid
|
|
46
|
+
|
|
47
|
+
ReactiveFormsModule,
|
|
48
|
+
FormlyModule,
|
|
49
|
+
ReactiveFormsModule,
|
|
50
|
+
NgSelectModule,
|
|
51
|
+
FormsModule,
|
|
52
|
+
//imports for sa-select and sa-stepper
|
|
53
|
+
ToolTipComponent,
|
|
54
|
+
ToastComponent,
|
|
55
|
+
HeaderComponent,
|
|
56
|
+
TabsComponent,
|
|
57
|
+
DatepickerComponent,
|
|
58
|
+
StepperComponent
|
|
59
|
+
],
|
|
60
|
+
templateUrl: './app.component.html',
|
|
61
|
+
styleUrl: './app.component.css'
|
|
62
|
+
})
|
|
63
|
+
export class AppComponent {
|
|
64
|
+
global_theme: string = 'saras-theme';
|
|
65
|
+
|
|
66
|
+
constructor(private renderer: Renderer2) {
|
|
67
|
+
this.renderer.addClass(document.body, this.global_theme);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
testComp = ButtonComponent;
|
|
71
|
+
testInputs = [
|
|
72
|
+
["primary", "outline", "transparent"], // type
|
|
73
|
+
["default", "error", "disabled"], // state
|
|
74
|
+
["small", "medium", "large"], // size
|
|
75
|
+
["Button"], // text
|
|
76
|
+
["../assets/Sources.svg"], // ImagePath
|
|
77
|
+
["both"], // iconPosition
|
|
78
|
+
["https://sarasanalytics.com"], // href
|
|
79
|
+
["self"], // hrefTarget
|
|
80
|
+
]
|
|
81
|
+
testParams = [
|
|
82
|
+
"type",
|
|
83
|
+
"state",
|
|
84
|
+
"size",
|
|
85
|
+
"text",
|
|
86
|
+
"ImagePath",
|
|
87
|
+
"iconPosition",
|
|
88
|
+
"href",
|
|
89
|
+
"hrefTarget",
|
|
90
|
+
]
|
|
91
|
+
|
|
92
|
+
testCompChip = ChipsComponent;
|
|
93
|
+
testInputsChip = [
|
|
94
|
+
["regular", "small", "large"], // type
|
|
95
|
+
["primary", "secondary", "neutral", "success", "error", "warning"], // state
|
|
96
|
+
["filled", "outline"], // filling
|
|
97
|
+
["Chip text"], // text
|
|
98
|
+
["../assets/Frame.svg"], // iconPath
|
|
99
|
+
["both"], // iconPosition
|
|
100
|
+
["../assets/dot.svg"], // largeStateIcon
|
|
101
|
+
["Good"], // largeStateText
|
|
102
|
+
];
|
|
103
|
+
testParamsChip = [
|
|
104
|
+
"type",
|
|
105
|
+
"state",
|
|
106
|
+
"filling",
|
|
107
|
+
"text",
|
|
108
|
+
"iconPath",
|
|
109
|
+
"iconPosition",
|
|
110
|
+
"largeStateIcon",
|
|
111
|
+
"largeStateText",
|
|
112
|
+
]
|
|
113
|
+
|
|
114
|
+
testCompAvatar = AvatarComponent;
|
|
115
|
+
testInputsAvatar = [
|
|
116
|
+
["../assets/avatar.svg", ""],
|
|
117
|
+
["extra-small", "small", "medium", "large", "extra-large"],
|
|
118
|
+
["AB"]
|
|
119
|
+
];
|
|
120
|
+
testParamsAvatar = ["imagePath", "size", "altText"];
|
|
121
|
+
|
|
122
|
+
params: GridInterface = {
|
|
123
|
+
cellType: '',
|
|
124
|
+
viewText: false,
|
|
125
|
+
viewLeadingIcon: false,
|
|
126
|
+
viewTrailingIcon: false,
|
|
127
|
+
viewButton: false,
|
|
128
|
+
viewChip: false,
|
|
129
|
+
viewAvatar: false,
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
handleChipClick(evt: any) {
|
|
133
|
+
let prevData = this.rowData[evt.rowId]["Chip"].chipConfig;
|
|
134
|
+
if (prevData == undefined) return;
|
|
135
|
+
for (let i = 0; i < prevData.length; i++) {
|
|
136
|
+
if (prevData[i].id == evt.id) {
|
|
137
|
+
this.rowData[evt.rowId]["Chip"].chipConfig?.splice(i, 1);
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// for every in cell in a row, returning a grid-interface object to specify how it should be rendered.
|
|
144
|
+
rowData = rawData.map((current): { [key: string]: GridInterface } => {
|
|
145
|
+
return {
|
|
146
|
+
"Text": {
|
|
147
|
+
...this.params,
|
|
148
|
+
viewText: true,
|
|
149
|
+
cellType: 'row',
|
|
150
|
+
text: current.rowNo,
|
|
151
|
+
},
|
|
152
|
+
"Numeric": {
|
|
153
|
+
...this.params,
|
|
154
|
+
viewText: true,
|
|
155
|
+
cellType: 'numeric',
|
|
156
|
+
text: Math.floor(((current.rowNo * 23) / 77) * 75),
|
|
157
|
+
},
|
|
158
|
+
"Leading Icon": {
|
|
159
|
+
...this.params,
|
|
160
|
+
viewText: true,
|
|
161
|
+
cellType: 'interactive',
|
|
162
|
+
text: current.name,
|
|
163
|
+
iconPath: '../assets/Scan.svg',
|
|
164
|
+
viewLeadingIcon: true,
|
|
165
|
+
interactiveLinkTarget: 'blank',
|
|
166
|
+
linkClicked: (evt: Event) => {
|
|
167
|
+
console.log(evt);
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
"Chip": {
|
|
171
|
+
...this.params,
|
|
172
|
+
cellType: 'row',
|
|
173
|
+
viewChip: true,
|
|
174
|
+
chipConfig: [
|
|
175
|
+
{
|
|
176
|
+
id: 0,
|
|
177
|
+
text: current.chip,
|
|
178
|
+
type: 'primary',
|
|
179
|
+
state: 'regular',
|
|
180
|
+
filling: 'filled',
|
|
181
|
+
iconPath: '../assets/Frame.svg',
|
|
182
|
+
iconPosition: 'left',
|
|
183
|
+
largeStateIcon: '',
|
|
184
|
+
largeStateText: '',
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
id: 1,
|
|
188
|
+
text: current.chip2,
|
|
189
|
+
type: 'secondary',
|
|
190
|
+
state: 'regular',
|
|
191
|
+
filling: 'filled',
|
|
192
|
+
iconPath: '../assets/Frame.svg',
|
|
193
|
+
iconPosition: 'left',
|
|
194
|
+
largeStateIcon: '',
|
|
195
|
+
largeStateText: '',
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
id: 2,
|
|
199
|
+
text: current.chip3,
|
|
200
|
+
type: 'error',
|
|
201
|
+
state: 'regular',
|
|
202
|
+
filling: 'filled',
|
|
203
|
+
iconPath: '../assets/Frame.svg',
|
|
204
|
+
iconPosition: 'left',
|
|
205
|
+
largeStateIcon: '',
|
|
206
|
+
largeStateText: '',
|
|
207
|
+
},
|
|
208
|
+
],
|
|
209
|
+
chipClicked: (evt: Event) => {
|
|
210
|
+
console.log(evt);
|
|
211
|
+
this.handleChipClick(evt);
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
"Button": {
|
|
215
|
+
...this.params,
|
|
216
|
+
cellType: "row",
|
|
217
|
+
viewButton: true,
|
|
218
|
+
buttonConfig: {
|
|
219
|
+
id: 0,
|
|
220
|
+
type: 'outline',
|
|
221
|
+
state: current.buttonState,
|
|
222
|
+
size: 'small',
|
|
223
|
+
text: 'Button',
|
|
224
|
+
href: current.link,
|
|
225
|
+
imagePath: '../assets/Sources.svg',
|
|
226
|
+
iconPosition: 'both',
|
|
227
|
+
hrefTarget: 'blank',
|
|
228
|
+
},
|
|
229
|
+
buttonClicked: (evt: Event) => {
|
|
230
|
+
console.log(evt);
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
"Avatar": {
|
|
234
|
+
...this.params,
|
|
235
|
+
viewText: true,
|
|
236
|
+
cellType: "row",
|
|
237
|
+
avatarConfig: {
|
|
238
|
+
id: 0,
|
|
239
|
+
size: 'small',
|
|
240
|
+
imagePath: current.personPhoto,
|
|
241
|
+
altText: 'AB'
|
|
242
|
+
},
|
|
243
|
+
viewAvatar: true,
|
|
244
|
+
text: current.personName,
|
|
245
|
+
subText: current.personDesignation,
|
|
246
|
+
avatarClicked: (evt: Event) => {
|
|
247
|
+
console.log(evt);
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
"Subtext": {
|
|
251
|
+
...this.params,
|
|
252
|
+
viewText: true,
|
|
253
|
+
cellType: "row",
|
|
254
|
+
text: "Text",
|
|
255
|
+
subText: "Subtext"
|
|
256
|
+
},
|
|
257
|
+
"All": {
|
|
258
|
+
cellType: 'row',
|
|
259
|
+
viewText: true,
|
|
260
|
+
viewLeadingIcon: true,
|
|
261
|
+
viewTrailingIcon: true,
|
|
262
|
+
viewButton: true,
|
|
263
|
+
viewChip: true,
|
|
264
|
+
viewAvatar: true,
|
|
265
|
+
iconPath: '../assets/Scan.svg',
|
|
266
|
+
chipConfig: [
|
|
267
|
+
{
|
|
268
|
+
id: 2,
|
|
269
|
+
text: current.chip3,
|
|
270
|
+
type: 'error',
|
|
271
|
+
state: 'regular',
|
|
272
|
+
filling: 'filled',
|
|
273
|
+
iconPath: '../assets/Sources.svg',
|
|
274
|
+
iconPosition: 'left',
|
|
275
|
+
largeStateIcon: '',
|
|
276
|
+
largeStateText: '',
|
|
277
|
+
}
|
|
278
|
+
],
|
|
279
|
+
buttonConfig: {
|
|
280
|
+
id: 0,
|
|
281
|
+
type: 'outline',
|
|
282
|
+
state: current.buttonState,
|
|
283
|
+
size: 'small',
|
|
284
|
+
text: 'Button',
|
|
285
|
+
href: current.link,
|
|
286
|
+
imagePath: '../assets/Sources.svg',
|
|
287
|
+
iconPosition: 'both',
|
|
288
|
+
hrefTarget: 'blank',
|
|
289
|
+
},
|
|
290
|
+
avatarConfig: {
|
|
291
|
+
id: 0,
|
|
292
|
+
size: 'small',
|
|
293
|
+
imagePath: '../assets/avatar.svg',
|
|
294
|
+
altText: 'AB'
|
|
295
|
+
},
|
|
296
|
+
text: "Text",
|
|
297
|
+
subText: "subText",
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
);
|
|
302
|
+
colDefs: ColDef[] = [
|
|
303
|
+
{
|
|
304
|
+
field: "Text",
|
|
305
|
+
comparator: (_valueA, _valueB, nodeA, nodeB) => {
|
|
306
|
+
return Number(nodeA.data.Text.text) - Number(nodeB.data.Text.text)
|
|
307
|
+
},
|
|
308
|
+
resizable: false,
|
|
309
|
+
cellRenderer: GridCellComponent,
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
field: "Numeric",
|
|
313
|
+
comparator: (_valueA, _valueB, nodeA, nodeB) => {
|
|
314
|
+
return Number(nodeA.data.Numeric.text) - Number(nodeB.data.Numeric.text)
|
|
315
|
+
},
|
|
316
|
+
resizable: false,
|
|
317
|
+
filter: 'agNumberColumnFilter',
|
|
318
|
+
valueFormatter: p => p.data.Numeric.text,
|
|
319
|
+
cellRenderer: GridCellComponent,
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
field: "Leading Icon",
|
|
323
|
+
headerCheckboxSelection: true,
|
|
324
|
+
resizable: false,
|
|
325
|
+
cellRenderer: GridCellComponent,
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
field: "Chip",
|
|
329
|
+
resizable: false,
|
|
330
|
+
cellRenderer: GridCellComponent,
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
field: "Button",
|
|
334
|
+
resizable: false,
|
|
335
|
+
cellRenderer: GridCellComponent,
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
field: "Avatar",
|
|
339
|
+
resizable: false,
|
|
340
|
+
cellRenderer: GridCellComponent,
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
field: "Subtext",
|
|
344
|
+
resizable: false,
|
|
345
|
+
cellRenderer: GridCellComponent,
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
field: "All",
|
|
349
|
+
resizable: false,
|
|
350
|
+
cellRenderer: GridCellComponent,
|
|
351
|
+
}
|
|
352
|
+
]
|
|
353
|
+
onGridReady(evt: GridReadyEvent) {
|
|
354
|
+
evt.api.autoSizeAllColumns();
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
model: any = {
|
|
358
|
+
"Test-select": [{
|
|
359
|
+
"id": 0,
|
|
360
|
+
"name": "One"
|
|
361
|
+
}],
|
|
362
|
+
"Test-stepper": {
|
|
363
|
+
"id": 2,
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
selectProps: SelectInterface = {
|
|
368
|
+
options: [
|
|
369
|
+
{ id: 0, name: 'Zero' },
|
|
370
|
+
{ id: 1, name: 'One' },
|
|
371
|
+
{ id: 2, name: 'Two' },
|
|
372
|
+
{ id: 3, name: 'Three' },
|
|
373
|
+
],
|
|
374
|
+
disabled: false,
|
|
375
|
+
change: () => {
|
|
376
|
+
console.log(this.model);
|
|
377
|
+
},
|
|
378
|
+
params: {
|
|
379
|
+
label: 'Label',
|
|
380
|
+
supportText: "Supporting text",
|
|
381
|
+
dropIcon: '../assets/Chevron.svg',
|
|
382
|
+
dropIconPosition: 'both',
|
|
383
|
+
multiple: true,
|
|
384
|
+
iconPath: "../assets/Frame.svg",
|
|
385
|
+
type: "regular",
|
|
386
|
+
state: "primary",
|
|
387
|
+
filling: "filled",
|
|
388
|
+
iconPosition: "left",
|
|
389
|
+
}
|
|
390
|
+
};
|
|
391
|
+
|
|
392
|
+
fields: FormlyFieldConfig[] = [
|
|
393
|
+
{
|
|
394
|
+
key: 'Test-select',
|
|
395
|
+
type: 'sa-select',
|
|
396
|
+
props: this.selectProps
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
key: 'Test-stepper',
|
|
400
|
+
type: 'sa-stepper',
|
|
401
|
+
props: {
|
|
402
|
+
disabled: false,
|
|
403
|
+
options: [
|
|
404
|
+
{ id: 0, name: 'Zero' },
|
|
405
|
+
{ id: 1, name: 'One' },
|
|
406
|
+
{ id: 2, name: 'Two' },
|
|
407
|
+
{ id: 3, name: 'Three' },
|
|
408
|
+
],
|
|
409
|
+
params: {
|
|
410
|
+
editable: true,
|
|
411
|
+
doneIcon: "../assets/tick-icon.svg"
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
];
|
|
416
|
+
|
|
417
|
+
submit(model: any) {
|
|
418
|
+
console.log(model);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
stepLabels = [
|
|
422
|
+
{ id: 0, name: 'Zero' },
|
|
423
|
+
{ id: 1, name: 'One' },
|
|
424
|
+
{ id: 2, name: 'Two' },
|
|
425
|
+
{ id: 3, name: 'Three' },
|
|
426
|
+
];
|
|
427
|
+
editable = true;
|
|
428
|
+
doneIcon = "../assets/tick-icon.svg";
|
|
429
|
+
stepped(evt: any) {
|
|
430
|
+
console.log(evt);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
skip = () => { console.log("skipped") };
|
|
434
|
+
seen = () => { console.log("seen") };
|
|
435
|
+
|
|
436
|
+
messages: string[] = [
|
|
437
|
+
"This first line can act as the subheading of this onboarding tooltip",
|
|
438
|
+
"This second line can act as the subheading of this onboarding tooltip",
|
|
439
|
+
"This third line can act as the subheading of this onboarding tooltip",
|
|
440
|
+
"This fourth line can act as the subheading of this onboarding tooltip",
|
|
441
|
+
]
|
|
442
|
+
|
|
443
|
+
heading: string = "Heading";
|
|
444
|
+
subHeading: string = "Subheading text"
|
|
445
|
+
percent = 30
|
|
446
|
+
statusIcon = "../assets/warningmark.svg"
|
|
447
|
+
clicked(num: number) { num ? this.percent += 5 : this.percent -= 5 }
|
|
448
|
+
|
|
449
|
+
info = [
|
|
450
|
+
["Info Text 1", "../assets/Person.svg"],
|
|
451
|
+
["Info Text 2", "../assets/Location.svg"],
|
|
452
|
+
["Info Text 3", "../assets/Mail.svg"]
|
|
453
|
+
]
|
|
454
|
+
chipConfig = [
|
|
455
|
+
["Chip 1", "success"],
|
|
456
|
+
["Chip 2", "warning"],
|
|
457
|
+
["Chip 3", "error"],
|
|
458
|
+
]
|
|
459
|
+
mainButton = "+ Button"
|
|
460
|
+
helperButton = "Helper"
|
|
461
|
+
header = "Header"
|
|
462
|
+
|
|
463
|
+
tabs: TabInterface[] = [
|
|
464
|
+
{
|
|
465
|
+
tabName: "Tab 1",
|
|
466
|
+
tabIcon: "../assets/Sources.svg",
|
|
467
|
+
iconPosition: "left",
|
|
468
|
+
badgeContent: "3 new",
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
tabName: "Tab 2",
|
|
472
|
+
tabIcon: "../assets/Grid.svg",
|
|
473
|
+
iconPosition: "right",
|
|
474
|
+
badgeContent: "9 new",
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
tabName: "Tab 3",
|
|
478
|
+
tabIcon: "../assets/warningmark.svg",
|
|
479
|
+
iconPosition: "left",
|
|
480
|
+
badgeContent: "17 new",
|
|
481
|
+
},
|
|
482
|
+
{
|
|
483
|
+
tabName: "Tab 4",
|
|
484
|
+
tabIcon: "../assets/Person.svg",
|
|
485
|
+
iconPosition: "right",
|
|
486
|
+
},
|
|
487
|
+
{
|
|
488
|
+
tabName: "Tab 5",
|
|
489
|
+
tabIcon: "../assets/Mail.svg",
|
|
490
|
+
badgeContent: "6 new",
|
|
491
|
+
iconPosition: "both",
|
|
492
|
+
}
|
|
493
|
+
]
|
|
494
|
+
|
|
495
|
+
defaultTab = 2;
|
|
496
|
+
tabSwitch(evt: any) {
|
|
497
|
+
console.log(evt);
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
range = new FormGroup({
|
|
501
|
+
start: new FormControl(),
|
|
502
|
+
end: new FormControl(),
|
|
503
|
+
});
|
|
504
|
+
|
|
505
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ApplicationConfig, importProvidersFrom } from '@angular/core';
|
|
2
|
+
import { provideRouter } from '@angular/router';
|
|
3
|
+
import { FormlyModule } from '@ngx-formly/core';
|
|
4
|
+
import { FormSelectComponent } from '../../projects/component-library/src/lib/form-select/form-select.component';
|
|
5
|
+
import { routes } from './app.routes';
|
|
6
|
+
import { StepperComponent } from '../../projects/component-library/src/lib/stepper/stepper.component';
|
|
7
|
+
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
|
|
8
|
+
|
|
9
|
+
export const appConfig: ApplicationConfig = {
|
|
10
|
+
providers: [
|
|
11
|
+
provideRouter(routes),
|
|
12
|
+
importProvidersFrom([
|
|
13
|
+
FormlyModule.forRoot({
|
|
14
|
+
types: [
|
|
15
|
+
{
|
|
16
|
+
name: 'sa-select',
|
|
17
|
+
component: FormSelectComponent,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: 'sa-stepper',
|
|
21
|
+
component: StepperComponent,
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
})
|
|
25
|
+
]), provideAnimationsAsync(), provideAnimationsAsync()
|
|
26
|
+
]
|
|
27
|
+
};
|
package/src/app/data.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
const rawData = [
|
|
2
|
+
{
|
|
3
|
+
rowNo: 1,
|
|
4
|
+
name: 'Cell Name 1',
|
|
5
|
+
chip: 'Chip 1',
|
|
6
|
+
chip2: 'Chip 2',
|
|
7
|
+
chip3: 'Chip 3',
|
|
8
|
+
personPhoto: '../assets/avatar.svg',
|
|
9
|
+
personName: 'Nithish',
|
|
10
|
+
personDesignation: 'Developer',
|
|
11
|
+
buttonState: 'default',
|
|
12
|
+
link: 'https://google.com'
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
rowNo: 2,
|
|
16
|
+
name: 'Cell Name 2',
|
|
17
|
+
chip: 'Chip 1',
|
|
18
|
+
chip2: 'Chip 2',
|
|
19
|
+
chip3: 'Chip 3',
|
|
20
|
+
personPhoto: '../assets/avatar.svg',
|
|
21
|
+
personName: 'Shoaib',
|
|
22
|
+
personDesignation: 'Data Engineer',
|
|
23
|
+
buttonState: 'error',
|
|
24
|
+
link: 'https://adobe.com'
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
rowNo: 3,
|
|
28
|
+
name: 'Cell Name 3',
|
|
29
|
+
chip: 'Chip 1',
|
|
30
|
+
chip2: 'Chip 2',
|
|
31
|
+
chip3: 'Chip 3',
|
|
32
|
+
personPhoto: '../assets/avatar.svg',
|
|
33
|
+
personName: 'Rithwik',
|
|
34
|
+
personDesignation: 'Consultant',
|
|
35
|
+
buttonState: 'default',
|
|
36
|
+
link: 'https://sarasanalytics.com'
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
rowNo: 4,
|
|
40
|
+
name: 'Cell Name 4',
|
|
41
|
+
chip: 'Chip 1',
|
|
42
|
+
chip2: 'Chip 2',
|
|
43
|
+
chip3: 'Chip 3',
|
|
44
|
+
personPhoto: '../assets/avatar.svg',
|
|
45
|
+
personName: 'Siddartha',
|
|
46
|
+
personDesignation: 'Consultant',
|
|
47
|
+
buttonState: 'error',
|
|
48
|
+
link: 'https://youtube.com'
|
|
49
|
+
},
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
export default rawData;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
.all-variants {
|
|
2
|
+
display: grid;
|
|
3
|
+
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.variant {
|
|
7
|
+
display: flex;
|
|
8
|
+
position: relative;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
text-align: center;
|
|
11
|
+
padding: 10px;
|
|
12
|
+
border: 0.5px solid gray;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.variant:hover>.copy-icon {
|
|
16
|
+
display: block;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.copy-area {
|
|
20
|
+
transform: scale(0.6);
|
|
21
|
+
position: absolute;
|
|
22
|
+
right: 0;
|
|
23
|
+
bottom: 0;
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.copy-icon {
|
|
28
|
+
display: none;
|
|
29
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<div class="all-variants">
|
|
2
|
+
<div class="variant" *ngFor="let variant of paramCombinations; let i = index">
|
|
3
|
+
<ng-container *ngComponentOutlet="inputComponent; inputs: variant;" />
|
|
4
|
+
<mat-icon (click)="copy(i)" class="copy-area copy-icon">filter_none</mat-icon>
|
|
5
|
+
<p [style.display]="displayCopiedText[i] ? 'block': 'none'" class="copy-area copied-text">Copied!</p>
|
|
6
|
+
</div>
|
|
7
|
+
</div>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { KitchenSinkComponent } from './kitchen-sink.component';
|
|
4
|
+
|
|
5
|
+
describe('KitchenSinkComponent', () => {
|
|
6
|
+
let component: KitchenSinkComponent;
|
|
7
|
+
let fixture: ComponentFixture<KitchenSinkComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
imports: [KitchenSinkComponent]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(KitchenSinkComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
fixture.detectChanges();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|