@daffodil/design 0.94.1 → 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.
Files changed (170) hide show
  1. package/README.md +1 -2
  2. package/accordion/src/accordion-theme.scss +4 -4
  3. package/article/README.md +4 -27
  4. package/article/src/article-theme.scss +14 -14
  5. package/badge/src/badge-theme.scss +0 -6
  6. package/button/README.md +0 -4
  7. package/button/src/button/basic/button-theme.scss +17 -42
  8. package/button/src/button/button-base.scss +12 -3
  9. package/button/src/button/flat/flat-theme.scss +14 -12
  10. package/button/src/button/icon/icon-theme.scss +19 -40
  11. package/button/src/button/stroked/stroked-theme.scss +22 -36
  12. package/card/src/card/stroked/stroked-theme.scss +1 -1
  13. package/card/src/card-base.scss +0 -1
  14. package/fesm2022/daffodil-design-accordion.mjs +285 -188
  15. package/fesm2022/daffodil-design-accordion.mjs.map +1 -1
  16. package/fesm2022/daffodil-design-article.mjs +578 -340
  17. package/fesm2022/daffodil-design-article.mjs.map +1 -1
  18. package/fesm2022/daffodil-design-badge.mjs +166 -84
  19. package/fesm2022/daffodil-design-badge.mjs.map +1 -1
  20. package/fesm2022/daffodil-design-beacon.mjs +109 -47
  21. package/fesm2022/daffodil-design-beacon.mjs.map +1 -1
  22. package/fesm2022/daffodil-design-breadcrumb.mjs +384 -277
  23. package/fesm2022/daffodil-design-breadcrumb.mjs.map +1 -1
  24. package/fesm2022/daffodil-design-button.mjs +541 -408
  25. package/fesm2022/daffodil-design-button.mjs.map +1 -1
  26. package/fesm2022/daffodil-design-callout.mjs +349 -224
  27. package/fesm2022/daffodil-design-callout.mjs.map +1 -1
  28. package/fesm2022/daffodil-design-card.mjs +496 -327
  29. package/fesm2022/daffodil-design-card.mjs.map +1 -1
  30. package/fesm2022/daffodil-design-checkbox.mjs +373 -313
  31. package/fesm2022/daffodil-design-checkbox.mjs.map +1 -1
  32. package/fesm2022/daffodil-design-container.mjs +103 -60
  33. package/fesm2022/daffodil-design-container.mjs.map +1 -1
  34. package/fesm2022/daffodil-design-form-field.mjs +441 -352
  35. package/fesm2022/daffodil-design-form-field.mjs.map +1 -1
  36. package/fesm2022/daffodil-design-form.mjs +155 -57
  37. package/fesm2022/daffodil-design-form.mjs.map +1 -1
  38. package/fesm2022/daffodil-design-hero.mjs +349 -234
  39. package/fesm2022/daffodil-design-hero.mjs.map +1 -1
  40. package/fesm2022/daffodil-design-image-lite.mjs +60 -0
  41. package/fesm2022/daffodil-design-image-lite.mjs.map +1 -0
  42. package/fesm2022/daffodil-design-image.mjs +245 -107
  43. package/fesm2022/daffodil-design-image.mjs.map +1 -1
  44. package/fesm2022/daffodil-design-input.mjs +217 -164
  45. package/fesm2022/daffodil-design-input.mjs.map +1 -1
  46. package/fesm2022/daffodil-design-list.mjs +308 -170
  47. package/fesm2022/daffodil-design-list.mjs.map +1 -1
  48. package/fesm2022/daffodil-design-media-gallery.mjs +351 -278
  49. package/fesm2022/daffodil-design-media-gallery.mjs.map +1 -1
  50. package/fesm2022/daffodil-design-menu.mjs +525 -417
  51. package/fesm2022/daffodil-design-menu.mjs.map +1 -1
  52. package/fesm2022/daffodil-design-modal.mjs +680 -450
  53. package/fesm2022/daffodil-design-modal.mjs.map +1 -1
  54. package/fesm2022/daffodil-design-native-select.mjs +175 -166
  55. package/fesm2022/daffodil-design-native-select.mjs.map +1 -1
  56. package/fesm2022/daffodil-design-navbar.mjs +145 -68
  57. package/fesm2022/daffodil-design-navbar.mjs.map +1 -1
  58. package/fesm2022/daffodil-design-notification.mjs +376 -226
  59. package/fesm2022/daffodil-design-notification.mjs.map +1 -1
  60. package/fesm2022/daffodil-design-paginator.mjs +296 -192
  61. package/fesm2022/daffodil-design-paginator.mjs.map +1 -1
  62. package/fesm2022/daffodil-design-progress-bar.mjs +243 -157
  63. package/fesm2022/daffodil-design-progress-bar.mjs.map +1 -1
  64. package/fesm2022/daffodil-design-radio.mjs +382 -300
  65. package/fesm2022/daffodil-design-radio.mjs.map +1 -1
  66. package/fesm2022/daffodil-design-select.mjs +424 -364
  67. package/fesm2022/daffodil-design-select.mjs.map +1 -1
  68. package/fesm2022/daffodil-design-sidebar.mjs +874 -887
  69. package/fesm2022/daffodil-design-sidebar.mjs.map +1 -1
  70. package/fesm2022/daffodil-design-spinner.mjs +156 -99
  71. package/fesm2022/daffodil-design-spinner.mjs.map +1 -1
  72. package/fesm2022/daffodil-design-switch.mjs +176 -106
  73. package/fesm2022/daffodil-design-switch.mjs.map +1 -1
  74. package/fesm2022/daffodil-design-tabs.mjs +685 -427
  75. package/fesm2022/daffodil-design-tabs.mjs.map +1 -1
  76. package/fesm2022/daffodil-design-tag.mjs +251 -133
  77. package/fesm2022/daffodil-design-tag.mjs.map +1 -1
  78. package/fesm2022/daffodil-design-testing.mjs +4 -16
  79. package/fesm2022/daffodil-design-testing.mjs.map +1 -1
  80. package/fesm2022/daffodil-design-text-snippet.mjs +140 -54
  81. package/fesm2022/daffodil-design-text-snippet.mjs.map +1 -1
  82. package/fesm2022/daffodil-design-textarea.mjs +170 -150
  83. package/fesm2022/daffodil-design-textarea.mjs.map +1 -1
  84. package/fesm2022/daffodil-design-toast.mjs +658 -481
  85. package/fesm2022/daffodil-design-toast.mjs.map +1 -1
  86. package/fesm2022/daffodil-design-tree.mjs +456 -469
  87. package/fesm2022/daffodil-design-tree.mjs.map +1 -1
  88. package/fesm2022/daffodil-design-youtube-player.mjs +168 -115
  89. package/fesm2022/daffodil-design-youtube-player.mjs.map +1 -1
  90. package/fesm2022/daffodil-design.mjs +1628 -1650
  91. package/fesm2022/daffodil-design.mjs.map +1 -1
  92. package/form-field/README.md +0 -4
  93. package/form-field/src/form-field-theme.scss +12 -4
  94. package/image/README.md +4 -0
  95. package/image-lite/README.md +58 -0
  96. package/image-lite/src/image-theme.scss +18 -0
  97. package/list/src/list-base.scss +3 -4
  98. package/list/src/list-theme.scss +6 -5
  99. package/media-gallery/README.md +1 -1
  100. package/media-gallery/src/media-gallery-theme.scss +3 -3
  101. package/menu/src/menu-theme.scss +6 -2
  102. package/notification/src/notification-theme.scss +10 -10
  103. package/package.json +1 -1
  104. package/scss/global.scss +17 -11
  105. package/scss/theme.scss +2 -18
  106. package/scss/theming/_get-palette.scss +0 -3
  107. package/scss/theming/_index.scss +0 -1
  108. package/scss/theming/_light-dark.scss +2 -2
  109. package/scss/theming/_theme-css-variables.scss +1 -1
  110. package/scss/theming/create-theme/_create-theme.scss +2 -2
  111. package/scss/theming/get-font-colors/_get-font-colors.scss +7 -25
  112. package/scss/theming/get-font-colors/_get-font-colors.spec.scss +0 -12
  113. package/scss/typography/_classes.scss +0 -6
  114. package/scss/typography/_index.scss +0 -1
  115. package/scss/typography/mixins/_sizes.scss +0 -1
  116. package/scss/typography/utilities/_variables.scss +3 -0
  117. package/select/src/select-theme.scss +10 -14
  118. package/switch/src/switch-theme.scss +2 -2
  119. package/tabs/src/tabs-theme.scss +4 -4
  120. package/types/daffodil-design-accordion.d.ts +92 -67
  121. package/types/daffodil-design-article.d.ts +49 -56
  122. package/types/daffodil-design-badge.d.ts +56 -33
  123. package/types/daffodil-design-beacon.d.ts +35 -14
  124. package/types/daffodil-design-breadcrumb.d.ts +89 -85
  125. package/types/daffodil-design-button.d.ts +128 -146
  126. package/types/daffodil-design-callout.d.ts +55 -39
  127. package/types/daffodil-design-card.d.ts +66 -56
  128. package/types/daffodil-design-checkbox.d.ts +211 -167
  129. package/types/daffodil-design-container.d.ts +17 -16
  130. package/types/daffodil-design-form-field.d.ts +273 -240
  131. package/types/daffodil-design-form.d.ts +21 -21
  132. package/types/daffodil-design-hero.d.ts +55 -39
  133. package/types/daffodil-design-image-lite.d.ts +17 -0
  134. package/types/daffodil-design-image.d.ts +89 -55
  135. package/types/daffodil-design-input.d.ts +86 -72
  136. package/types/daffodil-design-list.d.ts +49 -43
  137. package/types/daffodil-design-media-gallery.d.ts +176 -148
  138. package/types/daffodil-design-menu.d.ts +177 -169
  139. package/types/daffodil-design-modal.d.ts +205 -205
  140. package/types/daffodil-design-native-select.d.ts +94 -84
  141. package/types/daffodil-design-navbar.d.ts +34 -24
  142. package/types/daffodil-design-notification.d.ts +82 -67
  143. package/types/daffodil-design-paginator.d.ts +140 -118
  144. package/types/daffodil-design-progress-bar.d.ts +92 -74
  145. package/types/daffodil-design-radio.d.ts +183 -144
  146. package/types/daffodil-design-select.d.ts +207 -178
  147. package/types/daffodil-design-sidebar.d.ts +270 -253
  148. package/types/daffodil-design-spinner.d.ts +49 -36
  149. package/types/daffodil-design-switch.d.ts +77 -46
  150. package/types/daffodil-design-tabs.d.ts +248 -198
  151. package/types/daffodil-design-tag.d.ts +91 -56
  152. package/types/daffodil-design-testing.d.ts +1 -3
  153. package/types/daffodil-design-text-snippet.d.ts +48 -37
  154. package/types/daffodil-design-textarea.d.ts +88 -79
  155. package/types/daffodil-design-toast.d.ts +175 -183
  156. package/types/daffodil-design-tree.d.ts +186 -169
  157. package/types/daffodil-design-youtube-player.d.ts +56 -52
  158. package/types/daffodil-design.d.ts +614 -695
  159. package/button/src/button/raised/raised-theme.scss +0 -92
  160. package/button/src/button/underline/underline-theme.scss +0 -141
  161. package/fesm2022/daffodil-design-link-set.mjs +0 -160
  162. package/fesm2022/daffodil-design-link-set.mjs.map +0 -1
  163. package/fesm2022/daffodil-design-quantity-field.mjs +0 -364
  164. package/fesm2022/daffodil-design-quantity-field.mjs.map +0 -1
  165. package/link-set/README.md +0 -86
  166. package/quantity-field/README.md +0 -63
  167. package/scss/theming/_configure-theme.scss +0 -120
  168. package/scss/typography/mixins/_font-weight.scss +0 -14
  169. package/types/daffodil-design-link-set.d.ts +0 -72
  170. package/types/daffodil-design-quantity-field.d.ts +0 -171
