@daffodil/design 0.90.0 → 0.91.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 (200) hide show
  1. package/accordion/index.d.ts +8 -5
  2. package/article/README.md +1 -1
  3. package/article/index.d.ts +20 -0
  4. package/article/src/article-theme.scss +10 -0
  5. package/button/index.d.ts +4 -4
  6. package/button/src/button/button-base.scss +3 -3
  7. package/button/src/button/raised/raised-theme.scss +2 -2
  8. package/card/README.md +0 -8
  9. package/card/index.d.ts +7 -41
  10. package/card/src/card-base-theme.scss +2 -5
  11. package/card/src/card-base.scss +2 -2
  12. package/checkbox/README.md +0 -0
  13. package/checkbox/index.d.ts +177 -0
  14. package/fesm2022/daffodil-design-accordion.mjs +23 -14
  15. package/fesm2022/daffodil-design-accordion.mjs.map +1 -1
  16. package/fesm2022/daffodil-design-article.mjs +129 -5
  17. package/fesm2022/daffodil-design-article.mjs.map +1 -1
  18. package/fesm2022/daffodil-design-button.mjs +24 -20
  19. package/fesm2022/daffodil-design-button.mjs.map +1 -1
  20. package/fesm2022/daffodil-design-card.mjs +16 -63
  21. package/fesm2022/daffodil-design-card.mjs.map +1 -1
  22. package/fesm2022/daffodil-design-checkbox.mjs +317 -0
  23. package/fesm2022/daffodil-design-checkbox.mjs.map +1 -0
  24. package/fesm2022/daffodil-design-form-field.mjs +35 -65
  25. package/fesm2022/daffodil-design-form-field.mjs.map +1 -1
  26. package/fesm2022/daffodil-design-form.mjs +62 -0
  27. package/fesm2022/daffodil-design-form.mjs.map +1 -0
  28. package/fesm2022/daffodil-design-image.mjs +12 -4
  29. package/fesm2022/daffodil-design-image.mjs.map +1 -1
  30. package/fesm2022/daffodil-design-modal.mjs +55 -56
  31. package/fesm2022/daffodil-design-modal.mjs.map +1 -1
  32. package/fesm2022/daffodil-design-notification.mjs +14 -50
  33. package/fesm2022/daffodil-design-notification.mjs.map +1 -1
  34. package/fesm2022/daffodil-design-paginator.mjs +6 -11
  35. package/fesm2022/daffodil-design-paginator.mjs.map +1 -1
  36. package/fesm2022/daffodil-design-quantity-field.mjs +3 -5
  37. package/fesm2022/daffodil-design-quantity-field.mjs.map +1 -1
  38. package/fesm2022/daffodil-design-radio.mjs +13 -42
  39. package/fesm2022/daffodil-design-radio.mjs.map +1 -1
  40. package/fesm2022/daffodil-design-sidebar.mjs +6 -36
  41. package/fesm2022/daffodil-design-sidebar.mjs.map +1 -1
  42. package/fesm2022/daffodil-design-switch.mjs +48 -105
  43. package/fesm2022/daffodil-design-switch.mjs.map +1 -1
  44. package/fesm2022/daffodil-design-tabs.mjs +22 -14
  45. package/fesm2022/daffodil-design-tabs.mjs.map +1 -1
  46. package/fesm2022/daffodil-design-toast.mjs +56 -55
  47. package/fesm2022/daffodil-design-toast.mjs.map +1 -1
  48. package/fesm2022/daffodil-design-tree.mjs +4 -13
  49. package/fesm2022/daffodil-design-tree.mjs.map +1 -1
  50. package/fesm2022/daffodil-design.mjs +250 -461
  51. package/fesm2022/daffodil-design.mjs.map +1 -1
  52. package/form/README.md +75 -0
  53. package/form/index.d.ts +27 -0
  54. package/form-field/README.md +49 -39
  55. package/form-field/index.d.ts +56 -36
  56. package/image/README.md +27 -19
  57. package/image/index.d.ts +6 -1
  58. package/index.d.ts +180 -259
  59. package/input/README.md +32 -12
  60. package/modal/README.md +106 -16
  61. package/modal/index.d.ts +50 -21
  62. package/native-select/README.md +52 -15
  63. package/notification/index.d.ts +7 -38
  64. package/package.json +1 -1
  65. package/paginator/index.d.ts +1 -7
  66. package/radio/index.d.ts +0 -16
  67. package/scss/layout/_breakpoint.scss +1 -1
  68. package/scss/theme.scss +2 -4
  69. package/scss/theming/_color-palettes.scss +21 -7
  70. package/scss/theming/_configure-theme.scss +11 -10
  71. package/scss/theming/_daff-theme.scss +5 -14
  72. package/scss/theming/_get-base-color.scss +2 -2
  73. package/scss/theming/_get-palette.scss +2 -2
  74. package/scss/theming/_get-theme-mode.scss +3 -3
  75. package/scss/theming/_index.scss +2 -1
  76. package/scss/theming/contrast/max-contrast/max-contrast.scss +3 -3
  77. package/scss/theming/contrast/text-contrast/text-contrast.scss +22 -16
  78. package/scss/theming/contrast/text-contrast/text-contrast.spec.scss +57 -0
  79. package/scss/theming/create-theme/_create-theme.scss +330 -0
  80. package/scss/theming/create-theme/_create-theme.spec.scss +122 -0
  81. package/scss/theming/create-theme/_index.scss +1 -0
  82. package/scss/theming/get-font-colors/_get-font-colors.scss +36 -0
  83. package/scss/theming/get-font-colors/_get-font-colors.spec.scss +72 -0
  84. package/scss/typography/mixins/_font-weight.scss +8 -14
  85. package/select/README.md +107 -4
  86. package/sidebar/README.md +0 -8
  87. package/sidebar/index.d.ts +3 -15
  88. package/switch/README.md +19 -27
  89. package/switch/index.d.ts +18 -48
  90. package/switch/src/switch-theme.scss +26 -18
  91. package/tabs/index.d.ts +7 -4
  92. package/tag/src/tag-theme.scss +11 -9
  93. package/textarea/README.md +35 -5
  94. package/tree/index.d.ts +0 -6
  95. package/tree/src/tree-theme.scss +0 -4
  96. package/accordion/examples/index.d.ts +0 -20
  97. package/article/examples/index.d.ts +0 -50
  98. package/breadcrumb/examples/index.d.ts +0 -10
  99. package/button/examples/index.d.ts +0 -67
  100. package/callout/examples/index.d.ts +0 -41
  101. package/card/examples/index.d.ts +0 -62
  102. package/card/src/card/raised/raised-theme.scss +0 -28
  103. package/checkbox/examples/index.d.ts +0 -32
  104. package/container/examples/index.d.ts +0 -16
  105. package/fesm2022/daffodil-design-accordion-examples.mjs +0 -50
  106. package/fesm2022/daffodil-design-accordion-examples.mjs.map +0 -1
  107. package/fesm2022/daffodil-design-article-examples.mjs +0 -134
  108. package/fesm2022/daffodil-design-article-examples.mjs.map +0 -1
  109. package/fesm2022/daffodil-design-breadcrumb-examples.mjs +0 -46
  110. package/fesm2022/daffodil-design-breadcrumb-examples.mjs.map +0 -1
  111. package/fesm2022/daffodil-design-button-examples.mjs +0 -178
  112. package/fesm2022/daffodil-design-button-examples.mjs.map +0 -1
  113. package/fesm2022/daffodil-design-callout-examples.mjs +0 -116
  114. package/fesm2022/daffodil-design-callout-examples.mjs.map +0 -1
  115. package/fesm2022/daffodil-design-card-examples.mjs +0 -168
  116. package/fesm2022/daffodil-design-card-examples.mjs.map +0 -1
  117. package/fesm2022/daffodil-design-checkbox-examples.mjs +0 -76
  118. package/fesm2022/daffodil-design-checkbox-examples.mjs.map +0 -1
  119. package/fesm2022/daffodil-design-container-examples.mjs +0 -41
  120. package/fesm2022/daffodil-design-container-examples.mjs.map +0 -1
  121. package/fesm2022/daffodil-design-form-field-examples.mjs +0 -96
  122. package/fesm2022/daffodil-design-form-field-examples.mjs.map +0 -1
  123. package/fesm2022/daffodil-design-hero-examples.mjs +0 -121
  124. package/fesm2022/daffodil-design-hero-examples.mjs.map +0 -1
  125. package/fesm2022/daffodil-design-image-examples.mjs +0 -58
  126. package/fesm2022/daffodil-design-image-examples.mjs.map +0 -1
  127. package/fesm2022/daffodil-design-input-examples.mjs +0 -108
  128. package/fesm2022/daffodil-design-input-examples.mjs.map +0 -1
  129. package/fesm2022/daffodil-design-list-examples.mjs +0 -77
  130. package/fesm2022/daffodil-design-list-examples.mjs.map +0 -1
  131. package/fesm2022/daffodil-design-loading-icon-examples.mjs +0 -44
  132. package/fesm2022/daffodil-design-loading-icon-examples.mjs.map +0 -1
  133. package/fesm2022/daffodil-design-media-gallery-examples.mjs +0 -104
  134. package/fesm2022/daffodil-design-media-gallery-examples.mjs.map +0 -1
  135. package/fesm2022/daffodil-design-menu-examples.mjs +0 -50
  136. package/fesm2022/daffodil-design-menu-examples.mjs.map +0 -1
  137. package/fesm2022/daffodil-design-modal-examples.mjs +0 -51
  138. package/fesm2022/daffodil-design-modal-examples.mjs.map +0 -1
  139. package/fesm2022/daffodil-design-native-select-examples.mjs +0 -71
  140. package/fesm2022/daffodil-design-native-select-examples.mjs.map +0 -1
  141. package/fesm2022/daffodil-design-navbar-examples.mjs +0 -88
  142. package/fesm2022/daffodil-design-navbar-examples.mjs.map +0 -1
  143. package/fesm2022/daffodil-design-notification-examples.mjs +0 -102
  144. package/fesm2022/daffodil-design-notification-examples.mjs.map +0 -1
  145. package/fesm2022/daffodil-design-paginator-examples.mjs +0 -59
  146. package/fesm2022/daffodil-design-paginator-examples.mjs.map +0 -1
  147. package/fesm2022/daffodil-design-progress-bar-examples.mjs +0 -57
  148. package/fesm2022/daffodil-design-progress-bar-examples.mjs.map +0 -1
  149. package/fesm2022/daffodil-design-quantity-field-examples.mjs +0 -85
  150. package/fesm2022/daffodil-design-quantity-field-examples.mjs.map +0 -1
  151. package/fesm2022/daffodil-design-radio-examples.mjs +0 -34
  152. package/fesm2022/daffodil-design-radio-examples.mjs.map +0 -1
  153. package/fesm2022/daffodil-design-select-examples.mjs +0 -117
  154. package/fesm2022/daffodil-design-select-examples.mjs.map +0 -1
  155. package/fesm2022/daffodil-design-sidebar-examples.mjs +0 -109
  156. package/fesm2022/daffodil-design-sidebar-examples.mjs.map +0 -1
  157. package/fesm2022/daffodil-design-sticky-examples.mjs +0 -25
  158. package/fesm2022/daffodil-design-sticky-examples.mjs.map +0 -1
  159. package/fesm2022/daffodil-design-switch-examples.mjs +0 -110
  160. package/fesm2022/daffodil-design-switch-examples.mjs.map +0 -1
  161. package/fesm2022/daffodil-design-tabs-examples.mjs +0 -115
  162. package/fesm2022/daffodil-design-tabs-examples.mjs.map +0 -1
  163. package/fesm2022/daffodil-design-tag-examples.mjs +0 -125
  164. package/fesm2022/daffodil-design-tag-examples.mjs.map +0 -1
  165. package/fesm2022/daffodil-design-text-snippet-examples.mjs +0 -25
  166. package/fesm2022/daffodil-design-text-snippet-examples.mjs.map +0 -1
  167. package/fesm2022/daffodil-design-textarea-examples.mjs +0 -66
  168. package/fesm2022/daffodil-design-textarea-examples.mjs.map +0 -1
  169. package/fesm2022/daffodil-design-toast-examples.mjs +0 -147
  170. package/fesm2022/daffodil-design-toast-examples.mjs.map +0 -1
  171. package/fesm2022/daffodil-design-tree-examples.mjs +0 -104
  172. package/fesm2022/daffodil-design-tree-examples.mjs.map +0 -1
  173. package/form-field/examples/index.d.ts +0 -18
  174. package/hero/examples/index.d.ts +0 -45
  175. package/image/examples/index.d.ts +0 -10
  176. package/input/examples/index.d.ts +0 -10
  177. package/list/examples/index.d.ts +0 -29
  178. package/loading-icon/examples/index.d.ts +0 -16
  179. package/media-gallery/examples/index.d.ts +0 -38
  180. package/menu/examples/index.d.ts +0 -20
  181. package/modal/examples/index.d.ts +0 -15
  182. package/native-select/examples/index.d.ts +0 -10
  183. package/navbar/examples/index.d.ts +0 -31
  184. package/notification/examples/index.d.ts +0 -12
  185. package/paginator/examples/index.d.ts +0 -26
  186. package/progress-bar/examples/index.d.ts +0 -10
  187. package/quantity-field/examples/index.d.ts +0 -30
  188. package/radio/examples/index.d.ts +0 -13
  189. package/select/examples/index.d.ts +0 -28
  190. package/sidebar/examples/index.d.ts +0 -10
  191. package/sticky/examples/index.d.ts +0 -10
  192. package/switch/examples/index.d.ts +0 -46
  193. package/tabs/examples/index.d.ts +0 -12
  194. package/tag/examples/index.d.ts +0 -50
  195. package/text-snippet/examples/index.d.ts +0 -10
  196. package/textarea/examples/index.d.ts +0 -10
  197. package/toast/examples/index.d.ts +0 -56
  198. package/tree/examples/index.d.ts +0 -18
  199. /package/{form-field → form}/src/error-message/error-message-theme.scss +0 -0
  200. /package/{form-field → form}/src/hint/hint-theme.scss +0 -0
