/
select.component.stories.ts
153 lines (145 loc) · 4.33 KB
/
select.component.stories.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
import { Meta } from '@storybook/angular/types-6-0';
import { moduleMetadata } from '@storybook/angular';
import { SelectComponent } from './select.component';
import { AgModule } from 'agnostic-angular';
import { action } from '@storybook/addon-actions';
const actionsData = {
changed: action('changed'),
};
export default {
title: 'AG—Angular (Beta)/Select',
component: SelectComponent,
decorators: [
moduleMetadata({
imports: [AgModule],
}),
],
} as Meta;
export const Default = () => ({
props: {
propInput: {
changed: actionsData.changed,
},
},
template: `<ag-select
uniqueId="sel1"
name="select1"
(changed)="propInput.changed($event)"
labelCopy="Select the best tennis player of all time"
[options]="[
{ value: 'andre', label: 'Andre Agassi' },
{ value: 'serena', label: 'Serena Williams' },
{ value: 'mac', label: 'John McEnroe' },
{ value: 'borg', label: 'Bjorn Borg' },
{ value: 'althea', label: 'Althea Gibson' },
{ value: 'roger', label: 'Roger Federer' },
]"
></ag-select>`,
});
export const FirstOptionLabel = () => ({
props: {
propInput: {
changed: actionsData.changed,
},
},
template: `<p class="mbe24">You can pass in <code>defaultOptionLabel</code> to specify the first option's text copy (e.g. as we've done here with: “Select your favorite tennis player”)</p>
<ag-select
uniqueId="sel2"
name="select2"
(changed)="propInput.changed($event)"
defaultOptionLabel="Select your favorite tennis player"
labelCopy="Select the best tennis player of all time"
[options]="[
{ value: 'andre', label: 'Andre Agassi' },
{ value: 'serena', label: 'Serena Williams' },
{ value: 'mac', label: 'John McEnroe' },
{ value: 'borg', label: 'Bjorn Borg' },
{ value: 'althea', label: 'Althea Gibson' },
{ value: 'roger', label: 'Roger Federer' },
]"
></ag-select>`,
});
export const Disabled = () => ({
props: {
propInput: {
changed: actionsData.changed,
},
},
template: `<p class="mbe24">You can pass in <code>defaultOptionLabel</code> to specify the first option's text copy (e.g. as we've done here with: “Select your favorite tennis player”)</p>
<ag-select
uniqueId="sel3"
name="select3"
isDisabled="true"
labelCopy="Select the best tennis player of all time"
[options]="[
{ value: 'andre', label: 'Andre Agassi' },
]"
></ag-select>`,
});
export const Small = () => ({
props: {
propInput: {
changed: actionsData.changed,
},
},
template: `<ag-select
uniqueId="sel4"
name="select4"
size="small"
(changed)="propInput.changed($event)"
labelCopy="Select the best tennis player of all time"
[options]="[
{ value: 'andre', label: 'Andre Agassi' },
{ value: 'serena', label: 'Serena Williams' },
{ value: 'mac', label: 'John McEnroe' },
{ value: 'borg', label: 'Bjorn Borg' },
{ value: 'althea', label: 'Althea Gibson' },
{ value: 'roger', label: 'Roger Federer' },
]"
></ag-select>`,
});
export const Large = () => ({
props: {
propInput: {
changed: actionsData.changed,
},
},
template: `<ag-select
uniqueId="sel5"
name="select5"
size="large"
(changed)="propInput.changed($event)"
labelCopy="Select the best tennis player of all time"
[options]="[
{ value: 'andre', label: 'Andre Agassi' },
{ value: 'serena', label: 'Serena Williams' },
{ value: 'mac', label: 'John McEnroe' },
{ value: 'borg', label: 'Bjorn Borg' },
{ value: 'althea', label: 'Althea Gibson' },
{ value: 'roger', label: 'Roger Federer' },
]"
></ag-select>`,
});
export const Multi = () => ({
props: {
propInput: {
changed: actionsData.changed,
},
},
template: `<ag-select
uniqueId="sel6"
name="select6"
isMultiple="true"
multipleSize="4"
(changed)="propInput.changed($event)"
labelCopy="Select the best tennis player of all time"
[options]="[
{ value: 'andre', label: 'Andre Agassi' },
{ value: 'serena', label: 'Serena Williams' },
{ value: 'mac', label: 'John McEnroe' },
{ value: 'borg', label: 'Bjorn Borg' },
{ value: 'althea', label: 'Althea Gibson' },
{ value: 'roger', label: 'Roger Federer' },
]"
></ag-select>`,
});