@daffodil/design 0.94.1-rc.0 → 0.95.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/README.md +1 -2
- package/accordion/src/accordion-theme.scss +4 -4
- package/article/README.md +4 -27
- package/article/src/article-theme.scss +14 -14
- package/badge/src/badge-theme.scss +0 -6
- package/button/README.md +0 -4
- package/button/src/button/basic/button-theme.scss +17 -42
- package/button/src/button/button-base.scss +12 -3
- package/button/src/button/flat/flat-theme.scss +14 -12
- package/button/src/button/icon/icon-theme.scss +19 -40
- package/button/src/button/stroked/stroked-theme.scss +22 -36
- package/card/src/card/stroked/stroked-theme.scss +1 -1
- package/card/src/card-base.scss +0 -1
- package/fesm2022/daffodil-design-accordion.mjs +285 -188
- package/fesm2022/daffodil-design-accordion.mjs.map +1 -1
- package/fesm2022/daffodil-design-article.mjs +578 -340
- package/fesm2022/daffodil-design-article.mjs.map +1 -1
- package/fesm2022/daffodil-design-badge.mjs +166 -84
- package/fesm2022/daffodil-design-badge.mjs.map +1 -1
- package/fesm2022/daffodil-design-beacon.mjs +109 -47
- package/fesm2022/daffodil-design-beacon.mjs.map +1 -1
- package/fesm2022/daffodil-design-breadcrumb.mjs +384 -277
- package/fesm2022/daffodil-design-breadcrumb.mjs.map +1 -1
- package/fesm2022/daffodil-design-button.mjs +541 -408
- package/fesm2022/daffodil-design-button.mjs.map +1 -1
- package/fesm2022/daffodil-design-callout.mjs +349 -224
- package/fesm2022/daffodil-design-callout.mjs.map +1 -1
- package/fesm2022/daffodil-design-card.mjs +496 -327
- package/fesm2022/daffodil-design-card.mjs.map +1 -1
- package/fesm2022/daffodil-design-checkbox.mjs +373 -313
- package/fesm2022/daffodil-design-checkbox.mjs.map +1 -1
- package/fesm2022/daffodil-design-container.mjs +103 -60
- package/fesm2022/daffodil-design-container.mjs.map +1 -1
- package/fesm2022/daffodil-design-form-field.mjs +441 -352
- package/fesm2022/daffodil-design-form-field.mjs.map +1 -1
- package/fesm2022/daffodil-design-form.mjs +155 -57
- package/fesm2022/daffodil-design-form.mjs.map +1 -1
- package/fesm2022/daffodil-design-hero.mjs +349 -234
- package/fesm2022/daffodil-design-hero.mjs.map +1 -1
- package/fesm2022/daffodil-design-image-lite.mjs +60 -0
- package/fesm2022/daffodil-design-image-lite.mjs.map +1 -0
- package/fesm2022/daffodil-design-image.mjs +245 -107
- package/fesm2022/daffodil-design-image.mjs.map +1 -1
- package/fesm2022/daffodil-design-input.mjs +217 -164
- package/fesm2022/daffodil-design-input.mjs.map +1 -1
- package/fesm2022/daffodil-design-list.mjs +308 -170
- package/fesm2022/daffodil-design-list.mjs.map +1 -1
- package/fesm2022/daffodil-design-media-gallery.mjs +351 -278
- package/fesm2022/daffodil-design-media-gallery.mjs.map +1 -1
- package/fesm2022/daffodil-design-menu.mjs +525 -417
- package/fesm2022/daffodil-design-menu.mjs.map +1 -1
- package/fesm2022/daffodil-design-modal.mjs +680 -450
- package/fesm2022/daffodil-design-modal.mjs.map +1 -1
- package/fesm2022/daffodil-design-native-select.mjs +175 -166
- package/fesm2022/daffodil-design-native-select.mjs.map +1 -1
- package/fesm2022/daffodil-design-navbar.mjs +145 -68
- package/fesm2022/daffodil-design-navbar.mjs.map +1 -1
- package/fesm2022/daffodil-design-notification.mjs +376 -226
- package/fesm2022/daffodil-design-notification.mjs.map +1 -1
- package/fesm2022/daffodil-design-paginator.mjs +296 -192
- package/fesm2022/daffodil-design-paginator.mjs.map +1 -1
- package/fesm2022/daffodil-design-progress-bar.mjs +243 -157
- package/fesm2022/daffodil-design-progress-bar.mjs.map +1 -1
- package/fesm2022/daffodil-design-radio.mjs +382 -300
- package/fesm2022/daffodil-design-radio.mjs.map +1 -1
- package/fesm2022/daffodil-design-select.mjs +424 -364
- package/fesm2022/daffodil-design-select.mjs.map +1 -1
- package/fesm2022/daffodil-design-sidebar.mjs +874 -887
- package/fesm2022/daffodil-design-sidebar.mjs.map +1 -1
- package/fesm2022/daffodil-design-spinner.mjs +156 -99
- package/fesm2022/daffodil-design-spinner.mjs.map +1 -1
- package/fesm2022/daffodil-design-switch.mjs +176 -106
- package/fesm2022/daffodil-design-switch.mjs.map +1 -1
- package/fesm2022/daffodil-design-tabs.mjs +685 -427
- package/fesm2022/daffodil-design-tabs.mjs.map +1 -1
- package/fesm2022/daffodil-design-tag.mjs +251 -133
- package/fesm2022/daffodil-design-tag.mjs.map +1 -1
- package/fesm2022/daffodil-design-testing.mjs +4 -16
- package/fesm2022/daffodil-design-testing.mjs.map +1 -1
- package/fesm2022/daffodil-design-text-snippet.mjs +140 -54
- package/fesm2022/daffodil-design-text-snippet.mjs.map +1 -1
- package/fesm2022/daffodil-design-textarea.mjs +170 -150
- package/fesm2022/daffodil-design-textarea.mjs.map +1 -1
- package/fesm2022/daffodil-design-toast.mjs +658 -481
- package/fesm2022/daffodil-design-toast.mjs.map +1 -1
- package/fesm2022/daffodil-design-tree.mjs +456 -469
- package/fesm2022/daffodil-design-tree.mjs.map +1 -1
- package/fesm2022/daffodil-design-youtube-player.mjs +168 -115
- package/fesm2022/daffodil-design-youtube-player.mjs.map +1 -1
- package/fesm2022/daffodil-design.mjs +1628 -1650
- package/fesm2022/daffodil-design.mjs.map +1 -1
- package/form-field/README.md +0 -4
- package/form-field/src/form-field-theme.scss +12 -4
- package/image/README.md +4 -0
- package/image-lite/README.md +58 -0
- package/image-lite/src/image-theme.scss +18 -0
- package/list/src/list-base.scss +3 -4
- package/list/src/list-theme.scss +6 -5
- package/media-gallery/README.md +1 -1
- package/media-gallery/src/media-gallery-theme.scss +3 -3
- package/menu/src/menu-theme.scss +6 -2
- package/notification/src/notification-theme.scss +10 -10
- package/package.json +1 -1
- package/scss/global.scss +17 -11
- package/scss/theme.scss +2 -18
- package/scss/theming/_get-palette.scss +0 -3
- package/scss/theming/_index.scss +0 -1
- package/scss/theming/_light-dark.scss +2 -2
- package/scss/theming/_theme-css-variables.scss +1 -1
- package/scss/theming/create-theme/_create-theme.scss +2 -2
- package/scss/theming/get-font-colors/_get-font-colors.scss +7 -25
- package/scss/theming/get-font-colors/_get-font-colors.spec.scss +0 -12
- package/scss/typography/_classes.scss +0 -6
- package/scss/typography/_index.scss +0 -1
- package/scss/typography/mixins/_sizes.scss +0 -1
- package/scss/typography/utilities/_variables.scss +3 -0
- package/select/src/select-theme.scss +10 -14
- package/switch/src/switch-theme.scss +2 -2
- package/tabs/src/tabs-theme.scss +4 -4
- package/types/daffodil-design-accordion.d.ts +92 -67
- package/types/daffodil-design-article.d.ts +49 -56
- package/types/daffodil-design-badge.d.ts +56 -33
- package/types/daffodil-design-beacon.d.ts +35 -14
- package/types/daffodil-design-breadcrumb.d.ts +89 -85
- package/types/daffodil-design-button.d.ts +128 -146
- package/types/daffodil-design-callout.d.ts +55 -39
- package/types/daffodil-design-card.d.ts +66 -56
- package/types/daffodil-design-checkbox.d.ts +211 -167
- package/types/daffodil-design-container.d.ts +17 -16
- package/types/daffodil-design-form-field.d.ts +273 -240
- package/types/daffodil-design-form.d.ts +21 -21
- package/types/daffodil-design-hero.d.ts +55 -39
- package/types/daffodil-design-image-lite.d.ts +17 -0
- package/types/daffodil-design-image.d.ts +89 -55
- package/types/daffodil-design-input.d.ts +86 -72
- package/types/daffodil-design-list.d.ts +49 -43
- package/types/daffodil-design-media-gallery.d.ts +176 -148
- package/types/daffodil-design-menu.d.ts +177 -169
- package/types/daffodil-design-modal.d.ts +205 -205
- package/types/daffodil-design-native-select.d.ts +94 -84
- package/types/daffodil-design-navbar.d.ts +34 -24
- package/types/daffodil-design-notification.d.ts +82 -67
- package/types/daffodil-design-paginator.d.ts +140 -118
- package/types/daffodil-design-progress-bar.d.ts +92 -74
- package/types/daffodil-design-radio.d.ts +183 -144
- package/types/daffodil-design-select.d.ts +207 -178
- package/types/daffodil-design-sidebar.d.ts +270 -253
- package/types/daffodil-design-spinner.d.ts +49 -36
- package/types/daffodil-design-switch.d.ts +77 -46
- package/types/daffodil-design-tabs.d.ts +248 -198
- package/types/daffodil-design-tag.d.ts +91 -56
- package/types/daffodil-design-testing.d.ts +1 -3
- package/types/daffodil-design-text-snippet.d.ts +48 -37
- package/types/daffodil-design-textarea.d.ts +88 -79
- package/types/daffodil-design-toast.d.ts +175 -183
- package/types/daffodil-design-tree.d.ts +186 -169
- package/types/daffodil-design-youtube-player.d.ts +56 -52
- package/types/daffodil-design.d.ts +614 -695
- package/button/src/button/raised/raised-theme.scss +0 -92
- package/button/src/button/underline/underline-theme.scss +0 -141
- package/fesm2022/daffodil-design-link-set.mjs +0 -160
- package/fesm2022/daffodil-design-link-set.mjs.map +0 -1
- package/fesm2022/daffodil-design-quantity-field.mjs +0 -364
- package/fesm2022/daffodil-design-quantity-field.mjs.map +0 -1
- package/link-set/README.md +0 -86
- package/quantity-field/README.md +0 -63
- package/scss/theming/_configure-theme.scss +0 -120
- package/scss/typography/mixins/_font-weight.scss +0 -14
- package/types/daffodil-design-link-set.d.ts +0 -72
- package/types/daffodil-design-quantity-field.d.ts +0 -171
|
@@ -1,366 +1,426 @@
|
|
|
1
|
-
import * as i2 from
|
|
2
|
-
import { OverlayModule } from
|
|
3
|
-
import * as i5 from
|
|
4
|
-
import { PortalModule } from
|
|
5
|
-
import { NgTemplateOutlet } from
|
|
6
|
-
import * as i0 from
|
|
7
|
-
import {
|
|
8
|
-
import * as i1 from
|
|
9
|
-
import { Validators } from
|
|
10
|
-
import { Subject,
|
|
11
|
-
import * as i3 from
|
|
12
|
-
import { DaffOpenableDirective } from
|
|
13
|
-
import * as i4 from
|
|
14
|
-
import { DaffFormFieldControl } from
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
1
|
+
import * as i2 from "@angular/cdk/overlay";
|
|
2
|
+
import { OverlayModule } from "@angular/cdk/overlay";
|
|
3
|
+
import * as i5 from "@angular/cdk/portal";
|
|
4
|
+
import { PortalModule } from "@angular/cdk/portal";
|
|
5
|
+
import { NgTemplateOutlet } from "@angular/common";
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
import { ChangeDetectionStrategy, Component, ContentChild, DOCUMENT, Directive, ElementRef, Inject, Input, Optional, Self, ViewChild, ViewEncapsulation, booleanAttribute } from "@angular/core";
|
|
8
|
+
import * as i1 from "@angular/forms";
|
|
9
|
+
import { Validators } from "@angular/forms";
|
|
10
|
+
import { Subject, delay, map, merge, of, takeUntil, tap } from "rxjs";
|
|
11
|
+
import * as i3 from "@daffodil/design";
|
|
12
|
+
import { DaffOpenableDirective } from "@daffodil/design";
|
|
13
|
+
import * as i4 from "@daffodil/design/form-field";
|
|
14
|
+
import { DaffFormFieldControl, DaffFormFieldControlTypesEnum } from "@daffodil/design/form-field";
|
|
15
|
+
var DaffSelectOptionDirective = class DaffSelectOptionDirective {
|
|
16
|
+
constructor(templateRef) {
|
|
17
|
+
this.templateRef = templateRef;
|
|
18
|
+
}
|
|
19
|
+
static {
|
|
20
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
21
|
+
minVersion: "12.0.0",
|
|
22
|
+
version: "22.2.4",
|
|
23
|
+
ngImport: i0,
|
|
24
|
+
type: DaffSelectOptionDirective,
|
|
25
|
+
deps: [{
|
|
26
|
+
token: i0.TemplateRef,
|
|
27
|
+
optional: true
|
|
28
|
+
}],
|
|
29
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
static {
|
|
33
|
+
this.ɵdir = i0.ɵɵngDeclareDirective({
|
|
34
|
+
minVersion: "14.0.0",
|
|
35
|
+
version: "22.2.4",
|
|
36
|
+
type: DaffSelectOptionDirective,
|
|
37
|
+
isStandalone: true,
|
|
38
|
+
selector: "[daffSelectOption]",
|
|
39
|
+
ngImport: i0
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
44
|
+
minVersion: "12.0.0",
|
|
45
|
+
version: "22.2.4",
|
|
46
|
+
ngImport: i0,
|
|
47
|
+
type: DaffSelectOptionDirective,
|
|
48
|
+
decorators: [{
|
|
49
|
+
type: Directive,
|
|
50
|
+
args: [{ selector: "[daffSelectOption]" }]
|
|
51
|
+
}],
|
|
52
|
+
ctorParameters: () => [{
|
|
53
|
+
type: i0.TemplateRef,
|
|
54
|
+
decorators: [{ type: Optional }]
|
|
55
|
+
}]
|
|
56
|
+
});
|
|
35
57
|
let daffSelectOtionsId = 0;
|
|
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
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
]
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
58
|
+
var DaffSelectComponent = class DaffSelectComponent extends DaffFormFieldControl {
|
|
59
|
+
get focused() {
|
|
60
|
+
return this.document.activeElement === this.buttonElement?.nativeElement || this.document.activeElement === this.optionsElement?.nativeElement;
|
|
61
|
+
}
|
|
62
|
+
get raised() {
|
|
63
|
+
return this.focused && this.isOpen;
|
|
64
|
+
}
|
|
65
|
+
get opened() {
|
|
66
|
+
return this.isOpen;
|
|
67
|
+
}
|
|
68
|
+
focus() {
|
|
69
|
+
this.buttonElement?.nativeElement?.focus();
|
|
70
|
+
this.emitState();
|
|
71
|
+
}
|
|
72
|
+
blur() {
|
|
73
|
+
if (!this.isOpen) this.onTouched();
|
|
74
|
+
this.emitState(true);
|
|
75
|
+
}
|
|
76
|
+
get required() {
|
|
77
|
+
return this.ngControl?.control?.hasValidator(Validators.required) ?? this._required;
|
|
78
|
+
}
|
|
79
|
+
set required(value) {
|
|
80
|
+
this._required = value;
|
|
81
|
+
}
|
|
82
|
+
get isOpen() {
|
|
83
|
+
return this.openDirective.open();
|
|
84
|
+
}
|
|
85
|
+
constructor(cd, document, ngControl, overlay, openDirective, formField) {
|
|
86
|
+
super(ngControl);
|
|
87
|
+
this.cd = cd;
|
|
88
|
+
this.document = document;
|
|
89
|
+
this.ngControl = ngControl;
|
|
90
|
+
this.overlay = overlay;
|
|
91
|
+
this.openDirective = openDirective;
|
|
92
|
+
this.formField = formField;
|
|
93
|
+
this.controlType = DaffFormFieldControlTypesEnum.Dropdown;
|
|
94
|
+
this.supportsAutoLabelling = false;
|
|
95
|
+
this._destroyed = new Subject();
|
|
96
|
+
this._value = null;
|
|
97
|
+
this._highlighted = 0;
|
|
98
|
+
this.disabled = false;
|
|
99
|
+
this._required = false;
|
|
100
|
+
this.options = [];
|
|
101
|
+
this.ariaLabelledBy = "";
|
|
102
|
+
this.optionsId = "daff-select-options-" + ++daffSelectOtionsId;
|
|
103
|
+
if (!this.formField) throw new Error("DaffSelectComponent needs to be used with the DaffFormFieldComponent.");
|
|
104
|
+
this.ariaLabelledBy = this.formField.id();
|
|
105
|
+
this.openDirective.stateless = false;
|
|
106
|
+
this.document.addEventListener("keydown", (event) => {
|
|
107
|
+
if (event.key === "Tab" && this.isOpen) {
|
|
108
|
+
event.preventDefault();
|
|
109
|
+
event.stopPropagation();
|
|
110
|
+
this.focusOptionsList();
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
if (this.ngControl != null) this.ngControl.valueAccessor = this;
|
|
114
|
+
}
|
|
115
|
+
get value() {
|
|
116
|
+
return this._value;
|
|
117
|
+
}
|
|
118
|
+
get highlighted() {
|
|
119
|
+
return this._highlighted;
|
|
120
|
+
}
|
|
121
|
+
set highlighted(val) {
|
|
122
|
+
this._highlighted = val;
|
|
123
|
+
this.cd.markForCheck();
|
|
124
|
+
}
|
|
125
|
+
focusOptionsList() {
|
|
126
|
+
this.optionsElement?.nativeElement.focus();
|
|
127
|
+
}
|
|
128
|
+
focusButton() {
|
|
129
|
+
this.buttonElement?.nativeElement.focus();
|
|
130
|
+
}
|
|
131
|
+
ngOnDestroy() {
|
|
132
|
+
this._destroyed.next(true);
|
|
133
|
+
this._overlay?.dispose();
|
|
134
|
+
}
|
|
135
|
+
onChange(value) {}
|
|
136
|
+
onTouched() {}
|
|
137
|
+
writeValue(value) {
|
|
138
|
+
this._value = value;
|
|
139
|
+
this.cd.markForCheck();
|
|
140
|
+
}
|
|
141
|
+
registerOnChange(fn) {
|
|
142
|
+
this.onChange = fn;
|
|
143
|
+
}
|
|
144
|
+
registerOnTouched(fn) {
|
|
145
|
+
this.onTouched = fn;
|
|
146
|
+
}
|
|
147
|
+
flushValue() {
|
|
148
|
+
this.ngControl?.control?.setValue(this._value);
|
|
149
|
+
}
|
|
150
|
+
ngOnInit() {
|
|
151
|
+
this.stateChanges = merge(this._stateChanges.asObservable(), this.ngControl ? this.ngControl.statusChanges : of(void 0)).pipe(map(() => this.state), tap((state) => this.disabled = state.disabled));
|
|
152
|
+
}
|
|
153
|
+
open(event) {
|
|
154
|
+
event?.preventDefault();
|
|
155
|
+
event?.stopPropagation();
|
|
156
|
+
if (!this.openDirective.open()) {
|
|
157
|
+
this.openDirective.open.set(true);
|
|
158
|
+
if (this._value) this._highlighted = this.options.findIndex((v) => v === this._value);
|
|
159
|
+
const wrapperEl = this.formField._wrapper().nativeElement;
|
|
160
|
+
const wrapperWidth = wrapperEl.getBoundingClientRect().width;
|
|
161
|
+
this._overlay = this.overlay.create({
|
|
162
|
+
hasBackdrop: true,
|
|
163
|
+
backdropClass: "cdk-overlay-transparent-backdrop",
|
|
164
|
+
scrollStrategy: this.overlay.scrollStrategies.block(),
|
|
165
|
+
disposeOnNavigation: true,
|
|
166
|
+
width: `${wrapperWidth}px`,
|
|
167
|
+
positionStrategy: this.overlay.position().flexibleConnectedTo(wrapperEl).withPositions([{
|
|
168
|
+
originX: "start",
|
|
169
|
+
originY: "bottom",
|
|
170
|
+
overlayX: "start",
|
|
171
|
+
overlayY: "top",
|
|
172
|
+
offsetY: 2
|
|
173
|
+
}, {
|
|
174
|
+
originX: "start",
|
|
175
|
+
originY: "top",
|
|
176
|
+
overlayX: "start",
|
|
177
|
+
overlayY: "bottom",
|
|
178
|
+
offsetY: -2
|
|
179
|
+
}])
|
|
180
|
+
});
|
|
181
|
+
this._overlay.attachments().pipe(takeUntil(this._destroyed), delay(0)).subscribe(() => {
|
|
182
|
+
this.focusOptionsList();
|
|
183
|
+
});
|
|
184
|
+
this._overlay.attach(this.optionsTemplatePortal);
|
|
185
|
+
this._overlay.backdropClick().pipe(takeUntil(this._destroyed)).subscribe(() => this.close());
|
|
186
|
+
this.cd.markForCheck();
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
close(event) {
|
|
190
|
+
event?.preventDefault();
|
|
191
|
+
event?.stopPropagation();
|
|
192
|
+
if (this.openDirective.open()) {
|
|
193
|
+
this.openDirective.open.set(false);
|
|
194
|
+
this.onTouched();
|
|
195
|
+
this.cd.markForCheck();
|
|
196
|
+
this._overlay?.dispose();
|
|
197
|
+
this._overlay = null;
|
|
198
|
+
this.focusButton();
|
|
199
|
+
this.emitState(true);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
selectValueInPosition(position) {
|
|
203
|
+
if (position >= 0 && position < this.options.length) this.writeValue(this.options[position]);
|
|
204
|
+
this.close();
|
|
205
|
+
}
|
|
206
|
+
selectOption(option) {
|
|
207
|
+
this._value = option;
|
|
208
|
+
this.onChange(this._value);
|
|
209
|
+
this.close();
|
|
210
|
+
}
|
|
211
|
+
selectHighlighted(event) {
|
|
212
|
+
event?.preventDefault();
|
|
213
|
+
event?.stopPropagation();
|
|
214
|
+
this.selectValueInPosition(this._highlighted);
|
|
215
|
+
this.onChange(this._value);
|
|
216
|
+
}
|
|
217
|
+
highlightNext(event) {
|
|
218
|
+
event?.preventDefault();
|
|
219
|
+
event?.stopPropagation();
|
|
220
|
+
this._highlighted = this._highlighted < this.options.length - 1 ? this._highlighted + 1 : 0;
|
|
221
|
+
(event?.target).children[this._highlighted].scrollIntoView();
|
|
222
|
+
}
|
|
223
|
+
highlightPrevious(event) {
|
|
224
|
+
event?.preventDefault();
|
|
225
|
+
event?.stopPropagation();
|
|
226
|
+
this._highlighted = this._highlighted > 0 ? this._highlighted - 1 : this.options.length - 1;
|
|
227
|
+
(event?.target).children[this._highlighted].scrollIntoView();
|
|
228
|
+
}
|
|
229
|
+
static {
|
|
230
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
231
|
+
minVersion: "12.0.0",
|
|
232
|
+
version: "22.2.4",
|
|
233
|
+
ngImport: i0,
|
|
234
|
+
type: DaffSelectComponent,
|
|
235
|
+
deps: [
|
|
236
|
+
{ token: i0.ChangeDetectorRef },
|
|
237
|
+
{ token: DOCUMENT },
|
|
238
|
+
{
|
|
239
|
+
token: i1.NgControl,
|
|
240
|
+
optional: true,
|
|
241
|
+
self: true
|
|
242
|
+
},
|
|
243
|
+
{ token: i2.Overlay },
|
|
244
|
+
{ token: i3.DaffOpenableDirective },
|
|
245
|
+
{
|
|
246
|
+
token: i4.DaffFormFieldComponent,
|
|
247
|
+
optional: true
|
|
248
|
+
}
|
|
249
|
+
],
|
|
250
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
static {
|
|
254
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
255
|
+
minVersion: "17.0.0",
|
|
256
|
+
version: "22.2.4",
|
|
257
|
+
type: DaffSelectComponent,
|
|
258
|
+
isStandalone: true,
|
|
259
|
+
selector: "daff-select",
|
|
260
|
+
inputs: {
|
|
261
|
+
disabled: [
|
|
262
|
+
"disabled",
|
|
263
|
+
"disabled",
|
|
264
|
+
booleanAttribute
|
|
265
|
+
],
|
|
266
|
+
required: [
|
|
267
|
+
"required",
|
|
268
|
+
"required",
|
|
269
|
+
booleanAttribute
|
|
270
|
+
],
|
|
271
|
+
options: "options",
|
|
272
|
+
optionsId: "optionsId"
|
|
273
|
+
},
|
|
274
|
+
host: {
|
|
275
|
+
properties: { "attr.aria-labelledby": "ariaLabelledBy" },
|
|
276
|
+
classAttribute: "daff-select"
|
|
277
|
+
},
|
|
278
|
+
providers: [{
|
|
279
|
+
provide: DaffFormFieldControl,
|
|
280
|
+
useExisting: DaffSelectComponent
|
|
281
|
+
}],
|
|
282
|
+
queries: [{
|
|
283
|
+
propertyName: "optionTemplate",
|
|
284
|
+
first: true,
|
|
285
|
+
predicate: DaffSelectOptionDirective,
|
|
286
|
+
descendants: true
|
|
287
|
+
}],
|
|
288
|
+
viewQueries: [
|
|
289
|
+
{
|
|
290
|
+
propertyName: "buttonElement",
|
|
291
|
+
first: true,
|
|
292
|
+
predicate: ["field"],
|
|
293
|
+
descendants: true
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
propertyName: "optionsTemplatePortal",
|
|
297
|
+
first: true,
|
|
298
|
+
predicate: ["optionsTemplate"],
|
|
299
|
+
descendants: true
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
propertyName: "optionsElement",
|
|
303
|
+
first: true,
|
|
304
|
+
predicate: ["optionsEl"],
|
|
305
|
+
descendants: true,
|
|
306
|
+
read: ElementRef
|
|
307
|
+
}
|
|
308
|
+
],
|
|
309
|
+
usesInheritance: true,
|
|
310
|
+
hostDirectives: [{ directive: i3.DaffOpenableDirective }],
|
|
311
|
+
ngImport: i0,
|
|
312
|
+
template: "<button\n #field\n class=\"daff-select__field\"\n type=\"button\"\n (click)=\"open($event)\"\n (focus)=\"focus()\"\n (blur)=\"blur()\"\n [disabled]=\"disabled\"\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n [attr.aria-expanded]=\"isOpen\"\n [attr.aria-controls]=\"optionsId\"\n (keydown.arrowdown)=\"open($event)\"\n (keydown.arrowup)=\"open($event)\"\n (keydown.alt.arrowup)=\"open($event)\"\n (keydown.alt.arrowdown)=\"open($event)\"\n (keydown.space)=\"open($event)\"\n (keydown.enter)=\"open($event)\"\n>\n @if (value) {\n <ng-container\n [ngTemplateOutlet]=\"$safeNavigationMigration(optionTemplate?.templateRef)\"\n [ngTemplateOutletContext]=\"{\n option: value,\n isSelected: true,\n isHighlighted: true,\n }\"\n ><div></div>\n </ng-container>\n }\n</button>\n<ng-template cdkPortal #optionsTemplate=\"cdkPortal\">\n <div\n class=\"daff-select__options\"\n #optionsEl\n [id]=\"optionsId\"\n tabindex=\"0\"\n role=\"listbox\"\n (blur)=\"blur()\"\n (keydown.enter)=\"selectHighlighted($event)\"\n (keydown.space)=\"selectHighlighted($event)\"\n (keydown.escape)=\"close($event)\"\n (keydown.arrowdown)=\"highlightNext($event)\"\n (keydown.arrowup)=\"highlightPrevious($event)\"\n >\n @for (option of options; track $index; let i = $index) {\n <div\n class=\"daff-select__option\"\n [class.selected]=\"value === option\"\n [class.highlighted]=\"highlighted === i\"\n (click)=\"selectOption(option)\"\n >\n <ng-container\n [ngTemplateOutlet]=\"\n $safeNavigationMigration(optionTemplate?.templateRef)\n \"\n [ngTemplateOutletContext]=\"{\n isSelected: value === option,\n isHighlighted: highlighted === i,\n option,\n }\"\n >\n </ng-container>\n </div>\n }\n </div>\n</ng-template>\n",
|
|
313
|
+
styles: [".daff-select{display:inline-block;width:100%}.daff-select.disabled .daff-select__field{cursor:not-allowed}.daff-select__field{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;appearance:none;background:none;border:none;font-size:1rem;line-height:1.25rem;min-height:3.5rem;margin:0;outline:none;padding:1.5rem 0 .5rem;text-align:left;width:100%;position:relative}.daff-select__field[disabled]{cursor:not-allowed}.daff-select.daff-open .daff-select__field:after{top:56%;transform:translateY(-50%) rotate(225deg)}.daff-select__options{width:100%;border-radius:.25rem;overflow:hidden}.daff-select__option{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:block;appearance:none;background:none;border:none;font-size:1rem;line-height:1.25rem;margin:0;padding:.5rem;text-align:left;width:100%}\n"],
|
|
314
|
+
dependencies: [
|
|
315
|
+
{
|
|
316
|
+
kind: "directive",
|
|
317
|
+
type: NgTemplateOutlet,
|
|
318
|
+
selector: "[ngTemplateOutlet]",
|
|
319
|
+
inputs: [
|
|
320
|
+
"ngTemplateOutletContext",
|
|
321
|
+
"ngTemplateOutlet",
|
|
322
|
+
"ngTemplateOutletInjector"
|
|
323
|
+
]
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
kind: "ngmodule",
|
|
327
|
+
type: OverlayModule
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
kind: "ngmodule",
|
|
331
|
+
type: PortalModule
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
kind: "directive",
|
|
335
|
+
type: i5.CdkPortal,
|
|
336
|
+
selector: "[cdkPortal]",
|
|
337
|
+
exportAs: ["cdkPortal"]
|
|
338
|
+
}
|
|
339
|
+
],
|
|
340
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
341
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
346
|
+
minVersion: "12.0.0",
|
|
347
|
+
version: "22.2.4",
|
|
348
|
+
ngImport: i0,
|
|
349
|
+
type: DaffSelectComponent,
|
|
350
|
+
decorators: [{
|
|
351
|
+
type: Component,
|
|
352
|
+
args: [{
|
|
353
|
+
selector: "daff-select",
|
|
354
|
+
encapsulation: ViewEncapsulation.None,
|
|
355
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
356
|
+
hostDirectives: [{ directive: DaffOpenableDirective }],
|
|
357
|
+
host: {
|
|
358
|
+
class: "daff-select",
|
|
359
|
+
"[attr.aria-labelledby]": "ariaLabelledBy"
|
|
360
|
+
},
|
|
361
|
+
providers: [{
|
|
362
|
+
provide: DaffFormFieldControl,
|
|
363
|
+
useExisting: DaffSelectComponent
|
|
364
|
+
}],
|
|
365
|
+
imports: [
|
|
366
|
+
NgTemplateOutlet,
|
|
367
|
+
OverlayModule,
|
|
368
|
+
PortalModule
|
|
369
|
+
],
|
|
370
|
+
template: "<button\n #field\n class=\"daff-select__field\"\n type=\"button\"\n (click)=\"open($event)\"\n (focus)=\"focus()\"\n (blur)=\"blur()\"\n [disabled]=\"disabled\"\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n [attr.aria-expanded]=\"isOpen\"\n [attr.aria-controls]=\"optionsId\"\n (keydown.arrowdown)=\"open($event)\"\n (keydown.arrowup)=\"open($event)\"\n (keydown.alt.arrowup)=\"open($event)\"\n (keydown.alt.arrowdown)=\"open($event)\"\n (keydown.space)=\"open($event)\"\n (keydown.enter)=\"open($event)\"\n>\n @if (value) {\n <ng-container\n [ngTemplateOutlet]=\"$safeNavigationMigration(optionTemplate?.templateRef)\"\n [ngTemplateOutletContext]=\"{\n option: value,\n isSelected: true,\n isHighlighted: true,\n }\"\n ><div></div>\n </ng-container>\n }\n</button>\n<ng-template cdkPortal #optionsTemplate=\"cdkPortal\">\n <div\n class=\"daff-select__options\"\n #optionsEl\n [id]=\"optionsId\"\n tabindex=\"0\"\n role=\"listbox\"\n (blur)=\"blur()\"\n (keydown.enter)=\"selectHighlighted($event)\"\n (keydown.space)=\"selectHighlighted($event)\"\n (keydown.escape)=\"close($event)\"\n (keydown.arrowdown)=\"highlightNext($event)\"\n (keydown.arrowup)=\"highlightPrevious($event)\"\n >\n @for (option of options; track $index; let i = $index) {\n <div\n class=\"daff-select__option\"\n [class.selected]=\"value === option\"\n [class.highlighted]=\"highlighted === i\"\n (click)=\"selectOption(option)\"\n >\n <ng-container\n [ngTemplateOutlet]=\"\n $safeNavigationMigration(optionTemplate?.templateRef)\n \"\n [ngTemplateOutletContext]=\"{\n isSelected: value === option,\n isHighlighted: highlighted === i,\n option,\n }\"\n >\n </ng-container>\n </div>\n }\n </div>\n</ng-template>\n",
|
|
371
|
+
styles: [".daff-select{display:inline-block;width:100%}.daff-select.disabled .daff-select__field{cursor:not-allowed}.daff-select__field{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;appearance:none;background:none;border:none;font-size:1rem;line-height:1.25rem;min-height:3.5rem;margin:0;outline:none;padding:1.5rem 0 .5rem;text-align:left;width:100%;position:relative}.daff-select__field[disabled]{cursor:not-allowed}.daff-select.daff-open .daff-select__field:after{top:56%;transform:translateY(-50%) rotate(225deg)}.daff-select__options{width:100%;border-radius:.25rem;overflow:hidden}.daff-select__option{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:block;appearance:none;background:none;border:none;font-size:1rem;line-height:1.25rem;margin:0;padding:.5rem;text-align:left;width:100%}\n"]
|
|
372
|
+
}]
|
|
373
|
+
}],
|
|
374
|
+
ctorParameters: () => [
|
|
375
|
+
{ type: i0.ChangeDetectorRef },
|
|
376
|
+
{
|
|
377
|
+
type: Document,
|
|
378
|
+
decorators: [{
|
|
379
|
+
type: Inject,
|
|
380
|
+
args: [DOCUMENT]
|
|
381
|
+
}]
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
type: i1.NgControl,
|
|
385
|
+
decorators: [{ type: Optional }, { type: Self }]
|
|
386
|
+
},
|
|
387
|
+
{ type: i2.Overlay },
|
|
388
|
+
{ type: i3.DaffOpenableDirective },
|
|
389
|
+
{
|
|
390
|
+
type: i4.DaffFormFieldComponent,
|
|
391
|
+
decorators: [{ type: Optional }]
|
|
392
|
+
}
|
|
393
|
+
],
|
|
394
|
+
propDecorators: {
|
|
395
|
+
disabled: [{
|
|
396
|
+
type: Input,
|
|
397
|
+
args: [{ transform: booleanAttribute }]
|
|
398
|
+
}],
|
|
399
|
+
required: [{
|
|
400
|
+
type: Input,
|
|
401
|
+
args: [{ transform: booleanAttribute }]
|
|
402
|
+
}],
|
|
403
|
+
options: [{ type: Input }],
|
|
404
|
+
optionsId: [{ type: Input }],
|
|
405
|
+
buttonElement: [{
|
|
406
|
+
type: ViewChild,
|
|
407
|
+
args: ["field"]
|
|
408
|
+
}],
|
|
409
|
+
optionsTemplatePortal: [{
|
|
410
|
+
type: ViewChild,
|
|
411
|
+
args: ["optionsTemplate"]
|
|
412
|
+
}],
|
|
413
|
+
optionsElement: [{
|
|
414
|
+
type: ViewChild,
|
|
415
|
+
args: ["optionsEl", { read: ElementRef }]
|
|
416
|
+
}],
|
|
417
|
+
optionTemplate: [{
|
|
418
|
+
type: ContentChild,
|
|
419
|
+
args: [DaffSelectOptionDirective]
|
|
420
|
+
}]
|
|
421
|
+
}
|
|
422
|
+
});
|
|
423
|
+
const DAFF_SELECT_COMPONENTS = [DaffSelectComponent, DaffSelectOptionDirective];
|
|
365
424
|
export { DAFF_SELECT_COMPONENTS, DaffSelectComponent, DaffSelectOptionDirective };
|
|
366
|
-
|
|
425
|
+
|
|
426
|
+
//# sourceMappingURL=daffodil-design-select.mjs.map
|