@@ -0,0 +1,317 @@
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
+
6
+ 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: "20.3.1", ngImport: i0, type: DaffCheckboxComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
109
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.1", 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: "20.3.1", 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: "20.3.1", ngImport: i0, type: DaffCheckboxSetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
161
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.1", 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: "20.3.1", 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: "20.3.1", 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: "20.3.1", 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: "20.3.1", 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: "20.3.1", ngImport: i0, type: DaffCheckboxModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
273
+ /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.1", 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: "20.3.1", ngImport: i0, type: DaffCheckboxModule, providers: [
280
+ DaffCheckboxSetComponent,
281
+ ], imports: [CommonModule] }); }
282
+ }
283
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", 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
+ */
306
+ const DAFF_CHECKBOX_COMPONENTS = [
307
+ DaffCheckboxComponent,
308
+ DaffCheckboxSetComponent,
309
+ DaffCheckboxControlValueAccessorDirective,
310
+ ];
311
+
312
+ /**
313
+ * Generated bundle index. Do not edit.
314
+ */
315
+
316
+ export { DAFF_CHECKBOX_COMPONENTS, DaffCheckboxComponent, DaffCheckboxControlValueAccessorDirective, DaffCheckboxModule, DaffCheckboxSetComponent };
317
+ //# sourceMappingURL=daffodil-design-checkbox.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daffodil-design-checkbox.mjs","sources":["../../../libs/design/checkbox/src/checkbox/checkbox.component.ts","../../../libs/design/checkbox/src/checkbox/checkbox.component.html","../../../libs/design/checkbox/src/checkbox-set/checkbox-set.component.ts","../../../libs/design/checkbox/src/checkbox-set/checkbox-set.component.html","../../../libs/design/checkbox/src/cva/checkbox-cva.directive.ts","../../../libs/design/checkbox/src/checkbox.module.ts","../../../libs/design/checkbox/src/checkbox.ts","../../../libs/design/checkbox/src/daffodil-design-checkbox.ts"],"sourcesContent":["import {\n Component,\n Input,\n HostBinding,\n ChangeDetectionStrategy,\n EventEmitter,\n Output,\n ChangeDetectorRef,\n ViewChild,\n ElementRef,\n} from '@angular/core';\n\nlet checkboxIdNum = 0;\n\n@Component({\n selector: 'daff-checkbox',\n templateUrl: './checkbox.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class DaffCheckboxComponent {\n /**\n * @docs-private\n */\n @ViewChild('inputElement', { static: true, read: ElementRef }) nativeCheckbox: ElementRef<HTMLInputElement>;\n /**\n * The name of the checkbox.\n */\n @Input() name: string;\n /**\n * The value of the checkbox.\n */\n @Input() value: any;\n /**\n * Boolean value to determine whether or not the checkbox is checked.\n */\n private _checked = false;\n\n @Input()\n get checked() {\n return this._checked;\n }\n set checked(value: boolean) {\n if (this._checked === value) {\n return;\n }\n if (value === true) {\n this.nativeCheckbox.nativeElement.checked = true;\n this.becameChecked.emit(this._checked);\n } else {\n this.nativeCheckbox.nativeElement.checked = false;\n this.becameUnchecked.emit();\n }\n\n this._checked = value;\n }\n /**\n * The id of the checkbox. Must be unique. If not entered by a user then it is generated.\n */\n @Input() id: string = 'daff-checkbox-' + checkboxIdNum;\n\n /**\n * The aria-label of the checkbox.\n */\n // eslint-disable-next-line @angular-eslint/no-input-rename\n @Input('aria-label') label = '';\n\n /**\n * The aria-labeledby of the checkbox.\n */\n // eslint-disable-next-line @angular-eslint/no-input-rename\n @Input('aria-labelledby') labeledBy: string;\n\n /**\n * Event on whether or not the selection has changed.\n */\n @Output() becameChecked: EventEmitter<boolean> = new EventEmitter();\n @Output() becameUnchecked: EventEmitter<void> = new EventEmitter();\n\n /**\n * Whether the checkbox is focused\n */\n focused: boolean;\n /**\n * Whether the checkbox is disabled.\n */\n disabled: boolean;\n\n /**\n * The role of the component. Set to \"checkbox\".\n *\n * @docs-private\n */\n @HostBinding('attr.role') role = 'checkbox';\n\n\n /**\n * @docs-private\n */\n _onChange(val: Event) {\n if ((<HTMLInputElement>val.target).checked) {\n this.select();\n } else {\n this.deselect();\n }\n };\n /**\n * @docs-private\n */\n @HostBinding('class.focused') get focusClass() {\n return this.focused === true;\n };\n /**\n * @docs-private\n */\n @HostBinding('class.disabled') get disabledClass() {\n return this.disabled === true;\n };\n /**\n * Sets focused to false.\n */\n onBlur() {\n this.focused = false;\n }\n /**\n * Sets focused to true.\n */\n onFocus() {\n this.focused = true;\n }\n\n constructor(private _cdRef: ChangeDetectorRef) {\n /**\n * Increments id number on new checkbox. Gurantees unique ID on generation.\n */\n checkboxIdNum++;\n }\n /**\n * Sets checked to true.\n */\n select() {\n this.checked = true;\n this._cdRef.markForCheck();\n }\n /**\n * Sets checked to false\n */\n deselect() {\n this.checked = false;\n this._cdRef.markForCheck();\n }\n}\n","<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>","import {\n Component,\n Input,\n HostBinding,\n ChangeDetectionStrategy,\n ContentChildren,\n QueryList,\n Output,\n EventEmitter,\n} from '@angular/core';\nimport { UntypedFormArray } from '@angular/forms';\n\nimport { DaffCheckboxComponent } from '../checkbox/checkbox.component';\n\n@Component({\n selector: 'daff-checkbox-set',\n templateUrl: './checkbox-set.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class DaffCheckboxSetComponent {\n\n @Input() formArray: UntypedFormArray;\n /**\n * The name of the checkbox-set\n */\n @Input() name: string;\n\n /**\n * The role of the component. Set to \"checkbox\".\n *\n * @docs-private\n */\n @HostBinding('attr.role') role = 'group';\n\n /**\n * The list of checkboxes in the set.\n *\n * @docs-private\n */\n @ContentChildren(DaffCheckboxComponent) checkboxes: QueryList<DaffCheckboxComponent>;\n\n @Output() valueList = new EventEmitter<any[]>();\n\n getValues(): any[] {\n const checkboxes = this.checkboxes.toArray();\n return this.formArray.value.map((element, index) => element === true ? checkboxes[index].value : false).filter(element => element !== false);\n }\n}\n","<ng-content></ng-content>","import {\n Directive,\n Input,\n OnInit,\n Self,\n Optional,\n} from '@angular/core';\nimport {\n NgControl,\n ControlValueAccessor,\n} from '@angular/forms';\n\nimport { DaffCheckboxComponent } from '../checkbox/checkbox.component';\n\n/**\n * A directive for binding the DaffCheckboxComponent and the Control Value Accessor.\n */\n@Directive({\n // eslint-disable-next-line @angular-eslint/directive-selector\n selector: 'daff-checkbox[ngModel], daff-checkbox[formControl], daff-checkbox[formControlName]',\n})\nexport class DaffCheckboxControlValueAccessorDirective implements OnInit, ControlValueAccessor {\n _onChange: (val: any) => void;\n _onTouched: () => void;\n\n /**\n * The value of the ControlValueAccessor\n */\n @Input() value: any;\n\n /**\n * The name of the ControlValueAccessor\n */\n @Input() name: string;\n\n constructor(\n @Optional() @Self() public _control: NgControl,\n private _checkbox: DaffCheckboxComponent,\n ) {\n if (this._control != null) {\n this._control.valueAccessor = this;\n }\n }\n\n\n /**\n * A lifecycle method called when the directive is initialized.\n */\n /**\n * @docs-private\n */\n ngOnInit(): void {\n // See the note about `writeValue` usage.\n this.writeValue(this._control.value);\n\n // Watch for user events on the component to update the state\n this._checkbox.becameChecked.subscribe(\n () => {\n this._onChange(true);\n },\n );\n this._checkbox.becameUnchecked.subscribe(\n () => {\n this._onChange(false);\n },\n );\n }\n\n /**\n * writes a new value down into the component.\n */\n writeValue(value: any): void {\n value = !!value;\n if (value === true) {\n this.fireSelect();\n } else {\n this.fireDeselect();\n }\n }\n\n /**\n * Registers the change handler\n */\n registerOnChange(fn: any): void {\n this._onChange = (val) => {\n fn(val);\n };\n }\n\n /**\n * Registers the touched handler\n */\n registerOnTouched(fn: any): void {\n this._onTouched = fn;\n }\n\n /**\n * Sets the disabled state.\n */\n setDisabledState?(isDisabled: boolean): void {\n this._checkbox.disabled = isDisabled;\n }\n\n /**\n * calls the child checkbox's select function\n */\n fireSelect() {\n this._checkbox.select();\n }\n\n /**\n * calls the child checkbox's deselect function\n */\n fireDeselect() {\n this._checkbox.deselect();\n }\n\n}\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\n\nimport { DaffCheckboxComponent } from './checkbox/checkbox.component';\nimport { DaffCheckboxSetComponent } from './checkbox-set/checkbox-set.component';\nimport { DaffCheckboxControlValueAccessorDirective } from './cva/checkbox-cva.directive';\n\n@NgModule({\n exports: [\n DaffCheckboxComponent,\n DaffCheckboxSetComponent,\n DaffCheckboxControlValueAccessorDirective,\n ],\n imports: [\n CommonModule,\n DaffCheckboxComponent,\n DaffCheckboxSetComponent,\n DaffCheckboxControlValueAccessorDirective,\n ],\n providers: [\n DaffCheckboxSetComponent,\n ],\n})\nexport class DaffCheckboxModule { }\n","import { DaffCheckboxComponent } from './checkbox/checkbox.component';\nimport { DaffCheckboxSetComponent } from './checkbox-set/checkbox-set.component';\nimport { DaffCheckboxControlValueAccessorDirective } from './cva/checkbox-cva.directive';\n\n/**\n * @docs-private\n */\nexport const DAFF_CHECKBOX_COMPONENTS = <const> [\n DaffCheckboxComponent,\n DaffCheckboxSetComponent,\n DaffCheckboxControlValueAccessorDirective,\n];\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i2.DaffCheckboxComponent"],"mappings":";;;;;AAYA,IAAI,aAAa,GAAG,CAAC;MAOR,qBAAqB,CAAA;AAkBhC,IAAA,IACI,OAAO,GAAA;QACT,OAAO,IAAI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QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,EAAA,SAAA,EAJlB;YACT,wBAAwB;AACzB,SAAA,EAAA,OAAA,EAAA,CAPC,YAAY,CAAA,EAAA,CAAA,CAAA;;2FASH,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAhB9B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE;wBACP,qBAAqB;wBACrB,wBAAwB;wBACxB,yCAAyC;AAC1C,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,YAAY;wBACZ,qBAAqB;wBACrB,wBAAwB;wBACxB,yCAAyC;AAC1C,qBAAA;AACD,oBAAA,SAAS,EAAE;wBACT,wBAAwB;AACzB,qBAAA;AACF,iBAAA;;;AClBD;;AAEG;AACI,MAAM,wBAAwB,GAAW;IAC9C,qBAAqB;IACrB,wBAAwB;IACxB,yCAAyC;;;ACV3C;;AAEG;;;;"}
@@ -1,22 +1,11 @@
1
1
  import * as i0 from '@angular/core';
