@daffodil/design 0.89.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 (209) hide show
  1. package/README.md +1 -0
  2. package/accordion/index.d.ts +8 -5
  3. package/article/README.md +1 -1
  4. package/article/index.d.ts +20 -0
  5. package/article/src/article-theme.scss +10 -0
  6. package/button/index.d.ts +4 -4
  7. package/button/src/button/button-base.scss +3 -3
  8. package/button/src/button/raised/raised-theme.scss +6 -16
  9. package/card/README.md +0 -8
  10. package/card/index.d.ts +7 -41
  11. package/card/src/card-base-theme.scss +2 -5
  12. package/card/src/card-base.scss +2 -2
  13. package/checkbox/README.md +0 -0
  14. package/checkbox/index.d.ts +177 -0
  15. package/fesm2022/daffodil-design-accordion.mjs +23 -14
  16. package/fesm2022/daffodil-design-accordion.mjs.map +1 -1
  17. package/fesm2022/daffodil-design-article.mjs +129 -5
  18. package/fesm2022/daffodil-design-article.mjs.map +1 -1
  19. package/fesm2022/daffodil-design-button.mjs +24 -20
  20. package/fesm2022/daffodil-design-button.mjs.map +1 -1
  21. package/fesm2022/daffodil-design-card.mjs +16 -63
  22. package/fesm2022/daffodil-design-card.mjs.map +1 -1
  23. package/fesm2022/daffodil-design-checkbox.mjs +317 -0
  24. package/fesm2022/daffodil-design-checkbox.mjs.map +1 -0
  25. package/fesm2022/daffodil-design-form-field.mjs +55 -162
  26. package/fesm2022/daffodil-design-form-field.mjs.map +1 -1
  27. package/fesm2022/daffodil-design-form.mjs +62 -0
  28. package/fesm2022/daffodil-design-form.mjs.map +1 -0
  29. package/fesm2022/daffodil-design-image.mjs +12 -4
  30. package/fesm2022/daffodil-design-image.mjs.map +1 -1
  31. package/fesm2022/daffodil-design-modal.mjs +55 -56
  32. package/fesm2022/daffodil-design-modal.mjs.map +1 -1
  33. package/fesm2022/daffodil-design-notification.mjs +14 -50
  34. package/fesm2022/daffodil-design-notification.mjs.map +1 -1
  35. package/fesm2022/daffodil-design-paginator.mjs +6 -11
  36. package/fesm2022/daffodil-design-paginator.mjs.map +1 -1
  37. package/fesm2022/daffodil-design-quantity-field.mjs +3 -5
  38. package/fesm2022/daffodil-design-quantity-field.mjs.map +1 -1
  39. package/fesm2022/daffodil-design-radio.mjs +304 -0
  40. package/fesm2022/daffodil-design-radio.mjs.map +1 -0
  41. package/fesm2022/daffodil-design-select.mjs +2 -2
  42. package/fesm2022/daffodil-design-select.mjs.map +1 -1
  43. package/fesm2022/daffodil-design-sidebar.mjs +6 -36
  44. package/fesm2022/daffodil-design-sidebar.mjs.map +1 -1
  45. package/fesm2022/daffodil-design-switch.mjs +48 -105
  46. package/fesm2022/daffodil-design-switch.mjs.map +1 -1
  47. package/fesm2022/daffodil-design-tabs.mjs +22 -14
  48. package/fesm2022/daffodil-design-tabs.mjs.map +1 -1
  49. package/fesm2022/daffodil-design-tag.mjs +131 -0
  50. package/fesm2022/daffodil-design-tag.mjs.map +1 -0
  51. package/fesm2022/daffodil-design-toast.mjs +56 -55
  52. package/fesm2022/daffodil-design-toast.mjs.map +1 -1
  53. package/fesm2022/daffodil-design-tree.mjs +4 -13
  54. package/fesm2022/daffodil-design-tree.mjs.map +1 -1
  55. package/fesm2022/daffodil-design.mjs +250 -774
  56. package/fesm2022/daffodil-design.mjs.map +1 -1
  57. package/form/README.md +75 -0
  58. package/form/index.d.ts +27 -0
  59. package/form-field/README.md +49 -39
  60. package/form-field/index.d.ts +58 -76
  61. package/image/README.md +27 -19
  62. package/image/index.d.ts +6 -1
  63. package/index.d.ts +180 -424
  64. package/input/README.md +32 -12
  65. package/modal/README.md +106 -16
  66. package/modal/index.d.ts +50 -21
  67. package/native-select/README.md +52 -15
  68. package/notification/index.d.ts +7 -38
  69. package/package.json +1 -1
  70. package/paginator/index.d.ts +1 -7
  71. package/radio/README.md +52 -0
  72. package/radio/index.d.ts +160 -0
  73. package/scss/core/error/error-to-string.scss +6 -6
  74. package/scss/core/map/map-get/map-get.scss +3 -3
  75. package/scss/layout/_breakpoint.scss +1 -1
  76. package/scss/theme.scss +4 -4
  77. package/scss/theming/_color-palettes.scss +21 -7
  78. package/scss/theming/_configure-theme.scss +11 -10
  79. package/scss/theming/_daff-theme.scss +5 -14
  80. package/scss/theming/_get-base-color.scss +2 -2
  81. package/scss/theming/_get-palette.scss +2 -2
  82. package/scss/theming/_get-theme-mode.scss +3 -3
  83. package/scss/theming/_index.scss +2 -1
  84. package/scss/theming/contrast/_index.scss +1 -0
  85. package/scss/theming/contrast/max-contrast/max-contrast.scss +47 -0
  86. package/scss/theming/contrast/max-contrast/max-contrast.spec.scss +57 -0
  87. package/scss/theming/contrast/text-contrast/text-contrast.scss +22 -16
  88. package/scss/theming/contrast/text-contrast/text-contrast.spec.scss +57 -0
  89. package/scss/theming/create-theme/_create-theme.scss +330 -0
  90. package/scss/theming/create-theme/_create-theme.spec.scss +122 -0
  91. package/scss/theming/create-theme/_index.scss +1 -0
  92. package/scss/theming/get-font-colors/_get-font-colors.scss +36 -0
  93. package/scss/theming/get-font-colors/_get-font-colors.spec.scss +72 -0
  94. package/scss/typography/mixins/_font-weight.scss +8 -14
  95. package/select/README.md +107 -4
  96. package/sidebar/README.md +0 -8
  97. package/sidebar/index.d.ts +3 -15
  98. package/switch/README.md +19 -27
  99. package/switch/index.d.ts +18 -48
  100. package/switch/src/switch-theme.scss +26 -18
  101. package/tabs/index.d.ts +7 -4
  102. package/tag/README.md +87 -0
  103. package/tag/index.d.ts +71 -0
  104. package/tag/src/tag-theme.scss +137 -0
  105. package/textarea/README.md +35 -5
  106. package/tree/index.d.ts +0 -6
  107. package/tree/src/tree-theme.scss +0 -4
  108. package/accordion/examples/index.d.ts +0 -20
  109. package/article/examples/index.d.ts +0 -50
  110. package/breadcrumb/examples/index.d.ts +0 -10
  111. package/button/examples/index.d.ts +0 -67
  112. package/callout/examples/index.d.ts +0 -41
  113. package/card/examples/index.d.ts +0 -62
  114. package/card/src/card/raised/raised-theme.scss +0 -28
  115. package/checkbox/examples/index.d.ts +0 -32
  116. package/container/examples/index.d.ts +0 -16
  117. package/fesm2022/daffodil-design-accordion-examples.mjs +0 -50
  118. package/fesm2022/daffodil-design-accordion-examples.mjs.map +0 -1
  119. package/fesm2022/daffodil-design-article-examples.mjs +0 -134
  120. package/fesm2022/daffodil-design-article-examples.mjs.map +0 -1
  121. package/fesm2022/daffodil-design-breadcrumb-examples.mjs +0 -46
  122. package/fesm2022/daffodil-design-breadcrumb-examples.mjs.map +0 -1
  123. package/fesm2022/daffodil-design-button-examples.mjs +0 -178
  124. package/fesm2022/daffodil-design-button-examples.mjs.map +0 -1
  125. package/fesm2022/daffodil-design-callout-examples.mjs +0 -116
  126. package/fesm2022/daffodil-design-callout-examples.mjs.map +0 -1
  127. package/fesm2022/daffodil-design-card-examples.mjs +0 -168
  128. package/fesm2022/daffodil-design-card-examples.mjs.map +0 -1
  129. package/fesm2022/daffodil-design-checkbox-examples.mjs +0 -76
  130. package/fesm2022/daffodil-design-checkbox-examples.mjs.map +0 -1
  131. package/fesm2022/daffodil-design-container-examples.mjs +0 -41
  132. package/fesm2022/daffodil-design-container-examples.mjs.map +0 -1
  133. package/fesm2022/daffodil-design-form-field-examples.mjs +0 -96
  134. package/fesm2022/daffodil-design-form-field-examples.mjs.map +0 -1
  135. package/fesm2022/daffodil-design-hero-examples.mjs +0 -121
  136. package/fesm2022/daffodil-design-hero-examples.mjs.map +0 -1
  137. package/fesm2022/daffodil-design-image-examples.mjs +0 -58
  138. package/fesm2022/daffodil-design-image-examples.mjs.map +0 -1
  139. package/fesm2022/daffodil-design-input-examples.mjs +0 -108
  140. package/fesm2022/daffodil-design-input-examples.mjs.map +0 -1
  141. package/fesm2022/daffodil-design-list-examples.mjs +0 -77
  142. package/fesm2022/daffodil-design-list-examples.mjs.map +0 -1
  143. package/fesm2022/daffodil-design-loading-icon-examples.mjs +0 -44
  144. package/fesm2022/daffodil-design-loading-icon-examples.mjs.map +0 -1
  145. package/fesm2022/daffodil-design-media-gallery-examples.mjs +0 -104
  146. package/fesm2022/daffodil-design-media-gallery-examples.mjs.map +0 -1
  147. package/fesm2022/daffodil-design-menu-examples.mjs +0 -50
  148. package/fesm2022/daffodil-design-menu-examples.mjs.map +0 -1
  149. package/fesm2022/daffodil-design-modal-examples.mjs +0 -51
  150. package/fesm2022/daffodil-design-modal-examples.mjs.map +0 -1
  151. package/fesm2022/daffodil-design-native-select-examples.mjs +0 -71
  152. package/fesm2022/daffodil-design-native-select-examples.mjs.map +0 -1
  153. package/fesm2022/daffodil-design-navbar-examples.mjs +0 -88
  154. package/fesm2022/daffodil-design-navbar-examples.mjs.map +0 -1
  155. package/fesm2022/daffodil-design-notification-examples.mjs +0 -102
  156. package/fesm2022/daffodil-design-notification-examples.mjs.map +0 -1
  157. package/fesm2022/daffodil-design-paginator-examples.mjs +0 -59
  158. package/fesm2022/daffodil-design-paginator-examples.mjs.map +0 -1
  159. package/fesm2022/daffodil-design-progress-bar-examples.mjs +0 -57
  160. package/fesm2022/daffodil-design-progress-bar-examples.mjs.map +0 -1
  161. package/fesm2022/daffodil-design-quantity-field-examples.mjs +0 -85
  162. package/fesm2022/daffodil-design-quantity-field-examples.mjs.map +0 -1
  163. package/fesm2022/daffodil-design-radio-examples.mjs +0 -31
  164. package/fesm2022/daffodil-design-radio-examples.mjs.map +0 -1
  165. package/fesm2022/daffodil-design-select-examples.mjs +0 -117
  166. package/fesm2022/daffodil-design-select-examples.mjs.map +0 -1
  167. package/fesm2022/daffodil-design-sidebar-examples.mjs +0 -109
  168. package/fesm2022/daffodil-design-sidebar-examples.mjs.map +0 -1
  169. package/fesm2022/daffodil-design-sticky-examples.mjs +0 -25
  170. package/fesm2022/daffodil-design-sticky-examples.mjs.map +0 -1
  171. package/fesm2022/daffodil-design-switch-examples.mjs +0 -110
  172. package/fesm2022/daffodil-design-switch-examples.mjs.map +0 -1
  173. package/fesm2022/daffodil-design-tabs-examples.mjs +0 -115
  174. package/fesm2022/daffodil-design-tabs-examples.mjs.map +0 -1
  175. package/fesm2022/daffodil-design-text-snippet-examples.mjs +0 -25
  176. package/fesm2022/daffodil-design-text-snippet-examples.mjs.map +0 -1
  177. package/fesm2022/daffodil-design-textarea-examples.mjs +0 -66
  178. package/fesm2022/daffodil-design-textarea-examples.mjs.map +0 -1
  179. package/fesm2022/daffodil-design-toast-examples.mjs +0 -147
  180. package/fesm2022/daffodil-design-toast-examples.mjs.map +0 -1
  181. package/fesm2022/daffodil-design-tree-examples.mjs +0 -104
  182. package/fesm2022/daffodil-design-tree-examples.mjs.map +0 -1
  183. package/form-field/examples/index.d.ts +0 -18
  184. package/hero/examples/index.d.ts +0 -45
  185. package/image/examples/index.d.ts +0 -10
  186. package/input/examples/index.d.ts +0 -10
  187. package/list/examples/index.d.ts +0 -29
  188. package/loading-icon/examples/index.d.ts +0 -16
  189. package/media-gallery/examples/index.d.ts +0 -38
  190. package/menu/examples/index.d.ts +0 -20
  191. package/modal/examples/index.d.ts +0 -15
  192. package/native-select/examples/index.d.ts +0 -10
  193. package/navbar/examples/index.d.ts +0 -31
  194. package/notification/examples/index.d.ts +0 -12
  195. package/paginator/examples/index.d.ts +0 -26
  196. package/progress-bar/examples/index.d.ts +0 -10
  197. package/quantity-field/examples/index.d.ts +0 -30
  198. package/radio/examples/index.d.ts +0 -13
  199. package/select/examples/index.d.ts +0 -28
  200. package/sidebar/examples/index.d.ts +0 -10
  201. package/sticky/examples/index.d.ts +0 -10
  202. package/switch/examples/index.d.ts +0 -46
  203. package/tabs/examples/index.d.ts +0 -12
  204. package/text-snippet/examples/index.d.ts +0 -10
  205. package/textarea/examples/index.d.ts +0 -10
  206. package/toast/examples/index.d.ts +0 -56
  207. package/tree/examples/index.d.ts +0 -18
  208. /package/{form-field → form}/src/error-message/error-message-theme.scss +0 -0
  209. /package/{form-field → form}/src/hint/hint-theme.scss +0 -0
