@daffodil/design 0.94.1 → 0.95.1

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,304 +1,386 @@
1
- import { CommonModule } from '@angular/common';
2
- import * as i0 from '@angular/core';
3
- import { Input, ChangeDetectionStrategy, Component, EventEmitter, Output, Optional, Injectable, Self, Directive, NgModule } from '@angular/core';
4
- import * as i1 from '@angular/forms';
5
-
6
- class DaffRadioSetComponent {
7
- constructor() { }
8
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffRadioSetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.9", type: DaffRadioSetComponent, isStandalone: true, selector: "daff-radio-set", inputs: { name: "name" }, host: { attributes: { "role": "radiogroup" } }, ngImport: i0, template: "<ng-content></ng-content>", changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
10
- }
11
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffRadioSetComponent, decorators: [{
12
- type: Component,
13
- args: [{ selector: 'daff-radio-set', changeDetection: ChangeDetectionStrategy.OnPush, host: {
14
- role: 'radiogroup',
15
- }, template: "<ng-content></ng-content>" }]
16
- }], ctorParameters: () => [], propDecorators: { name: [{
17
- type: Input
18
- }] } });
19
-
1
+ import { CommonModule } from "@angular/common";
2
+ import * as i0 from "@angular/core";
3
+ import { ChangeDetectionStrategy, Component, Directive, EventEmitter, Injectable, Input, NgModule, Optional, Output, Self } from "@angular/core";
4
+ import * as i1 from "@angular/forms";
5
+ var DaffRadioSetComponent = class DaffRadioSetComponent {
6
+ constructor() {}
7
+ static {
8
+ this.ɵfac = i0.ɵɵngDeclareFactory({
9
+ minVersion: "12.0.0",
10
+ version: "22.2.4",
11
+ ngImport: i0,
12
+ type: DaffRadioSetComponent,
13
+ deps: [],
14
+ target: i0.ɵɵFactoryTarget.Component
15
+ });
16
+ }
17
+ static {
18
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
19
+ minVersion: "14.0.0",
20
+ version: "22.2.4",
21
+ type: DaffRadioSetComponent,
22
+ isStandalone: true,
23
+ selector: "daff-radio-set",
24
+ inputs: { name: "name" },
25
+ host: { attributes: { "role": "radiogroup" } },
26
+ ngImport: i0,
27
+ template: "<ng-content></ng-content>",
28
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
29
+ });
30
+ }
31
+ };
32
+ i0.ɵɵngDeclareClassMetadata({
33
+ minVersion: "12.0.0",
34
+ version: "22.2.4",
35
+ ngImport: i0,
36
+ type: DaffRadioSetComponent,
37
+ decorators: [{
38
+ type: Component,
39
+ args: [{
40
+ selector: "daff-radio-set",
41
+ changeDetection: ChangeDetectionStrategy.OnPush,
42
+ host: { role: "radiogroup" },
43
+ template: "<ng-content></ng-content>"
44
+ }]
45
+ }],
46
+ ctorParameters: () => [],
47
+ propDecorators: { name: [{ type: Input }] }
48
+ });
20
49
  let radioUniqueId = 0;