2
- import { ChangeDetectionStrategy, Component, HostBinding, Directive, Input, isDevMode, ContentChild, ViewEncapsulation, NgModule } from '@angular/core';
2
+ import { HostBinding, Directive, isDevMode, Input, ContentChild, ChangeDetectionStrategy, ViewEncapsulation, Component, NgModule } from '@angular/core';
3
3
  import * as i1 from '@daffodil/design';
4
4
  import { DaffPrefixDirective, DaffSuffixDirective, DaffFormLabelDirective, DaffSkeletonableDirective, DaffFormLabelModule } from '@daffodil/design';
5
+ import { DaffFormFieldLabelDirective, DaffHintComponent, DaffErrorMessageComponent } from '@daffodil/design/form';
5
6
  import { NgTemplateOutlet } from '@angular/common';
6
7
  import { BehaviorSubject } from 'rxjs';
7
8
 
8
- class DaffErrorMessageComponent {
9
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DaffErrorMessageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
10
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.1", type: DaffErrorMessageComponent, isStandalone: true, selector: "daff-error-message", host: { attributes: { "aria-live": "polite" }, classAttribute: "daff-error-message" }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: [":host{display:block;font-size:.875rem;line-height:1rem}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
11
- }
12
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DaffErrorMessageComponent, decorators: [{
13
- type: Component,
14
- args: [{ selector: 'daff-error-message', template: '<ng-content></ng-content>', host: {
15
- class: 'daff-error-message',
16
- 'aria-live': 'polite',
17
- }, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:block;font-size:.875rem;line-height:1rem}\n"] }]
18
- }] });
19
-
20
9
  class DaffFormFieldActionDirective {
21
10
  constructor() {
22
11
  /**
@@ -38,23 +27,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImpor
38
27
  }] } });
39
28
 
40
29
  /**
30
+ * An abstract class that form controls must implement to be used with the DaffFormFieldComponent.
41
31
  *
42
- * The class that a form control must **implement** in order to be
43
- * used with the DaffFormFieldComponent.
32
+ * > **Note**
33
+ * > This is an abstract class instead of an interface to support Angular's dependency injection. Interfaces are erased during TypeScript compilation and cannot be used as DI tokens.
44
34
  *
45
- * You may ask: "Why are you implementing an abstract class, not extending it?"
46
- * We do this so that the Angular DI container can match the class token. A typical
47
- * interface would be "more accurate" here, but since interfaces don't exist
48
- * in javascript, they get thrown out by the typescript compiler and cannot
49
- * be used for the necessary dependency injection.
35
+ * > By using an abstract class, the Angular DI container can match the class token for injection.
50
36
  */
51
37
  class DaffFormFieldControl {
38
+ /**
39
+ * Whether the label should be in the raised position.
40
+ * By default, matches the focused state.
41
+ */
52
42
  get raised() {
53
43
  return this.focused;
54
44
  }
55
45
  ;
56
46
  constructor(ngControl) {
57
47
  this.ngControl = ngControl;
48
+ /**
49
+ * Whether the control supports automatic label behavior.
50
+ * When `true`, the form field will associate the label with the control using `for` and `id` attributes.
51
+ *
52
+ * Defaults to `true`.
53
+ */
58
54
  this.supportsAutoLabelling = true;
59
55
  this._stateChanges = new BehaviorSubject({
60
56
  focused: false,
@@ -64,6 +60,10 @@ class DaffFormFieldControl {
64
60
  valid: true,
65
61
  });
66
62
  }
63
+ /**
64
+ * Computes the current state of the form field control.
65
+ * Combines control properties and form validation state.
66
+ */
67
67
  get state() {
68
68
  return {
69
69
  focused: this.focused,
@@ -73,6 +73,9 @@ class DaffFormFieldControl {
73
73
  valid: !this.ngControl?.errors && this.ngControl?.dirty,
74
74
  };
75
75
  }
76
+ /**
77
+ * Emits the current state.
78
+ */
76
79
  emitState(deferred = false) {
77
80
  if (deferred) {
78
81
  Promise.resolve().then(() => {
@@ -85,45 +88,6 @@ class DaffFormFieldControl {
85
88
  }
86
89
  ;
87
90
 
88
- class DaffHintComponent {
89
- constructor() {
90
- /**
91
- * @docs-private
92
- */
93
- this.class = true;
94
- /**
95
- * Displays a validated hint UI.
96
- * */
97
- this.validated = false;
98
- }
99
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DaffHintComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
100
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.1", type: DaffHintComponent, isStandalone: true, selector: "daff-hint", inputs: { validated: "validated" }, host: { properties: { "class.daff-hint": "this.class", "class.validated": "this.validated" } }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: [":host{display:flex;gap:.25rem;font-size:.875rem;line-height:1rem}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
101
- }
102
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DaffHintComponent, decorators: [{
103
- type: Component,
104
- args: [{ selector: 'daff-hint', template: '<ng-content></ng-content>', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, styles: [":host{display:flex;gap:.25rem;font-size:.875rem;line-height:1rem}\n"] }]
105
- }], propDecorators: { class: [{
106
- type: HostBinding,
107
- args: ['class.daff-hint']
108
- }], validated: [{
109
- type: Input
110
- }, {
111
- type: HostBinding,
112
- args: ['class.validated']
113
- }] } });
114
-
115
- class DaffFormFieldLabelDirective {
116
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DaffFormFieldLabelDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
117
- /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.1", type: DaffFormFieldLabelDirective, isStandalone: true, selector: "daff-form-label", ngImport: i0 }); }
118
- }
119
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DaffFormFieldLabelDirective, decorators: [{
120
- type: Directive,
121
- args: [{
122
- // eslint-disable-next-line @angular-eslint/directive-selector
123
- selector: 'daff-form-label',
124
- }]
125
- }] });
126
-
127
91
  let daffFormFieldId = 0;
128
92
  var DaffFormFieldApperanaceEnum;
129
93
  (function (DaffFormFieldApperanaceEnum) {
@@ -199,7 +163,7 @@ class DaffFormFieldComponent {
199
163
  return this._control?.raised || this.isFilled;
200
164
  }
201
165
  /**
202
- * The appearance style of a form field, whether the label is fluid or fixed.
166
+ * The appearance style of a form field, whether the label is `fluid` or `fixed`.
203
167
  */
204
168
  get appearance() {
205
169
  return this._appearance;
@@ -360,11 +324,15 @@ class DaffFormFieldModule {
360
324
  /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.1", ngImport: i0, type: DaffFormFieldModule, imports: [DaffFormFieldComponent,
361
325
  DaffErrorMessageComponent,
362
326
  DaffHintComponent,
327
+ DaffFormFieldLabelDirective,
363
328
  DaffFormLabelModule], exports: [DaffFormFieldComponent,
364
329
  DaffErrorMessageComponent,
365
330
  DaffHintComponent,
331
+ DaffFormFieldLabelDirective,
366
332
  DaffFormLabelModule] }); }
367
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DaffFormFieldModule, imports: [DaffFormLabelModule, DaffFormLabelModule] }); }
333
+ /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DaffFormFieldModule, imports: [DaffErrorMessageComponent,
334
+ DaffHintComponent,
335
+ DaffFormLabelModule, DaffFormLabelModule] }); }
368
336
  }