@@ -2,13 +2,14 @@
2
2
  Form field is a wrapping component that provides consistent styling and behavior for form control elements.
3
3
 
4
4
  ## Overview
5
- It's used to style certain controls that would otherwise be impossible to style with normal css and organize labels, hints, and error messages alongside their associated form controls.
5
+ It's used to style certain controls that would otherwise be impossible to style with normal CSS and organize labels, hints, and error messages alongside their associated form controls.
6
6
 
7
7
  The following Daffodil Design components are designed to work inside a form field:
8
8
 
9
9
  - [Native Input](/libs/design/input/README.md)
10
10
  - [Native Select](/libs/design/native-select/README.md)
11
11
  - [Native Textarea](/libs/design/textarea/README.md)
12
+ - [Custom Select](/libs/design/select/README.md)
12
13
 
13
14
  ## Usage
14
15
 
@@ -50,17 +51,13 @@ import { CustomComponent } from './custom.component';
50
51
  export class CustomComponentModule { }
51
52
  ```
52
53
 
53
- > Deprecation notice: This method is deprecated. It's recommended to update all custom components to standalone.
54
+ > **Warning**
55
+ >
56
+ > This method is deprecated. It's recommended to update all custom components to standalone.
54
57
 
55
- ## Appearances
56
- Form field supports two `appearances`: `fluid` and `fixed`. It will default to `fluid` if an `appearance` is not specified.
57
-
58
- - `fluid`: alternate, stylized UI where the label is placed inside of the form control.
59
- - `fixed`: corresponds with a traditional style where the label is positioned outside and above the form control.
58
+ ## Anatomy
60
59
 
61
- <design-land-example-viewer-container example="form-field-appearances"></design-land-example-viewer-container>
62
-
63
- ## Labels
60
+ ### Labels
64
61
  Use `<daff-form-label>` to help users understand what information to enter into a form control. Form fields should always have labels. If a form control is marked as required, an asterisk will be attached to the label to indicate that it's a required field.
65
62
 
66
63
  ```html