21
- class DaffRadioComponent {
22
- /**
23
- * The checked property of the radio
24
- */
25
- get checked() {
26
- return this._checked;
27
- }
28
- set checked(value) {
29
- if (this._checked !== value) {
30
- this._checked = value;
31
- this.selectionChange.emit(this.value);
32
- }
33
- }
34
- constructor(radioset) {
35
- this.radioset = radioset;
36
- /**
37
- * @docs-private
38
- */
39
- this._checked = false;
40
- /**
41
- * Output event of selection being changed
42
- */
43
- this.selectionChange = new EventEmitter();
44
- /**
45
- * The id of the radio. It is uniquely generated but can be overwritten by the user. Must be unique.
46
- */
47
- this.id = 'daff-radio-' + radioUniqueId;
48
- /**
49
- * Name of the Radio
50
- */
51
- this.name = '';
52
- /**
53
- * Used for aria-label. Default to name if user does not input a label.
54
- */
55
- // eslint-disable-next-line @angular-eslint/no-input-rename
56
- this.label = this.name;
57
- this.disabled = false;
58
- this.focused = false;
59
- radioUniqueId++;
60
- }
61
- /**
62
- * @docs-private
63
- */
64
- ngOnInit() {
65
- this.name = this.radioset ? this.radioset.name : this.name;
66
- }
67
- /**
68
- * updates Focus styling
69
- */
70
- onFocus() {
71
- this.focused = true;
72
- }
73
- /**
74
- * updates Blur styling
75
- */
76
- onBlur() {
77
- this.focused = false;
78
- }
79
- /**
80
- * toggles checked attribute on
81
- */
82
- select() {
83
- this.checked = true;
84
- }
85
- /**
86
- * toggles checked attribute off
87
- */
88
- deselect() {
89
- this.checked = false;
90
- }
91
- onChange() {
92
- this.select();
93
- }
94
- ;
95
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffRadioComponent, deps: [{ token: DaffRadioSetComponent, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
96
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.9", type: DaffRadioComponent, isStandalone: true, selector: "daff-radio", inputs: { checked: "checked", value: "value", id: "id", name: "name", label: ["aria-label", "label"], labelledby: ["aria-labelledby", "labelledby"] }, outputs: { selectionChange: "selectionChange" }, host: { attributes: { "role": "radio" }, properties: { "class.focused": "focused", "class.disabled": "disabled" } }, ngImport: i0, template: "<input type=\"radio\" \n[attr.checked]=\"checked ? '' : null\" \n[attr.id]=\"id\" \n[attr.name]=\"name\" \n[attr.aria-label]=\"label\"\n[attr.aria-labelledby]=\"labelledby\"\n[attr.value]=\"value\"\n[attr.disabled] = \"disabled ? '' : null\" \n(change)=\"onChange()\"\n(blur)=\"onBlur()\"\n(focus)=\"onFocus()\"/>\n<label [attr.for]=\"id\">\n <ng-content></ng-content>\n</label>", changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
97
- }
98
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffRadioComponent, decorators: [{
99
- type: Component,
100
- args: [{ selector: 'daff-radio', changeDetection: ChangeDetectionStrategy.OnPush, host: {
101
- role: 'radio',
102
- '[class.focused]': 'focused',
103
- '[class.disabled]': 'disabled',
104
- }, template: "<input type=\"radio\" \n[attr.checked]=\"checked ? '' : null\" \n[attr.id]=\"id\" \n[attr.name]=\"name\" \n[attr.aria-label]=\"label\"\n[attr.aria-labelledby]=\"labelledby\"\n[attr.value]=\"value\"\n[attr.disabled] = \"disabled ? '' : null\" \n(change)=\"onChange()\"\n(blur)=\"onBlur()\"\n(focus)=\"onFocus()\"/>\n<label [attr.for]=\"id\">\n <ng-content></ng-content>\n</label>" }]
105
- }], ctorParameters: () => [{ type: DaffRadioSetComponent, decorators: [{
106
- type: Optional
107
- }] }], propDecorators: { selectionChange: [{
108
- type: Output
109
- }], checked: [{
110
- type: Input
111
- }], value: [{
112
- type: Input
113
- }], id: [{
114
- type: Input
115
- }], name: [{
116
- type: Input
117
- }], label: [{
118
- type: Input,
119
- args: ['aria-label']
120
- }], labelledby: [{
121
- type: Input,
122
- args: ['aria-labelledby']
123
- }] } });
124
-
125
- class DaffRadioRegistry {
126
- constructor() {
127
- this._accessors = [];
128
- }
129
- /**
130
- * @description
131
- * Adds a control to the internal registry.
132
- */
133
- add(control, accessor) {
134
- this._accessors.push({
135
- control,
136
- accessor,
137
- });
138
- }
139
- /**
140
- * @description
141
- * Removes a control from the internal registry.
142
- */
143
- remove(accessor) {
144
- for (let i = this._accessors.length - 1; i >= 0; --i) {
145
- if (this._accessors[i].accessor === accessor) {
146
- this._accessors.splice(i, 1);
147
- return;
148
- }
149
- }
150
- }
151
- /**
152
- * @description
153
- * Selects a radio button.
154
- */
155
- select(accessor) {
156
- this._accessors.forEach((c) => {
157
- if (this._isSameGroup(c, accessor) && c.accessor !== accessor) {
158
- c.accessor.fireDeselect();
159
- }
160
- });
161
- }
162
- _isSameGroup(controlPair, accessor) {
163
- if (!controlPair.control.control) {
164
- return false;
165
- }
166
- return controlPair.control.control.parent === accessor._control.control.parent
167
- && controlPair.accessor.name === accessor.name;
168
- }
169
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffRadioRegistry, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
170
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffRadioRegistry, providedIn: 'root' }); }
171
- }
172
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffRadioRegistry, decorators: [{
173
- type: Injectable,
174
- args: [{ providedIn: 'root' }]
175
- }] });
176
-
177
- /**
178
- * ControlValueAccessor functionality for the DaffRadio
179
- */
180
- class DaffRadioControlValueAccessorDirective {
181
- constructor(_control, _registry, _radio) {
182
- this._control = _control;
183
- this._registry = _registry;
184
- this._radio = _radio;
185
- if (this._control != null) {
186
- this._control.valueAccessor = this;
187
- }
188
- }
189
- /**
190
- * @docs-private
191
- */
192
- ngOnInit() {
193
- if (this._control) {
194
- this.writeValue(this._control.value);
195
- this._registry.add(this._control, this);
196
- }
197
- this._radio.selectionChange.subscribe(value => value ? this._onChange() : null);
198
- }
199
- /**
200
- *
201
- * writeValue function from the CVA interface
202
- */
203
- writeValue(value) {
204
- // the this._onChange null check here is necessary because of an ongoing bug in angular forms
205
- // where writeValue can be called before the component initializes: https://github.com/angular/angular/issues/29218
206
- if (this.value === value && this._onChange) {
207
- this._onChange();
208
- this.fireSelect();
209
- }
210
- }
211
- /**
212
- * registerOnChange implemented from the CVA interface
213
- */
214
- registerOnChange(fn) {
215
- this._onChange = () => {
216
- fn(this.value);
217
- this._registry.select(this);
218
- };
219
- }
220
- /**
221
- * registerOnTouch implemented from the CVA interface
222
- */
223
- registerOnTouched(fn) {
224
- this._onTouched = fn;
225
- }
226
- /**
227
- * sets the disabled state.
228
- */
229
- setDisabledState(isDisabled) {
230
- this._radio.disabled = isDisabled;
231
- }
232
- /**
233
- calls select function for the radio
234
- */
235
- fireSelect() {
236
- this._radio.select();
237
- }
238
- /**
239
- calls deselect function for the radio
240
- */
241
- fireDeselect() {
242
- this._radio.deselect();
243
- }
244
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffRadioControlValueAccessorDirective, deps: [{ token: i1.NgControl, optional: true, self: true }, { token: DaffRadioRegistry }, { token: DaffRadioComponent }], target: i0.ɵɵFactoryTarget.Directive }); }
245
- /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: DaffRadioControlValueAccessorDirective, isStandalone: true, selector: "daff-radio[ngModel], daff-radio[formControl], daff-radio[formControlName]", inputs: { value: "value", name: "name" }, ngImport: i0 }); }
246
- }
247
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffRadioControlValueAccessorDirective, decorators: [{
248
- type: Directive,
249
- args: [{
250
- // eslint-disable-next-line @angular-eslint/directive-selector
251
- selector: 'daff-radio[ngModel], daff-radio[formControl], daff-radio[formControlName]',
252
- }]
253
- }], ctorParameters: () => [{ type: i1.NgControl, decorators: [{
254
- type: Optional
255
- }, {
256
- type: Self
257
- }] }, { type: DaffRadioRegistry }, { type: DaffRadioComponent }], propDecorators: { value: [{
258
- type: Input
259
- }], name: [{
260
- type: Input
261
- }] } });
262
-
263
- class DaffRadioModule {
264
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffRadioModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
265
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.9", ngImport: i0, type: DaffRadioModule, imports: [CommonModule,
266
- DaffRadioComponent,
267
- DaffRadioSetComponent,
268
- DaffRadioControlValueAccessorDirective], exports: [DaffRadioComponent,
269
- DaffRadioSetComponent,
270
- DaffRadioControlValueAccessorDirective] }); }
271
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffRadioModule, imports: [CommonModule] }); }
272
- }
273
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffRadioModule, decorators: [{
274
- type: NgModule,
275
- args: [{
276
- imports: [
277
- CommonModule,
278
- DaffRadioComponent,
279
- DaffRadioSetComponent,
280
- DaffRadioControlValueAccessorDirective,
281
- ],
282
- exports: [
283
- DaffRadioComponent,
284
- DaffRadioSetComponent,
285
- DaffRadioControlValueAccessorDirective,
286
- ],
287
- }]
288
- }] });
289
-
290
- /**
291
- * @docs-private
292
- */
50
+ var DaffRadioComponent = class DaffRadioComponent {
51
+ get checked() {
52
+ return this._checked;
53
+ }
54
+ set checked(value) {
55
+ if (this._checked !== value) {
56
+ this._checked = value;
57
+ this.selectionChange.emit(this.value);
58
+ }
59
+ }
60
+ constructor(radioset) {
61
+ this.radioset = radioset;
62
+ this._checked = false;
63
+ this.selectionChange = new EventEmitter();
64
+ this.id = "daff-radio-" + radioUniqueId;
65
+ this.name = "";
66
+ this.label = this.name;
67
+ this.disabled = false;
68
+ this.focused = false;
69
+ radioUniqueId++;
70
+ }
71
+ ngOnInit() {
72
+ this.name = this.radioset ? this.radioset.name : this.name;
73
+ }
74
+ onFocus() {
75
+ this.focused = true;
76
+ }
77
+ onBlur() {
78
+ this.focused = false;
79
+ }
80
+ select() {
81
+ this.checked = true;
82
+ }
83
+ deselect() {
84
+ this.checked = false;
85
+ }
86
+ onChange() {
87
+ this.select();
88
+ }
89
+ static {
90
+ this.ɵfac = i0.ɵɵngDeclareFactory({
91
+ minVersion: "12.0.0",
92
+ version: "22.2.4",
93
+ ngImport: i0,
94
+ type: DaffRadioComponent,
95
+ deps: [{
96
+ token: DaffRadioSetComponent,
97
+ optional: true
98
+ }],
99
+ target: i0.ɵɵFactoryTarget.Component
100
+ });
101
+ }
102
+ static {
103
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
104
+ minVersion: "14.0.0",
105
+ version: "22.2.4",
106
+ type: DaffRadioComponent,
107
+ isStandalone: true,
108
+ selector: "daff-radio",
109
+ inputs: {
110
+ checked: "checked",
111
+ value: "value",
112
+ id: "id",
113
+ name: "name",
114
+ label: ["aria-label", "label"],
115
+ labelledby: ["aria-labelledby", "labelledby"]
116
+ },
117
+ outputs: { selectionChange: "selectionChange" },
118
+ host: {
119
+ attributes: { "role": "radio" },
120
+ properties: {
121
+ "class.focused": "focused",
122
+ "class.disabled": "disabled"
123
+ }
124
+ },
125
+ ngImport: i0,
126
+ template: "<input type=\"radio\" \n[attr.checked]=\"checked ? '' : null\" \n[attr.id]=\"id\" \n[attr.name]=\"name\" \n[attr.aria-label]=\"label\"\n[attr.aria-labelledby]=\"labelledby\"\n[attr.value]=\"value\"\n[attr.disabled] = \"disabled ? '' : null\" \n(change)=\"onChange()\"\n(blur)=\"onBlur()\"\n(focus)=\"onFocus()\"/>\n<label [attr.for]=\"id\">\n <ng-content></ng-content>\n</label>",
127
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
128
+ });
129
+ }
130
+ };
131
+ i0.ɵɵngDeclareClassMetadata({
132
+ minVersion: "12.0.0",
133
+ version: "22.2.4",
134
+ ngImport: i0,
135
+ type: DaffRadioComponent,
136
+ decorators: [{
137
+ type: Component,
138
+ args: [{
139
+ selector: "daff-radio",
140
+ changeDetection: ChangeDetectionStrategy.OnPush,
141
+ host: {
142
+ role: "radio",
143
+ "[class.focused]": "focused",
144
+ "[class.disabled]": "disabled"
145
+ },
146
+ template: "<input type=\"radio\" \n[attr.checked]=\"checked ? '' : null\" \n[attr.id]=\"id\" \n[attr.name]=\"name\" \n[attr.aria-label]=\"label\"\n[attr.aria-labelledby]=\"labelledby\"\n[attr.value]=\"value\"\n[attr.disabled] = \"disabled ? '' : null\" \n(change)=\"onChange()\"\n(blur)=\"onBlur()\"\n(focus)=\"onFocus()\"/>\n<label [attr.for]=\"id\">\n <ng-content></ng-content>\n</label>"
147
+ }]
148
+ }],
149
+ ctorParameters: () => [{
150
+ type: DaffRadioSetComponent,
151
+ decorators: [{ type: Optional }]
152
+ }],
153
+ propDecorators: {
154
+ selectionChange: [{ type: Output }],
155
+ checked: [{ type: Input }],
156
+ value: [{ type: Input }],
157
+ id: [{ type: Input }],
158
+ name: [{ type: Input }],
159
+ label: [{
160
+ type: Input,
161
+ args: ["aria-label"]
162
+ }],
163
+ labelledby: [{
164
+ type: Input,
165
+ args: ["aria-labelledby"]
166
+ }]
167
+ }
168
+ });
169
+ var DaffRadioRegistry = class DaffRadioRegistry {
170
+ constructor() {
171
+ this._accessors = [];
172
+ }
173
+ add(control, accessor) {
174
+ this._accessors.push({
175
+ control,
176
+ accessor
177
+ });
178
+ }
179
+ remove(accessor) {
180
+ for (let i = this._accessors.length - 1; i >= 0; --i) if (this._accessors[i].accessor === accessor) {
181
+ this._accessors.splice(i, 1);
182
+ return;
183
+ }
184
+ }
185
+ select(accessor) {
186
+ this._accessors.forEach((c) => {
187
+ if (this._isSameGroup(c, accessor) && c.accessor !== accessor) c.accessor.fireDeselect();
188
+ });
189
+ }
190
+ _isSameGroup(controlPair, accessor) {
191
+ if (!controlPair.control.control) return false;
192
+ return controlPair.control.control.parent === accessor._control.control.parent && controlPair.accessor.name === accessor.name;
193
+ }
194
+ static {
195
+ this.ɵfac = i0.ɵɵngDeclareFactory({
196
+ minVersion: "12.0.0",
197
+ version: "22.2.4",
198
+ ngImport: i0,
199
+ type: DaffRadioRegistry,
200
+ deps: [],
201
+ target: i0.ɵɵFactoryTarget.Injectable
202
+ });
203
+ }
204
+ static {
205
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
206
+ minVersion: "12.0.0",
207
+ version: "22.2.4",
208
+ ngImport: i0,
209
+ type: DaffRadioRegistry,
210
+ providedIn: "root"
211
+ });
212
+ }
213
+ };
214
+ i0.ɵɵngDeclareClassMetadata({
215
+ minVersion: "12.0.0",
216
+ version: "22.2.4",
217
+ ngImport: i0,
218
+ type: DaffRadioRegistry,
219
+ decorators: [{
220
+ type: Injectable,
221
+ args: [{ providedIn: "root" }]
222
+ }]
223
+ });
224
+ var DaffRadioControlValueAccessorDirective = class DaffRadioControlValueAccessorDirective {
225
+ constructor(_control, _registry, _radio) {
226
+ this._control = _control;
227
+ this._registry = _registry;
228
+ this._radio = _radio;
229
+ if (this._control != null) this._control.valueAccessor = this;
230
+ }
231
+ ngOnInit() {
232
+ if (this._control) {
233
+ this.writeValue(this._control.value);
234
+ this._registry.add(this._control, this);
235
+ }
236
+ this._radio.selectionChange.subscribe((value) => value ? this._onChange() : null);
237
+ }
238
+ writeValue(value) {
239
+ if (this.value === value && this._onChange) {
240
+ this._onChange();
241
+ this.fireSelect();
242
+ }
243
+ }
244
+ registerOnChange(fn) {
245
+ this._onChange = () => {
246
+ fn(this.value);
247
+ this._registry.select(this);
248
+ };
249
+ }
250
+ registerOnTouched(fn) {
251
+ this._onTouched = fn;
252
+ }
253
+ setDisabledState(isDisabled) {
254
+ this._radio.disabled = isDisabled;
255
+ }
256
+ fireSelect() {
257
+ this._radio.select();
258
+ }
259
+ fireDeselect() {
260
+ this._radio.deselect();
261
+ }
262
+ static {
263
+ this.ɵfac = i0.ɵɵngDeclareFactory({
264
+ minVersion: "12.0.0",
265
+ version: "22.2.4",
266
+ ngImport: i0,
267
+ type: DaffRadioControlValueAccessorDirective,
268
+ deps: [
269
+ {
270
+ token: i1.NgControl,
271
+ optional: true,
272
+ self: true
273
+ },
274
+ { token: DaffRadioRegistry },
275
+ { token: DaffRadioComponent }
276
+ ],
277
+ target: i0.ɵɵFactoryTarget.Directive
278
+ });
279
+ }
280
+ static {
281
+ this.ɵdir = i0.ɵɵngDeclareDirective({
282
+ minVersion: "14.0.0",
283
+ version: "22.2.4",
284
+ type: DaffRadioControlValueAccessorDirective,
285
+ isStandalone: true,
286
+ selector: "daff-radio[ngModel], daff-radio[formControl], daff-radio[formControlName]",
287
+ inputs: {
288
+ value: "value",
289
+ name: "name"
290
+ },
291
+ ngImport: i0
292
+ });
293
+ }
294
+ };
295
+ i0.ɵɵngDeclareClassMetadata({
296
+ minVersion: "12.0.0",
297
+ version: "22.2.4",
298
+ ngImport: i0,
299
+ type: DaffRadioControlValueAccessorDirective,
300
+ decorators: [{
301
+ type: Directive,
302
+ args: [{ selector: "daff-radio[ngModel], daff-radio[formControl], daff-radio[formControlName]" }]
303
+ }],
304
+ ctorParameters: () => [
305
+ {
306
+ type: i1.NgControl,
307
+ decorators: [{ type: Optional }, { type: Self }]
308
+ },
309
+ { type: DaffRadioRegistry },
310
+ { type: DaffRadioComponent }
311
+ ],
312
+ propDecorators: {
313
+ value: [{ type: Input }],
314
+ name: [{ type: Input }]
315
+ }
316
+ });
317
+ var DaffRadioModule = class DaffRadioModule {
318
+ static {
319
+ this.ɵfac = i0.ɵɵngDeclareFactory({
320
+ minVersion: "12.0.0",
321
+ version: "22.2.4",
322
+ ngImport: i0,
323
+ type: DaffRadioModule,
324
+ deps: [],
325
+ target: i0.ɵɵFactoryTarget.NgModule
326
+ });
327
+ }
328
+ static {
329
+ this.ɵmod = i0.ɵɵngDeclareNgModule({
330
+ minVersion: "14.0.0",
331
+ version: "22.2.4",
332
+ ngImport: i0,
333
+ type: DaffRadioModule,
334
+ imports: [
335
+ CommonModule,
336
+ DaffRadioComponent,
337
+ DaffRadioSetComponent,
338
+ DaffRadioControlValueAccessorDirective
339
+ ],
340
+ exports: [
341
+ DaffRadioComponent,
342
+ DaffRadioSetComponent,
343
+ DaffRadioControlValueAccessorDirective
344
+ ]
345
+ });
346
+ }
347
+ static {
348
+ this.ɵinj = i0.ɵɵngDeclareInjector({
349
+ minVersion: "12.0.0",
350
+ version: "22.2.4",
351
+ ngImport: i0,
352
+ type: DaffRadioModule,
353
+ imports: [CommonModule]
354
+ });
355
+ }
356
+ };
357
+ i0.ɵɵngDeclareClassMetadata({
358
+ minVersion: "12.0.0",
359
+ version: "22.2.4",
360
+ ngImport: i0,
361
+ type: DaffRadioModule,
362
+ decorators: [{
363
+ type: NgModule,
364
+ args: [{
365
+ imports: [
366
+ CommonModule,
367
+ DaffRadioComponent,
368
+ DaffRadioSetComponent,
369
+ DaffRadioControlValueAccessorDirective
370
+ ],
371
+ exports: [
372
+ DaffRadioComponent,
373
+ DaffRadioSetComponent,
374
+ DaffRadioControlValueAccessorDirective
375
+ ]
376
+ }]
377
+ }]
378
+ });
293
379
  const DAFF_RADIO_COMPONENTS = [
294
- DaffRadioComponent,
295
- DaffRadioSetComponent,
296
- DaffRadioControlValueAccessorDirective,
380
+ DaffRadioComponent,
381
+ DaffRadioSetComponent,
382
+ DaffRadioControlValueAccessorDirective
297
383
  ];
298
-
299
- /**
300
- * Generated bundle index. Do not edit.
301
- */
302
-
303
384
  export { DAFF_RADIO_COMPONENTS, DaffRadioComponent, DaffRadioControlValueAccessorDirective, DaffRadioModule, DaffRadioSetComponent };
304
- //# sourceMappingURL=daffodil-design-radio.mjs.map
385
+
386
+ //# sourceMappingURL=daffodil-design-radio.mjs.map