369
337
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: DaffFormFieldModule, decorators: [{
370
338
  type: NgModule,
@@ -373,12 +341,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImpor
373
341
  DaffFormFieldComponent,
374
342
  DaffErrorMessageComponent,
375
343
  DaffHintComponent,
344
+ DaffFormFieldLabelDirective,
376
345
  DaffFormLabelModule,
377
346
  ],
378
347
  exports: [
379
348
  DaffFormFieldComponent,
380
349
  DaffErrorMessageComponent,
381
350
  DaffHintComponent,
351
+ DaffFormFieldLabelDirective,
382
352
  DaffFormLabelModule,
383
353
  ],
384
354
  }]
@@ -389,18 +359,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImpor
389
359
  */
390
360
  const DAFF_FORM_FIELD_COMPONENTS = [
391
361
  DaffFormFieldComponent,
392
- DaffErrorMessageComponent,
393
362
  DaffFormLabelDirective,
394
- DaffHintComponent,
395
363
  DaffPrefixDirective,
396
364
  DaffSuffixDirective,
397
- DaffFormFieldLabelDirective,
398
365
  DaffFormFieldActionDirective,
366
+ DaffHintComponent,
367
+ DaffFormFieldLabelDirective,
368
+ DaffErrorMessageComponent,
399
369
  ];
400
370
 
401
371
  /**
402
372
  * Generated bundle index. Do not edit.
403
373
  */
404
374
 
405
- export { DAFF_FORM_FIELD_COMPONENTS, DaffErrorMessageComponent, DaffFormFieldActionDirective, DaffFormFieldComponent, DaffFormFieldControl, DaffFormFieldLabelDirective, DaffFormFieldModule, DaffHintComponent };
375
+ export { DAFF_FORM_FIELD_COMPONENTS, DaffFormFieldActionDirective, DaffFormFieldComponent, DaffFormFieldControl, DaffFormFieldModule };
406
376
  //# sourceMappingURL=daffodil-design-form-field.mjs.map