@@ -70,21 +67,11 @@ Use `<daff-form-label>` to help users understand what information to enter into
70
67
  </daff-form-field>
71
68
  ```
72
69
 
73
- > Deprecation notice: The `DaffFormLabelDirective` (using `daffFormLabel` on `<label>`) is deprecated and will be removed in `v1.0.0`. Use `<daff-form-label>` instead for new implementations.
74
-
75
- ## Setting a custom ID
76
- The `id` property allows you to set a custom identifier for the form field. While auto-labelling is supported for native HTML form elements (e.g. `<input>`, `<select>`, and `<textarea>`) to ensure that accessibility is baked into the component, it's recommended to set meaningful, custom IDs for better accessibility and form management.
70
+ > **Warning**
71
+ >
72
+ > The `DaffFormLabelDirective` (using `daffFormLabel` on `<label>`) is deprecated and will be removed in `v1.0.0`. Use `<daff-form-label>` instead for new implementations.
77
73
 
78
- ```html
79
- <daff-form-field id="user-email-address">
80
- <daff-form-label>Email Address</daff-form-label>
81
- <input daff-input type="email" />
82
- </daff-form-field>
83
- ```
84
-
85
- > When you provide a custom `id`, the `<daff-form-label>` automatically gets the correct `for` attribute that matches the control's `id`.
86
-
87
- ## Hints
74
+ ### Hints
88
75
  Hints are shown below the form field and are used to provide helpful information that assists users in correctly completing a field.
89
76
 
90
77
  ```html