@@ -1,317 +1,377 @@
1
- import { CommonModule } from '@angular/common';
2
- import * as i0 from '@angular/core';
3
- import { EventEmitter, ElementRef, HostBinding, Output, Input, ViewChild, ChangeDetectionStrategy, Component, ContentChildren, Optional, Self, Directive, NgModule } from '@angular/core';
4
- import * as i1 from '@angular/forms';
5
-
1
+ import { CommonModule } from "@angular/common";
2
+ import * as i0 from "@angular/core";
3
+ import { ChangeDetectionStrategy, Component, ContentChildren, Directive, ElementRef, EventEmitter, HostBinding, Input, NgModule, Optional, Output, Self, ViewChild } from "@angular/core";
4
+ import * as i1 from "@angular/forms";
6
5
  let checkboxIdNum = 0;
7
- class DaffCheckboxComponent {
8
- get checked() {
9
- return this._checked;
10
- }
11
- set checked(value) {
12
- if (this._checked === value) {
13
- return;
14
- }
15
- if (value === true) {
16
- this.nativeCheckbox.nativeElement.checked = true;
17
- this.becameChecked.emit(this._checked);
18
- }
19
- else {
20
- this.nativeCheckbox.nativeElement.checked = false;
21
- this.becameUnchecked.emit();
22
- }
23
- this._checked = value;
24
- }
25
- /**
26
- * @docs-private
27
- */
28
- _onChange(val) {
29
- if (val.target.checked) {
30
- this.select();
31
- }
32
- else {
33
- this.deselect();
34
- }
35
- }
36
- ;
37
- /**
38
- * @docs-private
39
- */
40
- get focusClass() {
41
- return this.focused === true;
42
- }
43
- ;
44
- /**
45
- * @docs-private
46
- */
47
- get disabledClass() {
48
- return this.disabled === true;
49
- }
50
- ;
51
- /**
52
- * Sets focused to false.
53
- */
54
- onBlur() {
55
- this.focused = false;
56
- }
57
- /**
58
- * Sets focused to true.
59
- */
60
- onFocus() {
61
- this.focused = true;
62
- }
63
- constructor(_cdRef) {
64
- this._cdRef = _cdRef;
65
- /**
66
- * Boolean value to determine whether or not the checkbox is checked.
67
- */
68
- this._checked = false;
69
- /**
70
- * The id of the checkbox. Must be unique. If not entered by a user then it is generated.
71
- */
72
- this.id = 'daff-checkbox-' + checkboxIdNum;
73
- /**
74
- * The aria-label of the checkbox.
75
- */
76
- // eslint-disable-next-line @angular-eslint/no-input-rename
77
- this.label = '';
78
- /**
79
- * Event on whether or not the selection has changed.
80
- */
81
- this.becameChecked = new EventEmitter();
82
- this.becameUnchecked = new EventEmitter();
83
- /**
84
- * The role of the component. Set to "checkbox".
85
- *
86
- * @docs-private
87
- */
88
- this.role = 'checkbox';
89
- /**
90
- * Increments id number on new checkbox. Gurantees unique ID on generation.
91
- */
92
- checkboxIdNum++;
93
- }
94
- /**
95
- * Sets checked to true.
96
- */
97
- select() {
98
- this.checked = true;
99
- this._cdRef.markForCheck();
100
- }
101
- /**
102
- * Sets checked to false
103
- */
104
- deselect() {
105
- this.checked = false;
106
- this._cdRef.markForCheck();
107
- }
108
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCheckboxComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
109
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.9", type: DaffCheckboxComponent, isStandalone: true, selector: "daff-checkbox", inputs: { name: "name", value: "value", checked: "checked", id: "id", label: ["aria-label", "label"], labeledBy: ["aria-labelledby", "labeledBy"] }, outputs: { becameChecked: "becameChecked", becameUnchecked: "becameUnchecked" }, host: { properties: { "attr.role": "this.role", "class.focused": "this.focusClass", "class.disabled": "this.disabledClass" } }, viewQueries: [{ propertyName: "nativeCheckbox", first: true, predicate: ["inputElement"], descendants: true, read: ElementRef, static: true }], ngImport: i0, template: "<input #inputElement\ntype=\"checkbox\"\n[attr.aria-label]=\"label\"\n[attr.aria-labelledby]=\"labeledBy\"\n[attr.checked]=\"checked ? '' : null\"\n[attr.id] = \"id\"\n[attr.value]=\"value\"\n[attr.name]=\"name\"\n[attr.disabled] = \"disabled ? '' : null\" \n(change)=\"_onChange($event)\"\n(blur)=\"onBlur()\"\n(focus)=\"onFocus()\"\n/>\n<label [attr.for]=\"id\"><ng-content></ng-content></label>", changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
110
- }
111
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCheckboxComponent, decorators: [{
112
- type: Component,
113
- args: [{ selector: 'daff-checkbox', changeDetection: ChangeDetectionStrategy.OnPush, template: "<input #inputElement\ntype=\"checkbox\"\n[attr.aria-label]=\"label\"\n[attr.aria-labelledby]=\"labeledBy\"\n[attr.checked]=\"checked ? '' : null\"\n[attr.id] = \"id\"\n[attr.value]=\"value\"\n[attr.name]=\"name\"\n[attr.disabled] = \"disabled ? '' : null\" \n(change)=\"_onChange($event)\"\n(blur)=\"onBlur()\"\n(focus)=\"onFocus()\"\n/>\n<label [attr.for]=\"id\"><ng-content></ng-content></label>" }]
114
- }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { nativeCheckbox: [{
115
- type: ViewChild,
116
- args: ['inputElement', { static: true, read: ElementRef }]
117
- }], name: [{
118
- type: Input
119
- }], value: [{
120
- type: Input
121
- }], checked: [{
122
- type: Input
123
- }], id: [{
124
- type: Input
125
- }], label: [{
126
- type: Input,
127
- args: ['aria-label']
128
- }], labeledBy: [{
129
- type: Input,
130
- args: ['aria-labelledby']
131
- }], becameChecked: [{
132
- type: Output
133
- }], becameUnchecked: [{
134
- type: Output
135
- }], role: [{
136
- type: HostBinding,
137
- args: ['attr.role']
138
- }], focusClass: [{
139
- type: HostBinding,
140
- args: ['class.focused']
141
- }], disabledClass: [{
142
- type: HostBinding,
143
- args: ['class.disabled']
144
- }] } });
145
-
146
- class DaffCheckboxSetComponent {
147
- constructor() {
148
- /**
149
- * The role of the component. Set to "checkbox".
150
- *
151
- * @docs-private
152
- */
153
- this.role = 'group';
154
- this.valueList = new EventEmitter();
155
- }
156
- getValues() {
157
- const checkboxes = this.checkboxes.toArray();
158
- return this.formArray.value.map((element, index) => element === true ? checkboxes[index].value : false).filter(element => element !== false);
159
- }
160
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCheckboxSetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
161
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.9", type: DaffCheckboxSetComponent, isStandalone: true, selector: "daff-checkbox-set", inputs: { formArray: "formArray", name: "name" }, outputs: { valueList: "valueList" }, host: { properties: { "attr.role": "this.role" } }, queries: [{ propertyName: "checkboxes", predicate: DaffCheckboxComponent }], ngImport: i0, template: "<ng-content></ng-content>", changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
162
- }
163
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCheckboxSetComponent, decorators: [{
164
- type: Component,
165
- args: [{ selector: 'daff-checkbox-set', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-content></ng-content>" }]
166
- }], propDecorators: { formArray: [{
167
- type: Input
168
- }], name: [{
169
- type: Input
170
- }], role: [{
171
- type: HostBinding,
172
- args: ['attr.role']
173
- }], checkboxes: [{
174
- type: ContentChildren,
175
- args: [DaffCheckboxComponent]
176
- }], valueList: [{
177
- type: Output
178
- }] } });
179
-
180
- /**
181
- * A directive for binding the DaffCheckboxComponent and the Control Value Accessor.
182
- */
183
- class DaffCheckboxControlValueAccessorDirective {
184
- constructor(_control, _checkbox) {
185
- this._control = _control;
186
- this._checkbox = _checkbox;
187
- if (this._control != null) {
188
- this._control.valueAccessor = this;
189
- }
190
- }
191
- /**
192
- * A lifecycle method called when the directive is initialized.
193
- */
194
- /**
195
- * @docs-private
196
- */
197
- ngOnInit() {
198
- // See the note about `writeValue` usage.
199
- this.writeValue(this._control.value);
200
- // Watch for user events on the component to update the state
201
- this._checkbox.becameChecked.subscribe(() => {
202
- this._onChange(true);
203
- });
204
- this._checkbox.becameUnchecked.subscribe(() => {
205
- this._onChange(false);
206
- });
207
- }
208
- /**
209
- * writes a new value down into the component.
210
- */
211
- writeValue(value) {
212
- value = !!value;
213
- if (value === true) {
214
- this.fireSelect();
215
- }
216
- else {
217
- this.fireDeselect();
218
- }
219
- }
220
- /**
221
- * Registers the change handler
222
- */
223
- registerOnChange(fn) {
224
- this._onChange = (val) => {
225
- fn(val);
226
- };
227
- }
228
- /**
229
- * Registers the touched handler
230
- */
231
- registerOnTouched(fn) {
232
- this._onTouched = fn;
233
- }
234
- /**
235
- * Sets the disabled state.
236
- */
237
- setDisabledState(isDisabled) {
238
- this._checkbox.disabled = isDisabled;
239
- }
240
- /**
241
- * calls the child checkbox's select function
242
- */
243
- fireSelect() {
244
- this._checkbox.select();
245
- }
246
- /**
247
- * calls the child checkbox's deselect function
248
- */
249
- fireDeselect() {
250
- this._checkbox.deselect();
251
- }
252
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCheckboxControlValueAccessorDirective, deps: [{ token: i1.NgControl, optional: true, self: true }, { token: DaffCheckboxComponent }], target: i0.ɵɵFactoryTarget.Directive }); }
253
- /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: DaffCheckboxControlValueAccessorDirective, isStandalone: true, selector: "daff-checkbox[ngModel], daff-checkbox[formControl], daff-checkbox[formControlName]", inputs: { value: "value", name: "name" }, ngImport: i0 }); }
254
- }
255
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCheckboxControlValueAccessorDirective, decorators: [{
256
- type: Directive,
257
- args: [{
258
- // eslint-disable-next-line @angular-eslint/directive-selector
259
- selector: 'daff-checkbox[ngModel], daff-checkbox[formControl], daff-checkbox[formControlName]',
260
- }]
261
- }], ctorParameters: () => [{ type: i1.NgControl, decorators: [{
262
- type: Optional
263
- }, {
264
- type: Self
265
- }] }, { type: DaffCheckboxComponent }], propDecorators: { value: [{
266
- type: Input
267
- }], name: [{
268
- type: Input
269
- }] } });
270
-
271
- class DaffCheckboxModule {
272
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCheckboxModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
273
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.9", ngImport: i0, type: DaffCheckboxModule, imports: [CommonModule,
274
- DaffCheckboxComponent,
275
- DaffCheckboxSetComponent,
276
- DaffCheckboxControlValueAccessorDirective], exports: [DaffCheckboxComponent,
277
- DaffCheckboxSetComponent,
278
- DaffCheckboxControlValueAccessorDirective] }); }
279
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCheckboxModule, providers: [
280
- DaffCheckboxSetComponent,
281
- ], imports: [CommonModule] }); }
282
- }
283
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCheckboxModule, decorators: [{
284
- type: NgModule,
285
- args: [{
286
- exports: [
287
- DaffCheckboxComponent,
288
- DaffCheckboxSetComponent,
289
- DaffCheckboxControlValueAccessorDirective,
290
- ],
291
- imports: [
292
- CommonModule,
293
- DaffCheckboxComponent,
294
- DaffCheckboxSetComponent,
295
- DaffCheckboxControlValueAccessorDirective,
296
- ],
297
- providers: [
298
- DaffCheckboxSetComponent,
299
- ],
300
- }]
301
- }] });
302
-
303
- /**
304
- * @docs-private
305
- */
6
+ var DaffCheckboxComponent = class DaffCheckboxComponent {
7
+ get checked() {
8
+ return this._checked;
9
+ }
10
+ set checked(value) {
11
+ if (this._checked === value) return;
12
+ if (value === true) {
13
+ this.nativeCheckbox.nativeElement.checked = true;
14
+ this.becameChecked.emit(this._checked);
15
+ } else {
16
+ this.nativeCheckbox.nativeElement.checked = false;
17
+ this.becameUnchecked.emit();
18
+ }
19
+ this._checked = value;
20
+ }
21
+ _onChange(val) {
22
+ if (val.target.checked) this.select();
23
+ else this.deselect();
24
+ }
25
+ get focusClass() {
26
+ return this.focused === true;
27
+ }
28
+ get disabledClass() {
29
+ return this.disabled === true;
30
+ }
31
+ onBlur() {
32
+ this.focused = false;
33
+ }
34
+ onFocus() {
35
+ this.focused = true;
36
+ }
37
+ constructor(_cdRef) {
38
+ this._cdRef = _cdRef;
39
+ this._checked = false;
40
+ this.id = "daff-checkbox-" + checkboxIdNum;
41
+ this.label = "";
42
+ this.becameChecked = new EventEmitter();
43
+ this.becameUnchecked = new EventEmitter();
44
+ this.role = "checkbox";
45
+ checkboxIdNum++;
46
+ }
47
+ select() {
48
+ this.checked = true;
49
+ this._cdRef.markForCheck();
50
+ }
51
+ deselect() {
52
+ this.checked = false;
53
+ this._cdRef.markForCheck();
54
+ }
55
+ static {
56
+ this.ɵfac = i0.ɵɵngDeclareFactory({
57
+ minVersion: "12.0.0",
58
+ version: "22.2.4",
59
+ ngImport: i0,
60
+ type: DaffCheckboxComponent,
61
+ deps: [{ token: i0.ChangeDetectorRef }],
62
+ target: i0.ɵɵFactoryTarget.Component
63
+ });
64
+ }
65
+ static {
66
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
67
+ minVersion: "14.0.0",
68
+ version: "22.2.4",
69
+ type: DaffCheckboxComponent,
70
+ isStandalone: true,
71
+ selector: "daff-checkbox",
72
+ inputs: {
73
+ name: "name",
74
+ value: "value",
75
+ checked: "checked",
76
+ id: "id",
77
+ label: ["aria-label", "label"],
78
+ labeledBy: ["aria-labelledby", "labeledBy"]
79
+ },
80
+ outputs: {
81
+ becameChecked: "becameChecked",
82
+ becameUnchecked: "becameUnchecked"
83
+ },
84
+ host: { properties: {
85
+ "attr.role": "this.role",
86
+ "class.focused": "this.focusClass",
87
+ "class.disabled": "this.disabledClass"
88
+ } },
89
+ viewQueries: [{
90
+ propertyName: "nativeCheckbox",
91
+ first: true,
92
+ predicate: ["inputElement"],
93
+ descendants: true,
94
+ read: ElementRef,
95
+ static: true
96
+ }],
97
+ ngImport: i0,
98
+ template: "<input #inputElement\ntype=\"checkbox\"\n[attr.aria-label]=\"label\"\n[attr.aria-labelledby]=\"labeledBy\"\n[attr.checked]=\"checked ? '' : null\"\n[attr.id] = \"id\"\n[attr.value]=\"value\"\n[attr.name]=\"name\"\n[attr.disabled] = \"disabled ? '' : null\" \n(change)=\"_onChange($event)\"\n(blur)=\"onBlur()\"\n(focus)=\"onFocus()\"\n/>\n<label [attr.for]=\"id\"><ng-content></ng-content></label>",
99
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
100
+ });
101
+ }
102
+ };
103
+ i0.ɵɵngDeclareClassMetadata({
104
+ minVersion: "12.0.0",
105
+ version: "22.2.4",
106
+ ngImport: i0,
107
+ type: DaffCheckboxComponent,
108
+ decorators: [{
109
+ type: Component,
110
+ args: [{
111
+ selector: "daff-checkbox",
112
+ changeDetection: ChangeDetectionStrategy.OnPush,
113
+ template: "<input #inputElement\ntype=\"checkbox\"\n[attr.aria-label]=\"label\"\n[attr.aria-labelledby]=\"labeledBy\"\n[attr.checked]=\"checked ? '' : null\"\n[attr.id] = \"id\"\n[attr.value]=\"value\"\n[attr.name]=\"name\"\n[attr.disabled] = \"disabled ? '' : null\" \n(change)=\"_onChange($event)\"\n(blur)=\"onBlur()\"\n(focus)=\"onFocus()\"\n/>\n<label [attr.for]=\"id\"><ng-content></ng-content></label>"
114
+ }]
115
+ }],
116
+ ctorParameters: () => [{ type: i0.ChangeDetectorRef }],
117
+ propDecorators: {
118
+ nativeCheckbox: [{
119
+ type: ViewChild,
120
+ args: ["inputElement", {
121
+ static: true,
122
+ read: ElementRef
123
+ }]
124
+ }],
125
+ name: [{ type: Input }],
126
+ value: [{ type: Input }],
127
+ checked: [{ type: Input }],
128
+ id: [{ type: Input }],
129
+ label: [{
130
+ type: Input,
131
+ args: ["aria-label"]
132
+ }],
133
+ labeledBy: [{
134
+ type: Input,
135
+ args: ["aria-labelledby"]
136
+ }],
137
+ becameChecked: [{ type: Output }],
138
+ becameUnchecked: [{ type: Output }],
139
+ role: [{
140
+ type: HostBinding,
141
+ args: ["attr.role"]
142
+ }],
143
+ focusClass: [{
144
+ type: HostBinding,
145
+ args: ["class.focused"]
146
+ }],
147
+ disabledClass: [{
148
+ type: HostBinding,
149
+ args: ["class.disabled"]
150
+ }]
151
+ }
152
+ });
153
+ var DaffCheckboxSetComponent = class DaffCheckboxSetComponent {
154
+ constructor() {
155
+ this.role = "group";
156
+ this.valueList = new EventEmitter();
157
+ }
158
+ getValues() {
159
+ const checkboxes = this.checkboxes.toArray();
160
+ return this.formArray.value.map((element, index) => element === true ? checkboxes[index].value : false).filter((element) => element !== false);
161
+ }
162
+ static {
163
+ this.ɵfac = i0.ɵɵngDeclareFactory({
164
+ minVersion: "12.0.0",
165
+ version: "22.2.4",
166
+ ngImport: i0,
167
+ type: DaffCheckboxSetComponent,
168
+ deps: [],
169
+ target: i0.ɵɵFactoryTarget.Component
170
+ });
171
+ }
172
+ static {
173
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
174
+ minVersion: "14.0.0",
175
+ version: "22.2.4",
176
+ type: DaffCheckboxSetComponent,
177
+ isStandalone: true,
178
+ selector: "daff-checkbox-set",
179
+ inputs: {
180
+ formArray: "formArray",
181
+ name: "name"
182
+ },
183
+ outputs: { valueList: "valueList" },
184
+ host: { properties: { "attr.role": "this.role" } },
185
+ queries: [{
186
+ propertyName: "checkboxes",
187
+ predicate: DaffCheckboxComponent
188
+ }],
189
+ ngImport: i0,
190
+ template: "<ng-content></ng-content>",
191
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
192
+ });
193
+ }
194
+ };
195
+ i0.ɵɵngDeclareClassMetadata({
196
+ minVersion: "12.0.0",
197
+ version: "22.2.4",
198
+ ngImport: i0,
199
+ type: DaffCheckboxSetComponent,
200
+ decorators: [{
201
+ type: Component,
202
+ args: [{
203
+ selector: "daff-checkbox-set",
204
+ changeDetection: ChangeDetectionStrategy.OnPush,
205
+ template: "<ng-content></ng-content>"
206
+ }]
207
+ }],
208
+ propDecorators: {
209
+ formArray: [{ type: Input }],
210
+ name: [{ type: Input }],
211
+ role: [{
212
+ type: HostBinding,
213
+ args: ["attr.role"]
214
+ }],
215
+ checkboxes: [{
216
+ type: ContentChildren,
217
+ args: [DaffCheckboxComponent]
218
+ }],
219
+ valueList: [{ type: Output }]
220
+ }
221
+ });
222
+ var DaffCheckboxControlValueAccessorDirective = class DaffCheckboxControlValueAccessorDirective {
223
+ constructor(_control, _checkbox) {
224
+ this._control = _control;
225
+ this._checkbox = _checkbox;
226
+ if (this._control != null) this._control.valueAccessor = this;
227
+ }
228
+ ngOnInit() {
229
+ this.writeValue(this._control.value);
230
+ this._checkbox.becameChecked.subscribe(() => {
231
+ this._onChange(true);
232
+ });
233
+ this._checkbox.becameUnchecked.subscribe(() => {
234
+ this._onChange(false);
235
+ });
236
+ }
237
+ writeValue(value) {
238
+ value = !!value;
239
+ if (value === true) this.fireSelect();
240
+ else this.fireDeselect();
241
+ }
242
+ registerOnChange(fn) {
243
+ this._onChange = (val) => {
244
+ fn(val);
245
+ };
246
+ }
247
+ registerOnTouched(fn) {
248
+ this._onTouched = fn;
249
+ }
250
+ setDisabledState(isDisabled) {
251
+ this._checkbox.disabled = isDisabled;
252
+ }
253
+ fireSelect() {
254
+ this._checkbox.select();
255
+ }
256
+ fireDeselect() {
257
+ this._checkbox.deselect();
258
+ }
259
+ static {
260
+ this.ɵfac = i0.ɵɵngDeclareFactory({
261
+ minVersion: "12.0.0",
262
+ version: "22.2.4",
263
+ ngImport: i0,
264
+ type: DaffCheckboxControlValueAccessorDirective,
265
+ deps: [{
266
+ token: i1.NgControl,
267
+ optional: true,
268
+ self: true
269
+ }, { token: DaffCheckboxComponent }],
270
+ target: i0.ɵɵFactoryTarget.Directive
271
+ });
272
+ }
273
+ static {
274
+ this.ɵdir = i0.ɵɵngDeclareDirective({
275
+ minVersion: "14.0.0",
276
+ version: "22.2.4",
277
+ type: DaffCheckboxControlValueAccessorDirective,
278
+ isStandalone: true,
279
+ selector: "daff-checkbox[ngModel], daff-checkbox[formControl], daff-checkbox[formControlName]",
280
+ inputs: {
281
+ value: "value",
282
+ name: "name"
283
+ },
284
+ ngImport: i0
285
+ });
286
+ }
287
+ };
288
+ i0.ɵɵngDeclareClassMetadata({
289
+ minVersion: "12.0.0",
290
+ version: "22.2.4",
291
+ ngImport: i0,
292
+ type: DaffCheckboxControlValueAccessorDirective,
293
+ decorators: [{
294
+ type: Directive,
295
+ args: [{ selector: "daff-checkbox[ngModel], daff-checkbox[formControl], daff-checkbox[formControlName]" }]
296
+ }],
297
+ ctorParameters: () => [{
298
+ type: i1.NgControl,
299
+ decorators: [{ type: Optional }, { type: Self }]
300
+ }, { type: DaffCheckboxComponent }],
301
+ propDecorators: {
302
+ value: [{ type: Input }],
303
+ name: [{ type: Input }]
304
+ }
305
+ });
306
+ var DaffCheckboxModule = class DaffCheckboxModule {
307
+ static {
308
+ this.ɵfac = i0.ɵɵngDeclareFactory({
309
+ minVersion: "12.0.0",
310
+ version: "22.2.4",
311
+ ngImport: i0,
312
+ type: DaffCheckboxModule,
313
+ deps: [],
314
+ target: i0.ɵɵFactoryTarget.NgModule
315
+ });
316
+ }
317
+ static {
318
+ this.ɵmod = i0.ɵɵngDeclareNgModule({
319
+ minVersion: "14.0.0",
320
+ version: "22.2.4",
321
+ ngImport: i0,
322
+ type: DaffCheckboxModule,
323
+ imports: [
324
+ CommonModule,
325
+ DaffCheckboxComponent,
326
+ DaffCheckboxSetComponent,
327
+ DaffCheckboxControlValueAccessorDirective
328
+ ],
329
+ exports: [
330
+ DaffCheckboxComponent,
331
+ DaffCheckboxSetComponent,
332
+ DaffCheckboxControlValueAccessorDirective
333
+ ]
334
+ });
335
+ }
336
+ static {
337
+ this.ɵinj = i0.ɵɵngDeclareInjector({
338
+ minVersion: "12.0.0",
339
+ version: "22.2.4",
340
+ ngImport: i0,
341
+ type: DaffCheckboxModule,
342
+ providers: [DaffCheckboxSetComponent],
343
+ imports: [CommonModule]
344
+ });
345
+ }
346
+ };
347
+ i0.ɵɵngDeclareClassMetadata({
348
+ minVersion: "12.0.0",
349
+ version: "22.2.4",
350
+ ngImport: i0,
351
+ type: DaffCheckboxModule,
352
+ decorators: [{
353
+ type: NgModule,
354
+ args: [{
355
+ exports: [
356
+ DaffCheckboxComponent,
357
+ DaffCheckboxSetComponent,
358
+ DaffCheckboxControlValueAccessorDirective
359
+ ],
360
+ imports: [
361
+ CommonModule,
362
+ DaffCheckboxComponent,
363
+ DaffCheckboxSetComponent,
364
+ DaffCheckboxControlValueAccessorDirective
365
+ ],
366
+ providers: [DaffCheckboxSetComponent]
367
+ }]
368
+ }]
369
+ });
306
370
  const DAFF_CHECKBOX_COMPONENTS = [
307
- DaffCheckboxComponent,
308
- DaffCheckboxSetComponent,
309
- DaffCheckboxControlValueAccessorDirective,
371
+ DaffCheckboxComponent,
372
+ DaffCheckboxSetComponent,
373
+ DaffCheckboxControlValueAccessorDirective
310
374
  ];
311
-
312
- /**
313
- * Generated bundle index. Do not edit.
314
- */
315
-
316
375
  export { DAFF_CHECKBOX_COMPONENTS, DaffCheckboxComponent, DaffCheckboxControlValueAccessorDirective, DaffCheckboxModule, DaffCheckboxSetComponent };
317
- //# sourceMappingURL=daffodil-design-checkbox.mjs.map
376
+
377
+ //# sourceMappingURL=daffodil-design-checkbox.mjs.map