@und-ui/angular 0.0.0-stage → 0.1.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 (228) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +37 -2
  3. package/dist/forms.d.ts +6 -0
  4. package/dist/forms.d.ts.map +1 -0
  5. package/dist/forms.js +6 -0
  6. package/dist/forms.js.map +1 -0
  7. package/dist/generated/forms.d.ts +139 -0
  8. package/dist/generated/forms.d.ts.map +1 -0
  9. package/dist/generated/forms.js +449 -0
  10. package/dist/generated/forms.js.map +1 -0
  11. package/dist/generated/index.d.ts +85 -0
  12. package/dist/generated/index.d.ts.map +1 -0
  13. package/dist/generated/index.js +88 -0
  14. package/dist/generated/index.js.map +1 -0
  15. package/dist/generated/und-accordion.d.ts +13 -0
  16. package/dist/generated/und-accordion.d.ts.map +1 -0
  17. package/dist/generated/und-accordion.js +30 -0
  18. package/dist/generated/und-accordion.js.map +1 -0
  19. package/dist/generated/und-alert.d.ts +27 -0
  20. package/dist/generated/und-alert.d.ts.map +1 -0
  21. package/dist/generated/und-alert.js +67 -0
  22. package/dist/generated/und-alert.js.map +1 -0
  23. package/dist/generated/und-avatar-group.d.ts +22 -0
  24. package/dist/generated/und-avatar-group.d.ts.map +1 -0
  25. package/dist/generated/und-avatar-group.js +57 -0
  26. package/dist/generated/und-avatar-group.js.map +1 -0
  27. package/dist/generated/und-avatar.d.ts +38 -0
  28. package/dist/generated/und-avatar.d.ts.map +1 -0
  29. package/dist/generated/und-avatar.js +103 -0
  30. package/dist/generated/und-avatar.js.map +1 -0
  31. package/dist/generated/und-badge.d.ts +23 -0
  32. package/dist/generated/und-badge.d.ts.map +1 -0
  33. package/dist/generated/und-badge.js +58 -0
  34. package/dist/generated/und-badge.js.map +1 -0
  35. package/dist/generated/und-breadcrumb-item.d.ts +17 -0
  36. package/dist/generated/und-breadcrumb-item.d.ts.map +1 -0
  37. package/dist/generated/und-breadcrumb-item.js +40 -0
  38. package/dist/generated/und-breadcrumb-item.js.map +1 -0
  39. package/dist/generated/und-breadcrumb.d.ts +13 -0
  40. package/dist/generated/und-breadcrumb.d.ts.map +1 -0
  41. package/dist/generated/und-breadcrumb.js +30 -0
  42. package/dist/generated/und-breadcrumb.js.map +1 -0
  43. package/dist/generated/und-button.d.ts +82 -0
  44. package/dist/generated/und-button.d.ts.map +1 -0
  45. package/dist/generated/und-button.js +216 -0
  46. package/dist/generated/und-button.js.map +1 -0
  47. package/dist/generated/und-card.d.ts +25 -0
  48. package/dist/generated/und-card.d.ts.map +1 -0
  49. package/dist/generated/und-card.js +66 -0
  50. package/dist/generated/und-card.js.map +1 -0
  51. package/dist/generated/und-checkbox.d.ts +51 -0
  52. package/dist/generated/und-checkbox.d.ts.map +1 -0
  53. package/dist/generated/und-checkbox.js +128 -0
  54. package/dist/generated/und-checkbox.js.map +1 -0
  55. package/dist/generated/und-combobox.d.ts +81 -0
  56. package/dist/generated/und-combobox.d.ts.map +1 -0
  57. package/dist/generated/und-combobox.js +214 -0
  58. package/dist/generated/und-combobox.js.map +1 -0
  59. package/dist/generated/und-dialog.d.ts +54 -0
  60. package/dist/generated/und-dialog.d.ts.map +1 -0
  61. package/dist/generated/und-dialog.js +133 -0
  62. package/dist/generated/und-dialog.js.map +1 -0
  63. package/dist/generated/und-divider.d.ts +17 -0
  64. package/dist/generated/und-divider.d.ts.map +1 -0
  65. package/dist/generated/und-divider.js +40 -0
  66. package/dist/generated/und-divider.js.map +1 -0
  67. package/dist/generated/und-drawer.d.ts +57 -0
  68. package/dist/generated/und-drawer.d.ts.map +1 -0
  69. package/dist/generated/und-drawer.js +142 -0
  70. package/dist/generated/und-drawer.js.map +1 -0
  71. package/dist/generated/und-form-field.d.ts +27 -0
  72. package/dist/generated/und-form-field.d.ts.map +1 -0
  73. package/dist/generated/und-form-field.js +68 -0
  74. package/dist/generated/und-form-field.js.map +1 -0
  75. package/dist/generated/und-icon-button.d.ts +82 -0
  76. package/dist/generated/und-icon-button.d.ts.map +1 -0
  77. package/dist/generated/und-icon-button.js +216 -0
  78. package/dist/generated/und-icon-button.js.map +1 -0
  79. package/dist/generated/und-link.d.ts +31 -0
  80. package/dist/generated/und-link.d.ts.map +1 -0
  81. package/dist/generated/und-link.js +84 -0
  82. package/dist/generated/und-link.js.map +1 -0
  83. package/dist/generated/und-menu-group.d.ts +13 -0
  84. package/dist/generated/und-menu-group.d.ts.map +1 -0
  85. package/dist/generated/und-menu-group.js +30 -0
  86. package/dist/generated/und-menu-group.js.map +1 -0
  87. package/dist/generated/und-menu-item.d.ts +31 -0
  88. package/dist/generated/und-menu-item.d.ts.map +1 -0
  89. package/dist/generated/und-menu-item.js +78 -0
  90. package/dist/generated/und-menu-item.js.map +1 -0
  91. package/dist/generated/und-menu-separator.d.ts +9 -0
  92. package/dist/generated/und-menu-separator.d.ts.map +1 -0
  93. package/dist/generated/und-menu-separator.js +21 -0
  94. package/dist/generated/und-menu-separator.js.map +1 -0
  95. package/dist/generated/und-menu.d.ts +31 -0
  96. package/dist/generated/und-menu.d.ts.map +1 -0
  97. package/dist/generated/und-menu.js +63 -0
  98. package/dist/generated/und-menu.js.map +1 -0
  99. package/dist/generated/und-pagination.d.ts +41 -0
  100. package/dist/generated/und-pagination.d.ts.map +1 -0
  101. package/dist/generated/und-pagination.js +111 -0
  102. package/dist/generated/und-pagination.js.map +1 -0
  103. package/dist/generated/und-popover.d.ts +40 -0
  104. package/dist/generated/und-popover.d.ts.map +1 -0
  105. package/dist/generated/und-popover.js +95 -0
  106. package/dist/generated/und-popover.js.map +1 -0
  107. package/dist/generated/und-progress.d.ts +31 -0
  108. package/dist/generated/und-progress.d.ts.map +1 -0
  109. package/dist/generated/und-progress.js +84 -0
  110. package/dist/generated/und-progress.js.map +1 -0
  111. package/dist/generated/und-radio-group.d.ts +42 -0
  112. package/dist/generated/und-radio-group.d.ts.map +1 -0
  113. package/dist/generated/und-radio-group.js +107 -0
  114. package/dist/generated/und-radio-group.js.map +1 -0
  115. package/dist/generated/und-radio.d.ts +27 -0
  116. package/dist/generated/und-radio.d.ts.map +1 -0
  117. package/dist/generated/und-radio.js +68 -0
  118. package/dist/generated/und-radio.js.map +1 -0
  119. package/dist/generated/und-select.d.ts +53 -0
  120. package/dist/generated/und-select.d.ts.map +1 -0
  121. package/dist/generated/und-select.js +135 -0
  122. package/dist/generated/und-select.js.map +1 -0
  123. package/dist/generated/und-skeleton.d.ts +16 -0
  124. package/dist/generated/und-skeleton.d.ts.map +1 -0
  125. package/dist/generated/und-skeleton.js +39 -0
  126. package/dist/generated/und-skeleton.js.map +1 -0
  127. package/dist/generated/und-slider.d.ts +71 -0
  128. package/dist/generated/und-slider.d.ts.map +1 -0
  129. package/dist/generated/und-slider.js +190 -0
  130. package/dist/generated/und-slider.js.map +1 -0
  131. package/dist/generated/und-spinner.d.ts +20 -0
  132. package/dist/generated/und-spinner.d.ts.map +1 -0
  133. package/dist/generated/und-spinner.js +49 -0
  134. package/dist/generated/und-spinner.js.map +1 -0
  135. package/dist/generated/und-switch.d.ts +47 -0
  136. package/dist/generated/und-switch.d.ts.map +1 -0
  137. package/dist/generated/und-switch.js +118 -0
  138. package/dist/generated/und-switch.js.map +1 -0
  139. package/dist/generated/und-tab-panel.d.ts +13 -0
  140. package/dist/generated/und-tab-panel.d.ts.map +1 -0
  141. package/dist/generated/und-tab-panel.js +30 -0
  142. package/dist/generated/und-tab-panel.js.map +1 -0
  143. package/dist/generated/und-tab.d.ts +21 -0
  144. package/dist/generated/und-tab.d.ts.map +1 -0
  145. package/dist/generated/und-tab.js +50 -0
  146. package/dist/generated/und-tab.js.map +1 -0
  147. package/dist/generated/und-table.d.ts +37 -0
  148. package/dist/generated/und-table.d.ts.map +1 -0
  149. package/dist/generated/und-table.js +95 -0
  150. package/dist/generated/und-table.js.map +1 -0
  151. package/dist/generated/und-tabs.d.ts +26 -0
  152. package/dist/generated/und-tabs.d.ts.map +1 -0
  153. package/dist/generated/und-tabs.js +66 -0
  154. package/dist/generated/und-tabs.js.map +1 -0
  155. package/dist/generated/und-text-field.d.ts +83 -0
  156. package/dist/generated/und-text-field.d.ts.map +1 -0
  157. package/dist/generated/und-text-field.js +226 -0
  158. package/dist/generated/und-text-field.js.map +1 -0
  159. package/dist/generated/und-textarea.d.ts +69 -0
  160. package/dist/generated/und-textarea.d.ts.map +1 -0
  161. package/dist/generated/und-textarea.js +182 -0
  162. package/dist/generated/und-textarea.js.map +1 -0
  163. package/dist/generated/und-toast.d.ts +35 -0
  164. package/dist/generated/und-toast.d.ts.map +1 -0
  165. package/dist/generated/und-toast.js +85 -0
  166. package/dist/generated/und-toast.js.map +1 -0
  167. package/dist/generated/und-toaster.d.ts +19 -0
  168. package/dist/generated/und-toaster.d.ts.map +1 -0
  169. package/dist/generated/und-toaster.js +48 -0
  170. package/dist/generated/und-toaster.js.map +1 -0
  171. package/dist/generated/und-tooltip.d.ts +40 -0
  172. package/dist/generated/und-tooltip.d.ts.map +1 -0
  173. package/dist/generated/und-tooltip.js +95 -0
  174. package/dist/generated/und-tooltip.js.map +1 -0
  175. package/dist/generated/und-visually-hidden.d.ts +14 -0
  176. package/dist/generated/und-visually-hidden.d.ts.map +1 -0
  177. package/dist/generated/und-visually-hidden.js +31 -0
  178. package/dist/generated/und-visually-hidden.js.map +1 -0
  179. package/dist/index.d.ts +2 -0
  180. package/dist/index.d.ts.map +1 -0
  181. package/dist/index.js +2 -0
  182. package/dist/index.js.map +1 -0
  183. package/package.json +74 -3
  184. package/src/forms.ts +5 -0
  185. package/src/generated/forms.ts +400 -0
  186. package/src/generated/index.ts +89 -0
  187. package/src/generated/und-accordion.ts +25 -0
  188. package/src/generated/und-alert.ts +62 -0
  189. package/src/generated/und-avatar-group.ts +52 -0
  190. package/src/generated/und-avatar.ts +97 -0
  191. package/src/generated/und-badge.ts +52 -0
  192. package/src/generated/und-breadcrumb-item.ts +34 -0
  193. package/src/generated/und-breadcrumb.ts +25 -0
  194. package/src/generated/und-button.ts +206 -0
  195. package/src/generated/und-card.ts +61 -0
  196. package/src/generated/und-checkbox.ts +118 -0
  197. package/src/generated/und-combobox.ts +205 -0
  198. package/src/generated/und-dialog.ts +126 -0
  199. package/src/generated/und-divider.ts +34 -0
  200. package/src/generated/und-drawer.ts +135 -0
  201. package/src/generated/und-form-field.ts +61 -0
  202. package/src/generated/und-icon-button.ts +206 -0
  203. package/src/generated/und-link.ts +79 -0
  204. package/src/generated/und-menu-group.ts +25 -0
  205. package/src/generated/und-menu-item.ts +70 -0
  206. package/src/generated/und-menu-separator.ts +17 -0
  207. package/src/generated/und-menu.ts +58 -0
  208. package/src/generated/und-pagination.ts +107 -0
  209. package/src/generated/und-popover.ts +90 -0
  210. package/src/generated/und-progress.ts +79 -0
  211. package/src/generated/und-radio-group.ts +100 -0
  212. package/src/generated/und-radio.ts +61 -0
  213. package/src/generated/und-select.ts +128 -0
  214. package/src/generated/und-skeleton.ts +34 -0
  215. package/src/generated/und-slider.ts +181 -0
  216. package/src/generated/und-spinner.ts +43 -0
  217. package/src/generated/und-switch.ts +109 -0
  218. package/src/generated/und-tab-panel.ts +25 -0
  219. package/src/generated/und-tab.ts +43 -0
  220. package/src/generated/und-table.ts +89 -0
  221. package/src/generated/und-tabs.ts +62 -0
  222. package/src/generated/und-text-field.ts +217 -0
  223. package/src/generated/und-textarea.ts +172 -0
  224. package/src/generated/und-toast.ts +80 -0
  225. package/src/generated/und-toaster.ts +43 -0
  226. package/src/generated/und-tooltip.ts +89 -0
  227. package/src/generated/und-visually-hidden.ts +25 -0
  228. package/src/index.ts +1 -0