@@ -95,7 +82,6 @@ Hints are shown below the form field and are used to provide helpful information
95
82
  </daff-form-field>
96
83
  ```
97
84
 
98
- ### Validated hints
99
85
  Use the `validated` property to show hints with validation styling:
100
86
 
101
87
  ```html
@@ -106,7 +92,7 @@ Use the `validated` property to show hints with validation styling:
106
92
  </daff-form-field>
107
93
  ```
108
94
 
109
- ## Errors
95
+ ### Errors
110
96
  Error messages are used to display validation errors. They are shown under the form field and are placed last if hints are also used.
111
97
 
112
98
  ```html
@@ -119,23 +105,47 @@ Error messages are used to display validation errors. They are shown under the f
119
105
  </daff-form-field>
120
106
  ```
121
107
 
122
- ## Action
123
- Use the `[daffFormFieldAction]` directive to add an action element to a form field.
108
+ ### Action
109
+ Use the `[daffFormFieldAction]` element to add an action element to a form field.
124
110
 
125
111
  - Fluid appearance: The action is positioned within the form control's UI.
126
112
  - Fixed appearance: The action is positioned adjacent to the form control's UI.
127
113
 
128
114
  <design-land-example-viewer-container example="form-field-with-action"></design-land-example-viewer-container>
129
115
 
130
- ## Prefix and suffix
131
- Use the `[daffPrefix]` and `[daffSuffix]` directives to display leading or trailing visuals, typically icons, on either side of the form control.
116
+ ### Prefix and suffix
117
+ Use the `[daffPrefix]` and `[daffSuffix]` elements to display leading or trailing visuals, typically icons, on either side of the form control.
132
118
 
119
+ > **Note**
120
+ >
133
121
  > In a fluid appearance, avoid using suffix alongside an action.
134
122
 
135
123
  <design-land-example-viewer-container example="form-field-with-prefix"></design-land-example-viewer-container>
136
124
 
137
125
  <design-land-example-viewer-container example="form-field-with-suffix"></design-land-example-viewer-container>
138
126
 
127
+ ## Appearances
128
+ Form field supports two `appearances`: `fluid` and `fixed`. It will default to `fluid` if an `appearance` is not specified.
129
+
130
+ - `fluid`: alternate, stylized UI where the label is placed inside of the form control.
131
+ - `fixed`: corresponds with a traditional style where the label is positioned outside and above the form control.
132
+
133
+ <design-land-example-viewer-container example="form-field-appearances"></design-land-example-viewer-container>
134
+
135
+ ## Setting a custom ID
136
+ Form fields automatically generate IDs to handle accessibility. You can override this by setting a custom `id` on the form field when needed for specific labeling requirements.
137
+
138
+ ```html
139
+ <daff-form-field id="user-email-address">
140
+ <daff-form-label>Email Address</daff-form-label>
141
+ <input daff-input type="email" />
142
+ </daff-form-field>
143
+ ```
144
+
145
+ > **Note**
146
+ >
147
+ > When you provide a custom `id`, the `<daff-form-label>` automatically gets the correct `for` attribute that matches the control's `id`.
148
+
139
149
  ## Creating a custom form field control
140
150
  In addition to the controls that Daffodil Design provides, you can create your own custom control by using the `DaffFormFieldControl` interface.
141
151
 
@@ -161,14 +171,15 @@ export class CustomControlComponent implements DaffFormFieldControl<any> {}
161
171
 
162
172
  ## Accessibility
163
173
 
164
- ### Auto-labelling support
165
- For controls that support auto-labelling, the component automatically:
174
+ ### Daffodil provides
166
175
 
167
- - Associates labels with controls using `for` and `id` attributes.
168
- - Provides proper ARIA relationships.
169
- - Warns in development mode if proper labelling is missing.
176
+ - `<daff-hint>` and `<daff-error-message>` are linked to the form control via `aria-describedby`.
177
+ - `<daff-error-message>` is set to `aria-live="polite"` by default so that assistive technology only announce errors when they appear.
178
+ - For controls that support auto-labelling, the component automatically associates labels with controls using `for` and `id` attributes.
170
179
 
171
- If a `<daff-form-label>` is not specified, use the `label` element to associate text with form elements explicitly. The `for` attribute of the label must exactly match the `id` of the form control.
180
+ > **Note**
181
+ >
182
+ > If a `<daff-form-label>` is not specified, use the `<label>` element to associate text with form elements explicitly. The `for` attribute of the label must exactly match the `id` of the form control.
172
183
 
173
184
  ```html
