@@ -8,16 +8,18 @@ import {
8
8
ReactiveFormsModule ,
9
9
type ValidationErrors
10
10
} from '@angular/forms' ;
11
- import { type Form } from '@sl-design-system/form' ;
11
+ import { Form } from '@sl-design-system/form' ;
12
12
import { type Meta , type StoryFn , moduleMetadata } from '@storybook/angular' ;
13
13
import { ButtonComponent } from '../src/button/button.component' ;
14
14
import { ButtonBarComponent } from '../src/button-bar/button-bar.component' ;
15
15
import { CheckboxGroupComponent } from '../src/checkbox/checkbox-group.component' ;
16
16
import { CheckboxComponent } from '../src/checkbox/checkbox.component' ;
17
+ import { ComboboxComponent } from '../src/combobox/combobox.component' ;
17
18
import { FormFieldComponent } from '../src/form/form-field.component' ;
18
19
import { FormComponent } from '../src/form/form.component' ;
19
20
import { CheckboxGroupDirective } from '../src/forms/checkbox-group.directive' ;
20
21
import { CheckboxDirective } from '../src/forms/checkbox.directive' ;
22
+ import { ComboboxDirective } from '../src/forms/combobox-directive' ;
21
23
import { NumberFieldDirective } from '../src/forms/number-field.directive' ;
22
24
import { RadioGroupDirective } from '../src/forms/radio-group.directive' ;
23
25
import { SelectDirective } from '../src/forms/select.directive' ;
@@ -62,6 +64,26 @@ import { TextFieldComponent } from '../src/text-field/text-field.component';
62
64
</sl-select>
63
65
</sl-form-field>
64
66
67
+ <sl-form-field label="Combobox - single select">
68
+ <sl-combobox formControlName="comboboxSingle" placeholder="Select an option">
69
+ <sl-listbox>
70
+ @for (option of options(); track option.value) {
71
+ <sl-option>{{ option.label }}</sl-option>
72
+ }
73
+ </sl-listbox>
74
+ </sl-combobox>
75
+ </sl-form-field>
76
+
77
+ <sl-form-field label="Combobox - multiple select">
78
+ <sl-combobox formControlName="comboboxMultiple" multiple placeholder="Select one or more options">
79
+ <sl-listbox>
80
+ @for (option of options(); track option.value) {
81
+ <sl-option>{{ option.label }}</sl-option>
82
+ }
83
+ </sl-listbox>
84
+ </sl-combobox>
85
+ </sl-form-field>
86
+
65
87
<sl-form-field label="Switch">
66
88
<sl-switch formControlName="switch" reverse value="toggled">Toggle me</sl-switch>
67
89
</sl-form-field>
@@ -90,6 +112,7 @@ import { TextFieldComponent } from '../src/text-field/text-field.component';
90
112
ReactiveFormsModule ,
91
113
CheckboxDirective ,
92
114
CheckboxGroupDirective ,
115
+ ComboboxDirective ,
93
116
NumberFieldDirective ,
94
117
RadioGroupDirective ,
95
118
SelectDirective ,
@@ -102,6 +125,8 @@ export class AllFormControlsReactiveComponent {
102
125
formGroup = new FormGroup ( {
103
126
checkbox : new FormControl ( 'checked' ) ,
104
127
checkboxGroup : new FormControl ( [ '2' , '1' , '0' ] ) ,
128
+ comboboxSingle : new FormControl ( '' ) ,
129
+ comboboxMultiple : new FormControl ( '' ) ,
105
130
numberField : new FormControl ( 10 ) ,
106
131
radioGroup : new FormControl ( '1' ) ,
107
132
select : new FormControl ( '1' ) ,
@@ -151,6 +176,26 @@ export class AllFormControlsReactiveComponent {
151
176
</sl-select>
152
177
</sl-form-field>
153
178
179
+ <sl-form-field label="Combobox - single select">
180
+ <sl-combobox formControlName="comboboxSingle" required>
181
+ <sl-listbox>
182
+ @for (option of options(); track option.value) {
183
+ <sl-option>{{ option.label }}</sl-option>
184
+ }
185
+ </sl-listbox>
186
+ </sl-combobox>
187
+ </sl-form-field>
188
+
189
+ <sl-form-field label="Combobox - multiple select">
190
+ <sl-combobox formControlName="comboboxMultiple" multiple required>
191
+ <sl-listbox>
192
+ @for (option of options(); track option.value) {
193
+ <sl-option>{{ option.label }}</sl-option>
194
+ }
195
+ </sl-listbox>
196
+ </sl-combobox>
197
+ </sl-form-field>
198
+
154
199
<sl-form-field label="Switch">
155
200
<sl-switch formControlName="switch" reverse>Toggle me</sl-switch>
156
201
</sl-form-field>
@@ -185,6 +230,7 @@ export class AllFormControlsReactiveComponent {
185
230
ButtonBarComponent ,
186
231
CheckboxDirective ,
187
232
CheckboxGroupDirective ,
233
+ ComboboxDirective ,
188
234
NumberFieldDirective ,
189
235
RadioGroupDirective ,
190
236
SelectDirective ,
@@ -199,6 +245,8 @@ export class AllFormControlsEmptyReactiveComponent {
199
245
formGroup = new FormGroup ( {
200
246
checkbox : new FormControl ( false ) ,
201
247
checkboxGroup : new FormControl ( [ ] ) ,
248
+ comboboxSingle : new FormControl ( '' ) ,
249
+ comboboxMultiple : new FormControl ( '' ) ,
202
250
numberField : new FormControl ( ) ,
203
251
radioGroup : new FormControl ( '' ) ,
204
252
select : new FormControl ( '' ) ,
@@ -252,6 +300,26 @@ export class AllFormControlsEmptyReactiveComponent {
252
300
</sl-select>
253
301
</sl-form-field>
254
302
303
+ <sl-form-field label="Combobox - single select">
304
+ <sl-combobox [(ngModel)]="formGroup.comboboxSingle">
305
+ <sl-listbox>
306
+ <sl-option>Option 1</sl-option>
307
+ <sl-option>Option 2</sl-option>
308
+ <sl-option>Option 3</sl-option>
309
+ </sl-listbox>
310
+ </sl-combobox>
311
+ </sl-form-field>
312
+
313
+ <sl-form-field label="Combobox - multiple select">
314
+ <sl-combobox [(ngModel)]="formGroup.comboboxMultiple" multiple>
315
+ <sl-listbox>
316
+ <sl-option>Option 1</sl-option>
317
+ <sl-option>Option 2</sl-option>
318
+ <sl-option>Option 3</sl-option>
319
+ </sl-listbox>
320
+ </sl-combobox>
321
+ </sl-form-field>
322
+
255
323
<sl-form-field label="Switch">
256
324
<sl-switch [(ngModel)]="formGroup.switch" reverse value="toggled">Toggle me</sl-switch>
257
325
</sl-form-field>
@@ -280,6 +348,7 @@ export class AllFormControlsEmptyReactiveComponent {
280
348
FormsModule ,
281
349
CheckboxDirective ,
282
350
CheckboxGroupDirective ,
351
+ ComboboxDirective ,
283
352
NumberFieldDirective ,
284
353
RadioGroupDirective ,
285
354
SelectDirective ,
@@ -293,6 +362,8 @@ export class AllFormControlsTemplateComponent {
293
362
textField : 'Text field' ,
294
363
textArea : 'Text area' ,
295
364
checkbox : 'checked' ,
365
+ comboboxSingle : 'Option 1' ,
366
+ comboboxMultiple : [ 'Option 1' , 'Option 2' ] ,
296
367
numberField : 10 ,
297
368
select : '1' ,
298
369
switch : 'toggled' ,
@@ -329,6 +400,26 @@ export class AllFormControlsTemplateComponent {
329
400
</sl-select>
330
401
</sl-form-field>
331
402
403
+ <sl-form-field label="Combobox - single select">
404
+ <sl-combobox [(ngModel)]="formGroup.comboboxSingle" required>
405
+ <sl-listbox>
406
+ <sl-option>Option 1</sl-option>
407
+ <sl-option>Option 2</sl-option>
408
+ <sl-option>Option 3</sl-option>
409
+ </sl-listbox>
410
+ </sl-combobox>
411
+ </sl-form-field>
412
+
413
+ <sl-form-field label="Combobox - multiple select">
414
+ <sl-combobox [(ngModel)]="formGroup.comboboxMultiple" multiple required>
415
+ <sl-listbox>
416
+ <sl-option>Option 1</sl-option>
417
+ <sl-option>Option 2</sl-option>
418
+ <sl-option>Option 3</sl-option>
419
+ </sl-listbox>
420
+ </sl-combobox>
421
+ </sl-form-field>
422
+
332
423
<sl-form-field label="Switch">
333
424
<sl-switch [(ngModel)]="formGroup.switch" reverse>Toggle me</sl-switch>
334
425
</sl-form-field>
@@ -363,6 +454,7 @@ export class AllFormControlsTemplateComponent {
363
454
ButtonBarComponent ,
364
455
CheckboxDirective ,
365
456
CheckboxGroupDirective ,
457
+ ComboboxDirective ,
366
458
NumberFieldDirective ,
367
459
RadioGroupDirective ,
368
460
SelectDirective ,
@@ -378,6 +470,8 @@ export class AllFormControlsEmptyTemplateComponent {
378
470
textField : '' ,
379
471
textArea : '' ,
380
472
checkbox : false ,
473
+ comboboxSingle : '' ,
474
+ comboboxMultiple : [ ] ,
381
475
numberField : '' ,
382
476
select : '' ,
383
477
switch : false ,
@@ -484,6 +578,7 @@ export default {
484
578
LoginFormComponent ,
485
579
CheckboxComponent ,
486
580
CheckboxGroupComponent ,
581
+ ComboboxComponent ,
487
582
FormComponent ,
488
583
FormFieldComponent ,
489
584
NumberFieldComponent ,
0 commit comments