@@ -0,0 +1,400 @@
1
+ // GENERATED FILE. DO NOT EDIT.
2
+ // Source: @und-ui/core custom-elements.json, via tools/codegen/wrappers.mjs.
3
+ // Run `pnpm codegen` (or `pnpm build`) after changing a component.
4
+ // ControlValueAccessor directives: ngModel, formControl and formControlName on
5
+ // UND UI form controls. Import from `@und-ui/angular/forms` (needs @angular/forms).
6
+ import { DestroyRef, Directive, type DoCheck, ElementRef, forwardRef, inject, Input } from '@angular/core';
7
+ import { ControlContainer, NG_VALUE_ACCESSOR, NgControl, type AbstractControl, type ControlValueAccessor, type ValidationErrors } from '@angular/forms';
8
+ import type { UndCheckbox as UndCheckboxElement, UndCombobox as UndComboboxElement, UndRadioGroup as UndRadioGroupElement, UndSelect as UndSelectElement, UndSlider as UndSliderElement, UndSwitch as UndSwitchElement, UndTextField as UndTextFieldElement, UndTextarea as UndTextareaElement } from '@und-ui/core';
9
+
10
+ /** Connects `<und-checkbox>` to Angular forms through `checked`. */
11
+ @Directive({
12
+ selector: 'und-checkbox[ngModel], und-checkbox[formControl], und-checkbox[formControlName]',
13
+ host: {
14
+ '(change)': 'onUserChange($event)',
15
+ '(focusout)': 'onTouched()',
16
+ },
17
+ providers: [
18
+ { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UndCheckboxValueAccessor), multi: true },
19
+ ],
20
+ })
21
+ export class UndCheckboxValueAccessor implements ControlValueAccessor {
22
+ readonly #el: UndCheckboxElement = inject<ElementRef<UndCheckboxElement>>(ElementRef).nativeElement;
23
+ #onChange: (value: UndCheckboxElement['checked']) => void = () => {};
24
+ onTouched: () => void = () => {};
25
+
26
+ writeValue(value: UndCheckboxElement['checked'] | null): void {
27
+ this.#el.checked = value ?? false;
28
+ }
29
+
30
+ registerOnChange(fn: (value: UndCheckboxElement['checked']) => void): void {
31
+ this.#onChange = fn;
32
+ }
33
+
34
+ registerOnTouched(fn: () => void): void {
35
+ this.onTouched = fn;
36
+ }
37
+
38
+ setDisabledState(disabled: boolean): void {
39
+ this.#el.disabled = disabled;
40
+ }
41
+
42
+ /** @internal IME: composing input events are skipped; compositionend commits. */
43
+ onUserChange(event: Event): void {
44
+ if ((event as InputEvent).isComposing) return;
45
+ this.#onChange(this.#el.checked);
46
+ }
47
+ }
48
+
49
+ /** Connects `<und-combobox>` to Angular forms through `value`. */
50
+ @Directive({
51
+ selector: 'und-combobox[ngModel], und-combobox[formControl], und-combobox[formControlName]',
52
+ host: {
53
+ '(input)': 'onUserChange($event)',
54
+ '(compositionend)': 'onUserChange($event)',
55
+ '(focusout)': 'onTouched()',
56
+ },
57
+ providers: [
58
+ { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UndComboboxValueAccessor), multi: true },
59
+ ],
60
+ })
61
+ export class UndComboboxValueAccessor implements ControlValueAccessor {
62
+ readonly #el: UndComboboxElement = inject<ElementRef<UndComboboxElement>>(ElementRef).nativeElement;
63
+ #onChange: (value: UndComboboxElement['value']) => void = () => {};
64
+ onTouched: () => void = () => {};
65
+
66
+ writeValue(value: UndComboboxElement['value'] | null): void {
67
+ this.#el.value = value ?? '';
68
+ }
69
+
70
+ registerOnChange(fn: (value: UndComboboxElement['value']) => void): void {
71
+ this.#onChange = fn;
72
+ }
73
+
74
+ registerOnTouched(fn: () => void): void {
75
+ this.onTouched = fn;
76
+ }
77
+
78
+ setDisabledState(disabled: boolean): void {
79
+ this.#el.disabled = disabled;
80
+ }
81
+
82
+ /** @internal IME: composing input events are skipped; compositionend commits. */
83
+ onUserChange(event: Event): void {
84
+ if ((event as InputEvent).isComposing) return;
85
+ this.#onChange(this.#el.value);
86
+ }
87
+ }
88
+
89
+ /** Connects `<und-radio-group>` to Angular forms through `value`. */
90
+ @Directive({
91
+ selector: 'und-radio-group[ngModel], und-radio-group[formControl], und-radio-group[formControlName]',
92
+ host: {
93
+ '(input)': 'onUserChange($event)',
94
+ '(compositionend)': 'onUserChange($event)',
95
+ '(focusout)': 'onTouched()',
96
+ },
97
+ providers: [
98
+ { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UndRadioGroupValueAccessor), multi: true },
99
+ ],
100
+ })
101
+ export class UndRadioGroupValueAccessor implements ControlValueAccessor {
102
+ readonly #el: UndRadioGroupElement = inject<ElementRef<UndRadioGroupElement>>(ElementRef).nativeElement;
103
+ #onChange: (value: UndRadioGroupElement['value']) => void = () => {};
104
+ onTouched: () => void = () => {};
105
+
106
+ writeValue(value: UndRadioGroupElement['value'] | null): void {
107
+ this.#el.value = value ?? '';
108
+ }
109
+
110
+ registerOnChange(fn: (value: UndRadioGroupElement['value']) => void): void {
111
+ this.#onChange = fn;
112
+ }
113
+
114
+ registerOnTouched(fn: () => void): void {
115
+ this.onTouched = fn;
116
+ }
117
+
118
+ setDisabledState(disabled: boolean): void {
119
+ this.#el.disabled = disabled;
120
+ }
121
+
122
+ /** @internal IME: composing input events are skipped; compositionend commits. */
123
+ onUserChange(event: Event): void {
124
+ if ((event as InputEvent).isComposing) return;
125
+ this.#onChange(this.#el.value);
126
+ }
127
+ }
128
+
129
+ /** Connects `<und-select>` to Angular forms through `value`. */
130
+ @Directive({
131
+ selector: 'und-select[ngModel], und-select[formControl], und-select[formControlName]',
132
+ host: {
133
+ '(input)': 'onUserChange($event)',
134
+ '(compositionend)': 'onUserChange($event)',
135
+ '(focusout)': 'onTouched()',
136
+ },
137
+ providers: [
138
+ { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UndSelectValueAccessor), multi: true },
139
+ ],
140
+ })
141
+ export class UndSelectValueAccessor implements ControlValueAccessor {
142
+ readonly #el: UndSelectElement = inject<ElementRef<UndSelectElement>>(ElementRef).nativeElement;
143
+ #onChange: (value: UndSelectElement['value']) => void = () => {};
144
+ onTouched: () => void = () => {};
145
+
146
+ writeValue(value: UndSelectElement['value'] | null): void {
147
+ this.#el.value = value ?? '';
148
+ }
149
+
150
+ registerOnChange(fn: (value: UndSelectElement['value']) => void): void {
151
+ this.#onChange = fn;
152
+ }
153
+
154
+ registerOnTouched(fn: () => void): void {
155
+ this.onTouched = fn;
156
+ }
157
+
158
+ setDisabledState(disabled: boolean): void {
159
+ this.#el.disabled = disabled;
160
+ }
161
+
162
+ /** @internal IME: composing input events are skipped; compositionend commits. */
163
+ onUserChange(event: Event): void {
164
+ if ((event as InputEvent).isComposing) return;
165
+ this.#onChange(this.#el.value);
166
+ }
167
+ }
168
+
169
+ /** Connects `<und-slider>` to Angular forms through `value`. */
170
+ @Directive({
171
+ selector: 'und-slider[ngModel], und-slider[formControl], und-slider[formControlName]',
172
+ host: {
173
+ '(input)': 'onUserChange($event)',
174
+ '(compositionend)': 'onUserChange($event)',
175
+ '(focusout)': 'onTouched()',
176
+ },
177
+ providers: [
178
+ { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UndSliderValueAccessor), multi: true },
179
+ ],
180
+ })
181
+ export class UndSliderValueAccessor implements ControlValueAccessor {
182
+ readonly #el: UndSliderElement = inject<ElementRef<UndSliderElement>>(ElementRef).nativeElement;
183
+ #onChange: (value: UndSliderElement['value']) => void = () => {};
184
+ onTouched: () => void = () => {};
185
+
186
+ writeValue(value: UndSliderElement['value'] | null): void {
187
+ this.#el.value = value ?? 0;
188
+ }
189
+
190
+ registerOnChange(fn: (value: UndSliderElement['value']) => void): void {
191
+ this.#onChange = fn;
192
+ }
193
+
194
+ registerOnTouched(fn: () => void): void {
195
+ this.onTouched = fn;
196
+ }
197
+
198
+ setDisabledState(disabled: boolean): void {
199
+ this.#el.disabled = disabled;
200
+ }
201
+
202
+ /** @internal IME: composing input events are skipped; compositionend commits. */
203
+ onUserChange(event: Event): void {
204
+ if ((event as InputEvent).isComposing) return;
205
+ this.#onChange(this.#el.value);
206
+ }
207
+ }
208
+
209
+ /** Connects `<und-switch>` to Angular forms through `checked`. */
210
+ @Directive({
211
+ selector: 'und-switch[ngModel], und-switch[formControl], und-switch[formControlName]',
212
+ host: {
213
+ '(change)': 'onUserChange($event)',
214
+ '(focusout)': 'onTouched()',
215
+ },
216
+ providers: [
217
+ { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UndSwitchValueAccessor), multi: true },
218
+ ],
219
+ })
220
+ export class UndSwitchValueAccessor implements ControlValueAccessor {
221
+ readonly #el: UndSwitchElement = inject<ElementRef<UndSwitchElement>>(ElementRef).nativeElement;
222
+ #onChange: (value: UndSwitchElement['checked']) => void = () => {};
223
+ onTouched: () => void = () => {};
224
+
225
+ writeValue(value: UndSwitchElement['checked'] | null): void {
226
+ this.#el.checked = value ?? false;
227
+ }
228
+
229
+ registerOnChange(fn: (value: UndSwitchElement['checked']) => void): void {
230
+ this.#onChange = fn;
231
+ }
232
+
233
+ registerOnTouched(fn: () => void): void {
234
+ this.onTouched = fn;
235
+ }
236
+
237
+ setDisabledState(disabled: boolean): void {
238
+ this.#el.disabled = disabled;
239
+ }
240
+
241
+ /** @internal IME: composing input events are skipped; compositionend commits. */
242
+ onUserChange(event: Event): void {
243
+ if ((event as InputEvent).isComposing) return;
244
+ this.#onChange(this.#el.checked);
245
+ }
246
+ }
247
+
248
+ /** Connects `<und-text-field>` to Angular forms through `value`. */
249
+ @Directive({
250
+ selector: 'und-text-field[ngModel], und-text-field[formControl], und-text-field[formControlName]',
251
+ host: {
252
+ '(input)': 'onUserChange($event)',
253
+ '(compositionend)': 'onUserChange($event)',
254
+ '(focusout)': 'onTouched()',
255
+ },
256
+ providers: [
257
+ { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UndTextFieldValueAccessor), multi: true },
258
+ ],
259
+ })
260
+ export class UndTextFieldValueAccessor implements ControlValueAccessor {
261
+ readonly #el: UndTextFieldElement = inject<ElementRef<UndTextFieldElement>>(ElementRef).nativeElement;
262
+ #onChange: (value: UndTextFieldElement['value']) => void = () => {};
263
+ onTouched: () => void = () => {};
264
+
265
+ writeValue(value: UndTextFieldElement['value'] | null): void {
266
+ this.#el.value = value ?? '';
267
+ }
268
+
269
+ registerOnChange(fn: (value: UndTextFieldElement['value']) => void): void {
270
+ this.#onChange = fn;
271
+ }
272
+
273
+ registerOnTouched(fn: () => void): void {
274
+ this.onTouched = fn;
275
+ }
276
+
277
+ setDisabledState(disabled: boolean): void {
278
+ this.#el.disabled = disabled;
279
+ }
280
+
281
+ /** @internal IME: composing input events are skipped; compositionend commits. */
282
+ onUserChange(event: Event): void {
283
+ if ((event as InputEvent).isComposing) return;
284
+ this.#onChange(this.#el.value);
285
+ }
286
+ }
287
+
288
+ /** Connects `<und-textarea>` to Angular forms through `value`. */
289
+ @Directive({
290
+ selector: 'und-textarea[ngModel], und-textarea[formControl], und-textarea[formControlName]',
291
+ host: {
292
+ '(input)': 'onUserChange($event)',
293
+ '(compositionend)': 'onUserChange($event)',
294
+ '(focusout)': 'onTouched()',
295
+ },
296
+ providers: [
297
+ { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UndTextareaValueAccessor), multi: true },
298
+ ],
299
+ })
300
+ export class UndTextareaValueAccessor implements ControlValueAccessor {
301
+ readonly #el: UndTextareaElement = inject<ElementRef<UndTextareaElement>>(ElementRef).nativeElement;
302
+ #onChange: (value: UndTextareaElement['value']) => void = () => {};
303
+ onTouched: () => void = () => {};
304
+
305
+ writeValue(value: UndTextareaElement['value'] | null): void {
306
+ this.#el.value = value ?? '';
307
+ }
308
+
309
+ registerOnChange(fn: (value: UndTextareaElement['value']) => void): void {
310
+ this.#onChange = fn;
311
+ }
312
+
313
+ registerOnTouched(fn: () => void): void {
314
+ this.onTouched = fn;
315
+ }
316
+
317
+ setDisabledState(disabled: boolean): void {
318
+ this.#el.disabled = disabled;
319
+ }
320
+
321
+ /** @internal IME: composing input events are skipped; compositionend commits. */
322
+ onUserChange(event: Event): void {
323
+ if ((event as InputEvent).isComposing) return;
324
+ this.#onChange(this.#el.value);
325
+ }
326
+ }
327
+
328
+ /**
329
+ * Messages for `undControlError`: one message for any error, a message per
330
+ * validator key (`required`, `minlength`, ...), or a function of the errors.
331
+ */
332
+ export type UndControlErrorMessages =
333
+ | string
334
+ | Readonly<Record<string, string>>
335
+ | ((errors: ValidationErrors) => string);
336
+
337
+ /**
338
+ * Opt-in: shows the Angular control's validation state on the UND UI element.
339
+ * While the control is invalid and touched (or its form was submitted), the
340
+ * element's `error` is set to the message, which marks it invalid
341
+ * (`aria-invalid`) and shows the text; otherwise `error` is cleared. Do not
342
+ * also bind `[error]` on the same element.
343
+ *
344
+ * ```html
345
+ * <und-text-field formControlName="name" [undControlError]="{ required: 'Enter your name' }" />
346
+ * ```
347
+ *
348
+ * Without the directive, bind the message yourself:
349
+ * `[error]="name.invalid && name.touched ? 'Enter your name' : ''"`.
350
+ */
351
+ @Directive({
352
+ selector: 'und-checkbox[undControlError], und-combobox[undControlError], und-radio-group[undControlError], und-select[undControlError], und-slider[undControlError], und-switch[undControlError], und-text-field[undControlError], und-textarea[undControlError]',
353
+ })
354
+ export class UndControlError implements DoCheck {
355
+ /** The message(s) to show; keys without a message fall back to "Invalid value". */
356
+ @Input() undControlError: UndControlErrorMessages = '';
357
+
358
+ readonly #el = inject<ElementRef<HTMLElement & { error: string }>>(ElementRef).nativeElement;
359
+ readonly #ngControl = inject(NgControl, { self: true, optional: true });
360
+ readonly #container = inject(ControlContainer, { optional: true });
361
+ #watched: AbstractControl | null = null;
362
+ #unsubscribe: (() => void) | undefined;
363
+
364
+ constructor() {
365
+ inject(DestroyRef).onDestroy(() => this.#unsubscribe?.());
366
+ }
367
+
368
+ ngDoCheck(): void {
369
+ const control = this.#ngControl?.control ?? null;
370
+ if (control !== this.#watched) {
371
+ this.#unsubscribe?.();
372
+ this.#watched = control;
373
+ // Status and touched changes made outside a change detection pass.
374
+ const subscription = control?.events.subscribe(() => this.#sync());
375
+ this.#unsubscribe = subscription && (() => subscription.unsubscribe());
376
+ }
377
+ this.#sync();
378
+ }
379
+
380
+ #sync(): void {
381
+ const control = this.#watched;
382
+ if (!control) return;
383
+ const form = this.#container?.formDirective as { submitted?: boolean } | null | undefined;
384
+ const show = control.invalid && (control.touched || form?.submitted === true);
385
+ const message = show ? this.#message(control.errors ?? {}) : '';
386
+ if (this.#el.error !== message) this.#el.error = message;
387
+ }
388
+
389
+ #message(errors: ValidationErrors): string {
390
+ const messages = this.undControlError;
391
+ let message: string | undefined;
392
+ if (typeof messages === 'function') message = messages(errors);
393
+ else if (typeof messages === 'string') message = messages;
394
+ else message = Object.keys(errors).map((key) => messages[key]).find(Boolean);
395
+ return message || 'Invalid value';
396
+ }
397
+ }
398
+
399
+ /** Every value accessor and `UndControlError`, for a standalone component's `imports`. */
400
+ export const UND_UI_FORMS = [UndCheckboxValueAccessor, UndComboboxValueAccessor, UndRadioGroupValueAccessor, UndSelectValueAccessor, UndSliderValueAccessor, UndSwitchValueAccessor, UndTextFieldValueAccessor, UndTextareaValueAccessor, UndControlError] as const;
@@ -0,0 +1,89 @@
1
+ // GENERATED FILE. DO NOT EDIT.
2
+ // Source: @und-ui/core custom-elements.json, via tools/codegen/wrappers.mjs.
3
+ // Run `pnpm codegen` (or `pnpm build`) after changing a component.
4
+ import { UndAccordion } from './und-accordion.js';
5
+ import { UndAlert } from './und-alert.js';
6
+ import { UndAvatar } from './und-avatar.js';
7
+ import { UndAvatarGroup } from './und-avatar-group.js';
8
+ import { UndBadge } from './und-badge.js';
9
+ import { UndBreadcrumb } from './und-breadcrumb.js';
10
+ import { UndBreadcrumbItem } from './und-breadcrumb-item.js';
11
+ import { UndButton } from './und-button.js';
12
+ import { UndCard } from './und-card.js';
13
+ import { UndCheckbox } from './und-checkbox.js';
14
+ import { UndCombobox } from './und-combobox.js';
15
+ import { UndDialog } from './und-dialog.js';
16
+ import { UndDivider } from './und-divider.js';
17
+ import { UndDrawer } from './und-drawer.js';
18
+ import { UndFormField } from './und-form-field.js';
19
+ import { UndIconButton } from './und-icon-button.js';
20
+ import { UndLink } from './und-link.js';
21
+ import { UndMenu } from './und-menu.js';
22
+ import { UndMenuGroup } from './und-menu-group.js';
23
+ import { UndMenuItem } from './und-menu-item.js';
24
+ import { UndMenuSeparator } from './und-menu-separator.js';
25
+ import { UndPagination } from './und-pagination.js';
26
+ import { UndPopover } from './und-popover.js';
27
+ import { UndProgress } from './und-progress.js';
28
+ import { UndRadio } from './und-radio.js';
29
+ import { UndRadioGroup } from './und-radio-group.js';
30
+ import { UndSelect } from './und-select.js';
31
+ import { UndSkeleton } from './und-skeleton.js';
32
+ import { UndSlider } from './und-slider.js';
33
+ import { UndSpinner } from './und-spinner.js';
34
+ import { UndSwitch } from './und-switch.js';
35
+ import { UndTab } from './und-tab.js';
36
+ import { UndTabPanel } from './und-tab-panel.js';
37
+ import { UndTable } from './und-table.js';
38
+ import { UndTabs } from './und-tabs.js';
39
+ import { UndTextField } from './und-text-field.js';
40
+ import { UndTextarea } from './und-textarea.js';
41
+ import { UndToast } from './und-toast.js';
42
+ import { UndToaster } from './und-toaster.js';
43
+ import { UndTooltip } from './und-tooltip.js';
44
+ import { UndVisuallyHidden } from './und-visually-hidden.js';
45
+
46
+ export { UndAccordion } from './und-accordion.js';
47
+ export { UndAlert } from './und-alert.js';
48
+ export { UndAvatar } from './und-avatar.js';
49
+ export { UndAvatarGroup } from './und-avatar-group.js';
50
+ export { UndBadge } from './und-badge.js';
51
+ export { UndBreadcrumb } from './und-breadcrumb.js';
52
+ export { UndBreadcrumbItem } from './und-breadcrumb-item.js';
53
+ export { UndButton } from './und-button.js';
54
+ export { UndCard } from './und-card.js';
55
+ export { UndCheckbox } from './und-checkbox.js';
56
+ export { UndCombobox } from './und-combobox.js';
57
+ export { UndDialog } from './und-dialog.js';
58
+ export { UndDivider } from './und-divider.js';
59
+ export { UndDrawer } from './und-drawer.js';
60
+ export { UndFormField } from './und-form-field.js';
61
+ export { UndIconButton } from './und-icon-button.js';
62
+ export { UndLink } from './und-link.js';
63
+ export { UndMenu } from './und-menu.js';
64
+ export { UndMenuGroup } from './und-menu-group.js';
65
+ export { UndMenuItem } from './und-menu-item.js';
66
+ export { UndMenuSeparator } from './und-menu-separator.js';
67
+ export { UndPagination } from './und-pagination.js';
68
+ export { UndPopover } from './und-popover.js';
69
+ export { UndProgress } from './und-progress.js';
70
+ export { UndRadio } from './und-radio.js';
71
+ export { UndRadioGroup } from './und-radio-group.js';
72
+ export { UndSelect } from './und-select.js';
73
+ export { UndSkeleton } from './und-skeleton.js';
74
+ export { UndSlider } from './und-slider.js';
75
+ export { UndSpinner } from './und-spinner.js';
76
+ export { UndSwitch } from './und-switch.js';
77
+ export { UndTab } from './und-tab.js';
78
+ export { UndTabPanel } from './und-tab-panel.js';
79
+ export { UndTable } from './und-table.js';
80
+ export { UndTabs } from './und-tabs.js';
81
+ export { UndTextField } from './und-text-field.js';
82
+ export { UndTextarea } from './und-textarea.js';
83
+ export { UndToast } from './und-toast.js';
84
+ export { UndToaster } from './und-toaster.js';
85
+ export { UndTooltip } from './und-tooltip.js';
86
+ export { UndVisuallyHidden } from './und-visually-hidden.js';
87
+
88
+ /** Every UND UI component, for a standalone component's `imports`. */
89
+ export const UND_UI_COMPONENTS = [UndAccordion, UndAlert, UndAvatar, UndAvatarGroup, UndBadge, UndBreadcrumb, UndBreadcrumbItem, UndButton, UndCard, UndCheckbox, UndCombobox, UndDialog, UndDivider, UndDrawer, UndFormField, UndIconButton, UndLink, UndMenu, UndMenuGroup, UndMenuItem, UndMenuSeparator, UndPagination, UndPopover, UndProgress, UndRadio, UndRadioGroup, UndSelect, UndSkeleton, UndSlider, UndSpinner, UndSwitch, UndTab, UndTabPanel, UndTable, UndTabs, UndTextField, UndTextarea, UndToast, UndToaster, UndTooltip, UndVisuallyHidden] as const;
@@ -0,0 +1,25 @@
1
+ // GENERATED FILE. DO NOT EDIT.
2
+ // Source: @und-ui/core custom-elements.json, via tools/codegen/wrappers.mjs.
3
+ // Run `pnpm codegen` (or `pnpm build`) after changing a component.
4
+ import { ChangeDetectionStrategy, Component, ElementRef, Input, inject } from '@angular/core';
5
+ import '@und-ui/core/accordion.js';
6
+ import type { UndAccordion as UndAccordionElement } from '@und-ui/core';
7
+
8
+ /** Stacked headers that show and hide sections of content. */
9
+ @Component({
10
+ selector: 'und-accordion',
11
+ template: '<ng-content></ng-content>',
12
+ changeDetection: ChangeDetectionStrategy.OnPush,
13
+ })
14
+ export class UndAccordion {
15
+ readonly #el: UndAccordionElement = inject<ElementRef<UndAccordionElement>>(ElementRef).nativeElement;
16
+
17
+ /** `single` keeps at most one item open; `multiple` lets items open independently. */
18
+ @Input()
19
+ set type(value: UndAccordionElement['type']) {
20
+ this.#el.type = value;
21
+ }
22
+ get type(): UndAccordionElement['type'] {
23
+ return this.#el.type;
24
+ }
25
+ }
@@ -0,0 +1,62 @@
1
+ // GENERATED FILE. DO NOT EDIT.
2
+ // Source: @und-ui/core custom-elements.json, via tools/codegen/wrappers.mjs.
3
+ // Run `pnpm codegen` (or `pnpm build`) after changing a component.
4
+ import { booleanAttribute, ChangeDetectionStrategy, Component, ElementRef, EventEmitter, Input, NgZone, Output, inject } from '@angular/core';
5
+ import '@und-ui/core/alert.js';
6
+ import type { UndAlert as UndAlertElement } from '@und-ui/core';
7
+
8
+ /** Shows a short, important message in context. */
9
+ @Component({
10
+ selector: 'und-alert',
11
+ template: '<ng-content></ng-content>',
12
+ changeDetection: ChangeDetectionStrategy.OnPush,
13
+ })
14
+ export class UndAlert {
15
+ readonly #el: UndAlertElement = inject<ElementRef<UndAlertElement>>(ElementRef).nativeElement;
16
+
17
+ /** Color intent and default icon. */
18
+ @Input()
19
+ set tone(value: UndAlertElement['tone']) {
20
+ this.#el.tone = value;
21
+ }
22
+ get tone(): UndAlertElement['tone'] {
23
+ return this.#el.tone;
24
+ }
25
+
26
+ /** Live region behaviour. `off` (default) for content present on load; `polite` (role `status`) or `assertive` (role `alert`) for messages that appear or change while the user works. */
27
+ @Input()
28
+ set live(value: UndAlertElement['live']) {
29
+ this.#el.live = value;
30
+ }
31
+ get live(): UndAlertElement['live'] {
32
+ return this.#el.live;
33
+ }
34
+
35
+ /** Shows a dismiss button. Pressing it fires `und-dismiss` and hides the alert. */
36
+ @Input({ transform: booleanAttribute })
37
+ set dismissible(value: boolean) {
38
+ this.#el.dismissible = value;
39
+ }
40
+ get dismissible(): UndAlertElement['dismissible'] {
41
+ return this.#el.dismissible;
42
+ }
43
+
44
+ /** Accessible name of the dismiss button (localise it). */
45
+ @Input()
46
+ set dismissLabel(value: UndAlertElement['dismissLabel']) {
47
+ this.#el.dismissLabel = value;
48
+ }
49
+ get dismissLabel(): UndAlertElement['dismissLabel'] {
50
+ return this.#el.dismissLabel;
51
+ }
52
+
53
+ /** Before the alert hides after the dismiss button is pressed. Cancelable: call `preventDefault()` to keep it visible. */
54
+ @Output() readonly undDismiss = new EventEmitter<CustomEvent<unknown>>();
55
+
56
+ constructor() {
57
+ const zone = inject(NgZone);
58
+ this.#el.addEventListener('und-dismiss', (event) =>
59
+ zone.run(() => this.undDismiss.emit(event as CustomEvent<unknown>)),
60
+ );
61
+ }
62
+ }
@@ -0,0 +1,52 @@
1
+ // GENERATED FILE. DO NOT EDIT.
2
+ // Source: @und-ui/core custom-elements.json, via tools/codegen/wrappers.mjs.
3
+ // Run `pnpm codegen` (or `pnpm build`) after changing a component.
4
+ import { ChangeDetectionStrategy, Component, ElementRef, Input, inject } from '@angular/core';
5
+ import '@und-ui/core/avatar-group.js';
6
+ import type { UndAvatarGroup as UndAvatarGroupElement } from '@und-ui/core';
7
+
8
+ /** Overlapping avatars with an overflow counter. */
9
+ @Component({
10
+ selector: 'und-avatar-group',
11
+ template: '<ng-content></ng-content>',
12
+ changeDetection: ChangeDetectionStrategy.OnPush,
13
+ })
14
+ export class UndAvatarGroup {
15
+ readonly #el: UndAvatarGroupElement = inject<ElementRef<UndAvatarGroupElement>>(ElementRef).nativeElement;
16
+
17
+ /** Accessible name of the group, such as "Project members". */
18
+ @Input()
19
+ set label(value: UndAvatarGroupElement['label']) {
20
+ this.#el.label = value;
21
+ }
22
+ get label(): UndAvatarGroupElement['label'] {
23
+ return this.#el.label;
24
+ }
25
+
26
+ /** Maximum number of avatars shown before the "+N" counter. */
27
+ @Input()
28
+ set max(value: UndAvatarGroupElement['max']) {
29
+ this.#el.max = value;
30
+ }
31
+ get max(): UndAvatarGroupElement['max'] {
32
+ return this.#el.max;
33
+ }
34
+
35
+ /** Size of the "+N" counter; match it to the avatars. */
36
+ @Input()
37
+ set size(value: UndAvatarGroupElement['size']) {
38
+ this.#el.size = value;
39
+ }
40
+ get size(): UndAvatarGroupElement['size'] {
41
+ return this.#el.size;
42
+ }
43
+
44
+ /** Spoken text of the counter; `{count}` is replaced by the hidden count. */
45
+ @Input()
46
+ set moreLabel(value: UndAvatarGroupElement['moreLabel']) {
47
+ this.#el.moreLabel = value;
48
+ }
49
+ get moreLabel(): UndAvatarGroupElement['moreLabel'] {
50
+ return this.#el.moreLabel;
51
+ }
52
+ }