174
185
  <daff-form-field>
@@ -177,9 +188,8 @@ If a `<daff-form-label>` is not specified, use the `label` element to associate
177
188
  </daff-form-field>
178
189
  ```
179
190
 
180
- ### ARIA support
181
- - `<daff-hint>` and `<daff-error-message>` are linked to the form control via `aria-describedby`.
182
- - `<daff-error-message>` is set to `aria-live="polite"` by default so that assistive technology only announce errors when they appear.
191
+ ### Developer responsibilities
192
+ - Always provide labels for accessibility. Use `<daff-form-label>` within `<daff-form-field>` for the best experience with auto-labelling controls.
183
193
 
184
194
  ## Troubleshooting
185
195
 
@@ -1,7 +1,9 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { AfterContentInit, AfterContentChecked, AfterViewInit, ElementRef, ChangeDetectorRef } from '@angular/core';
3
- import * as i4 from '@daffodil/design';
3
+ import * as i3 from '@daffodil/design';
4
4
  import { DaffPrefixDirective, DaffSuffixDirective, DaffFormLabelDirective } from '@daffodil/design';
5
+ import * as i2 from '@daffodil/design/form';
6
+ import { DaffFormFieldLabelDirective, DaffHintComponent, DaffErrorMessageComponent } from '@daffodil/design/form';
5
7
  import { NgControl } from '@angular/forms';
6
8
  import { BehaviorSubject, Observable } from 'rxjs';
7
9
 
@@ -23,28 +25,63 @@ interface DaffFormFieldState {
23
25
  }
24
26
 
25
27
  /**
28
+ * An abstract class that form controls must implement to be used with the DaffFormFieldComponent.
26
29
  *
27
- * The class that a form control must **implement** in order to be
28
- * used with the DaffFormFieldComponent.
30
+ * > **Note**
31
+ * > 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.
29
32
  *
30
- * You may ask: "Why are you implementing an abstract class, not extending it?"
31
- * We do this so that the Angular DI container can match the class token. A typical
32
- * interface would be "more accurate" here, but since interfaces don't exist
33
- * in javascript, they get thrown out by the typescript compiler and cannot
34
- * be used for the necessary dependency injection.
33
+ * > By using an abstract class, the Angular DI container can match the class token for injection.
35
34
  */
36
35
  declare abstract class DaffFormFieldControl<T> {
37
36
  ngControl: NgControl | null;
37
+ /**
38
+ * The type of the control (e.g., 'input', 'select', 'textarea').
39
+ * Used to apply control-specific styling or behavior.
40
+ */
38
41
  abstract readonly controlType?: any;
42
+ /**
43
+ * Whether the control supports automatic label behavior.
44
+ * When `true`, the form field will associate the label with the control using `for` and `id` attributes.
45
+ *
46
+ * Defaults to `true`.
47
+ */
39
48
  readonly supportsAutoLabelling?: boolean;
49
+ /**
50
+ * Whether the control currently has focus.
51
+ */
40
52
  abstract readonly focused: boolean;
53
+ /**
54
+ * Whether the control is required for form validation.
55
+ */
41
56
  abstract readonly required: boolean;
57
+ /**
58
+ * Whether the control is disabled.
59
+ */
42
60
  abstract readonly disabled: boolean;
61
+ /**
62
+ * The unique identifier for the control element.
63
+ */
43
64
  readonly id?: string;
65
+ /**
66
+ * Whether the label should be in the raised position.
67
+ * By default, matches the focused state.
68
+ */
44
69
  get raised(): boolean;
70
+ /**
71
+ * Sets focus on the control.
72
+ *
73
+ * @param event - Optional event that triggers the focus.
74
+ */
45
75
  abstract focus(event?: Event): void;
76
+ /**
77
+ * The current value of the control.
78
+ */
46
79
  abstract readonly value: T;
47
80
  constructor(ngControl: NgControl | null);
81
+ /**
82
+ * Computes the current state of the form field control.
83
+ * Combines control properties and form validation state.
84
+ */
48
85
  get state(): DaffFormFieldState;
49
86
  _stateChanges: BehaviorSubject<{
50
87
  focused: boolean;
@@ -53,40 +90,27 @@ declare abstract class DaffFormFieldControl<T> {
53
90
  error: boolean;
54
91
  valid: boolean;
55
92
  }>;
93
+ /**
94
+ * Observable stream of state changes for the form field control.
95
+ */
56
96
  stateChanges: Observable<DaffFormFieldState>;
97
+ /**
98
+ * Emits the current state.
99
+ */
57
100
  emitState(deferred?: boolean): void;
58
101
  }
59
102
 
60
- declare class DaffFormFieldLabelDirective {
61
- static ɵfac: i0.ɵɵFactoryDeclaration<DaffFormFieldLabelDirective, never>;
62
- static ɵdir: i0.ɵɵDirectiveDeclaration<DaffFormFieldLabelDirective, "daff-form-label", never, {}, {}, never, never, true, never>;
63
- }
64
-
65
103
  type DaffFormFieldApperanace = 'fluid' | 'fixed';
66
104
  declare class DaffFormFieldComponent implements AfterContentInit, AfterContentChecked, AfterViewInit {
67
105
  private cd;
68
106
  elementRef: ElementRef;
69
107
  /** @docs-private */
70
- class: boolean;
71
- /** @docs-private */
72
- get isSelectField(): boolean;
73
- /**
74
- * @docs-private
75
- */
76
- get selectClass(): boolean;
108
+ get isNativeSelect(): boolean;
77
109
  constructor(cd: ChangeDetectorRef, elementRef: ElementRef);
78
110
  /** @docs-private */
79
111
  _prefix: DaffPrefixDirective;
80
- /**
81
- * @docs-private
82
- */
83
- get hasPrefixClass(): DaffPrefixDirective;
84
112
  /** @docs-private */
85
113
  _suffix: DaffSuffixDirective;
86
- /**
87
- * @docs-private
88
- */
89
- get hasSuffixClass(): DaffSuffixDirective | DaffFormFieldActionDirective;
90
114
  /**
91
115
  * @docs-private
92
116
  *
@@ -121,10 +145,6 @@ declare class DaffFormFieldComponent implements AfterContentInit, AfterContentCh
121
145
  * form field should be marked as error.
122
146
  */
123
147
  isError: boolean;
124
- /**
125
- * @docs-private
126
- */
127
- get errorClass(): boolean;
128
148
  /**
129
149
  * @docs-private
130
150
  *
@@ -139,10 +159,6 @@ declare class DaffFormFieldComponent implements AfterContentInit, AfterContentCh
139
159
  * form field should be marked as disabled.
140
160
  */
141
161
  isDisabled: boolean;
142
- /**
143
- * @docs-private
144
- */
145
- get disabledClass(): boolean;
146
162
  /**
147
163
  * @docs-private
148
164
  *
@@ -150,10 +166,6 @@ declare class DaffFormFieldComponent implements AfterContentInit, AfterContentCh
150
166
  * form field should be marked as valid.
151
167
  */
152
168
  isValid: boolean;
153
- /**
154
- * @docs-private
155
- */
156
- get validClass(): boolean;
157
169
  /**
158
170
  * @docs-private
159
171
  *
@@ -163,25 +175,13 @@ declare class DaffFormFieldComponent implements AfterContentInit, AfterContentCh
163
175
  /**
164
176
  * @docs-private
165
177
  */
166
- get focusedClass(): boolean;
167
- /**
168
- * @docs-private
169
- */
170
- get raisedClass(): boolean;
178
+ get isRaised(): boolean;
171
179
  private _appearance;
172
180
  /**
173
- * The appearance style of a form field, whether the label is fluid or fixed.
181
+ * The appearance style of a form field, whether the label is `fluid` or `fixed`.
174
182
  */
175
183
  get appearance(): DaffFormFieldApperanace;
176
184
  set appearance(value: DaffFormFieldApperanace);
177
- /**
178
- * @docs-private
179
- */
180
- get fluidClass(): boolean;
181
- /**
182
- * @docs-private
183
- */
184
- get fixedClass(): boolean;
185
185
  /**
186
186
  * @docs-private
187
187
  */
@@ -244,25 +244,7 @@ declare class DaffFormFieldComponent implements AfterContentInit, AfterContentCh
244
244
  */
245
245
  ngAfterContentChecked(): void;
246
246
  static ɵfac: i0.ɵɵFactoryDeclaration<DaffFormFieldComponent, never>;
247
- static ɵcmp: i0.ɵɵComponentDeclaration<DaffFormFieldComponent, "daff-form-field", never, { "appearance": { "alias": "appearance"; "required": false; }; "id": { "alias": "id"; "required": false; }; }, {}, ["_prefix", "_suffix", "_control", "_formLabelDirective", "_formFieldLabelDirective", "_action", "_hint", "_error"], ["*", "[daffPrefix]", "*", "[daffSuffix]", "daff-hint", "daff-error-message", "[daffFormFieldAction]", "label[daffFormLabel]", "daff-form-label", "label"], true, [{ directive: typeof i4.DaffSkeletonableDirective; inputs: { "skeleton": "skeleton"; }; outputs: {}; }]>;
248
- }
249
-
250
- declare class DaffErrorMessageComponent {
251
- static ɵfac: i0.ɵɵFactoryDeclaration<DaffErrorMessageComponent, never>;
252
- static ɵcmp: i0.ɵɵComponentDeclaration<DaffErrorMessageComponent, "daff-error-message", never, {}, {}, never, ["*"], true, never>;
253
- }
254
-
255
- declare class DaffHintComponent {
256
- /**
257
- * @docs-private
258
- */
259
- class: boolean;
260
- /**
261
- * Displays a validated hint UI.
262
- * */
263
- validated: boolean;
264
- static ɵfac: i0.ɵɵFactoryDeclaration<DaffHintComponent, never>;
265
- static ɵcmp: i0.ɵɵComponentDeclaration<DaffHintComponent, "daff-hint", never, { "validated": { "alias": "validated"; "required": false; }; }, {}, never, ["*"], true, never>;
247
+ static ɵcmp: i0.ɵɵComponentDeclaration<DaffFormFieldComponent, "daff-form-field", never, { "appearance": { "alias": "appearance"; "required": false; }; "id": { "alias": "id"; "required": false; }; }, {}, ["_prefix", "_suffix", "_control", "_formLabelDirective", "_formFieldLabelDirective", "_action", "_hint", "_error"], ["*", "[daffPrefix]", "*", "[daffSuffix]", "daff-hint", "daff-error-message", "[daffFormFieldAction]", "label[daffFormLabel]", "daff-form-label", "label"], true, [{ directive: typeof i3.DaffSkeletonableDirective; inputs: { "skeleton": "skeleton"; }; outputs: {}; }]>;
266
248
  }
267
249
 
268
250
  /**
@@ -270,13 +252,13 @@ declare class DaffHintComponent {
270
252
  */
271
253
  declare class DaffFormFieldModule {
272
254
  static ɵfac: i0.ɵɵFactoryDeclaration<DaffFormFieldModule, never>;
273
- static ɵmod: i0.ɵɵNgModuleDeclaration<DaffFormFieldModule, never, [typeof DaffFormFieldComponent, typeof DaffErrorMessageComponent, typeof DaffHintComponent, typeof i4.DaffFormLabelModule], [typeof DaffFormFieldComponent, typeof DaffErrorMessageComponent, typeof DaffHintComponent, typeof i4.DaffFormLabelModule]>;
255
+ static ɵmod: i0.ɵɵNgModuleDeclaration<DaffFormFieldModule, never, [typeof DaffFormFieldComponent, typeof i2.DaffErrorMessageComponent, typeof i2.DaffHintComponent, typeof i2.DaffFormFieldLabelDirective, typeof i3.DaffFormLabelModule], [typeof DaffFormFieldComponent, typeof i2.DaffErrorMessageComponent, typeof i2.DaffHintComponent, typeof i2.DaffFormFieldLabelDirective, typeof i3.DaffFormLabelModule]>;
274
256
  static ɵinj: i0.ɵɵInjectorDeclaration<DaffFormFieldModule>;
275
257
  }
276
258
 
277
259
  /**
278
260
  * @docs-private
279
261
  */
280
- declare const DAFF_FORM_FIELD_COMPONENTS: readonly [typeof DaffFormFieldComponent, typeof DaffErrorMessageComponent, typeof DaffFormLabelDirective, typeof DaffHintComponent, typeof DaffPrefixDirective, typeof DaffSuffixDirective, typeof DaffFormFieldLabelDirective, typeof DaffFormFieldActionDirective];
262
+ declare const DAFF_FORM_FIELD_COMPONENTS: readonly [typeof DaffFormFieldComponent, typeof DaffFormLabelDirective, typeof DaffPrefixDirective, typeof DaffSuffixDirective, typeof DaffFormFieldActionDirective, typeof DaffHintComponent, typeof DaffFormFieldLabelDirective, typeof DaffErrorMessageComponent];
281
263
 
282
- export { DAFF_FORM_FIELD_COMPONENTS, DaffErrorMessageComponent, DaffFormFieldActionDirective, DaffFormFieldComponent, DaffFormFieldControl, DaffFormFieldLabelDirective, DaffFormFieldModule, DaffHintComponent };
264
+ export { DAFF_FORM_FIELD_COMPONENTS, DaffFormFieldActionDirective, DaffFormFieldComponent, DaffFormFieldControl, DaffFormFieldModule };
package/image/README.md CHANGED
@@ -1,15 +1,14 @@
1
1
  # Image
2
- Image utilizes the native HTML `<img>` element to display responsive images on a page and prevent content jumping while images are loading.
2
+ Image has built-in performance and accessibility optimizations that allow users to easily display responsive images.
3
3
 
4
4
  ## Overview
5
- `<daff-image>` is an opinionated version that encourages friendly end-user usage.
5
+ Image builds on Angular's [`NgOptimizedImage`](https://angular.dev/guide/image-optimization) to provide responsive images with stable layouts out of the box. It helps to avoid common image-related performance and accessibility issues by:
6
6
 
7
- <design-land-example-viewer-container example="load-image"></design-land-example-viewer-container>
7
+ - Preventing layout shift with required `width` and `height` attributes
8
+ - Ensuring accessibility by requiring descriptive `alt` text
9
+ - Maintaining proper aspect ratios for responsive designs
8
10
 
9
- ## Attributes
10
- The `src`, `width`, `height`, and `alt` attributes must be defined. An error will be thrown any of these attributes are missing.
11
-
12
- `width` and `height` are required to calculate the aspect ratio of an image, used for the [aspect ratio padding trick](https://css-tricks.com/aspect-ratio-boxes/) that helps to prevent content jumping while images are loading. The `width` and `height` values are rendered as pixels.
11
+ <design-land-example-viewer-container example="basic-image"></design-land-example-viewer-container>
13
12
 
14
13
  ## Usage
15
14
 
@@ -17,6 +16,7 @@ The `src`, `width`, `height`, and `alt` attributes must be defined. An error wil
17
16
  To use image in a standalone component, import `DAFF_IMAGE_COMPONENTS` directly into your custom component:
18
17
 
19
18
  ```ts
19
+ import { Component } from '@angular/core';
20
20
  import { DAFF_IMAGE_COMPONENTS } from '@daffodil/design/image';
21
21
 
22
22
  @Component({
@@ -38,7 +38,7 @@ import { DaffImageModule } from '@daffodil/design/image';
38
38
  import { CustomComponent } from './custom.component';
39
39
 
40
40
  @NgModule({
41
- declarations: [
41
+ declarations: [
42
42
  CustomComponent,
43
43
  ],
44
44
  exports: [
@@ -51,21 +51,29 @@ import { CustomComponent } from './custom.component';
51
51
  export class CustomComponentModule { }
52
52
  ```
53
53
 
54
+ > **Warning**
55
+ >
54
56
  > This method is deprecated. It's recommended to update all custom components to standalone.
55
57
 
56
- ## Errors
58
+ ## Required attributes
59
+ All four of the following attributes are required and will throw an error if missing:
60
+
61
+ | Attribute | Description |
62
+ | --------- | ----------- |
63
+ | `src` | The image source URL |
64
+ | `alt` | Alternative text describing the image |
65
+ | `width` | The intrinsic width of the image in pixels |
66
+ | `height` | The intrinsic height of the image in pixels |
57
67
 
58
- **DaffImageComponent must have a defined src attribute.**
59
- This error appears when `<daff-image>` is missing a `src` attribute.
68
+ ## Features
60
69
 
61
- **DaffImageComponent must have a defined alt attribute.**
62
- This error appears when `<daff-image>` is missing an `alt` attribute. The `alt` tag specifies an alternate text for an image.
70
+ ## Skeleton screen
71
+ Use the `skeleton` property to display a placeholder skeleton screen that helps reduce load-time frustration.
63
72
 
64
- **DaffImageComponent must have a defined width attribute.**
65
- This error appears when `<daff-image>` is missing a `width` attribute. The width must be defined in order to correctly calculate the aspect ratio of the image.
73
+ <design-land-example-viewer-container example="skeleton-image"></design-land-example-viewer-container>
66
74
 
67
- **DaffImageComponent must have a defined height attribute.**
68
- This error appears when `<daff-image>` is missing a `height` attribute. The height must be defined in order to correctly calculate the aspect ratio of the image.
75
+ ## Priority loading
76
+ Use the `priority` property to mark an image as a priority for loading. Priority images are loaded eagerly and not lazy-loaded.
69
77
 
70
- ## Accessbility
71
- Images should be given a meaningful description using the native `alt` attribute to ensure an accessible experience by default. An error will be thrown if the `alt` attribute is missing.
78
+ ## Accessibility
79
+ Provide concise, meaningful descriptions that convey the content and purpose of the image by using the `alt` attribute. An error will be thrown if `alt` is missing.
package/image/index.d.ts CHANGED
@@ -30,6 +30,11 @@ declare class DaffImageComponent implements OnInit {
30
30
  */
31
31
  get height(): number;
32
32
  set height(value: number);
33
+ /**
34
+ * Whether the image should be treated as a priority image for loading.
35
+ * Priority images are loaded eagerly and not lazy-loaded.
36
+ */
37
+ priority: i0.InputSignal<boolean>;
33
38
  /**
34
39
  * Emits when the image has loaded.
35
40
  */
@@ -50,7 +55,7 @@ declare class DaffImageComponent implements OnInit {
50
55
  */
51
56
  get _aspectRatio(): SafeStyle;
52
57
  static ɵfac: i0.ɵɵFactoryDeclaration<DaffImageComponent, never>;
53
- static ɵcmp: i0.ɵɵComponentDeclaration<DaffImageComponent, "daff-image", never, { "src": { "alias": "src"; "required": false; }; "alt": { "alias": "alt"; "required": false; }; "width": { "alias": "width"; "required": false; }; "height": { "alias": "height"; "required": false; }; }, { "load": "load"; }, never, never, true, [{ directive: typeof i1.DaffSkeletonableDirective; inputs: { "skeleton": "skeleton"; }; outputs: {}; }]>;
58
+ static ɵcmp: i0.ɵɵComponentDeclaration<DaffImageComponent, "daff-image", never, { "src": { "alias": "src"; "required": false; }; "alt": { "alias": "alt"; "required": false; }; "width": { "alias": "width"; "required": false; }; "height": { "alias": "height"; "required": false; }; "priority": { "alias": "priority"; "required": false; "isSignal": true; }; }, { "load": "load"; }, never, never, true, [{ directive: typeof i1.DaffSkeletonableDirective; inputs: { "skeleton": "skeleton"; }; outputs: {}; }]>;
54
59
  }
55
60
 
56
61
  /**