@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.
- package/README.md +1 -0
- package/accordion/index.d.ts +8 -5
- package/article/README.md +1 -1
- package/article/index.d.ts +20 -0
- package/article/src/article-theme.scss +10 -0
- package/button/index.d.ts +4 -4
- package/button/src/button/button-base.scss +3 -3
- package/button/src/button/raised/raised-theme.scss +6 -16
- package/card/README.md +0 -8
- package/card/index.d.ts +7 -41
- package/card/src/card-base-theme.scss +2 -5
- package/card/src/card-base.scss +2 -2
- package/checkbox/README.md +0 -0
- package/checkbox/index.d.ts +177 -0
- package/fesm2022/daffodil-design-accordion.mjs +23 -14
- package/fesm2022/daffodil-design-accordion.mjs.map +1 -1
- package/fesm2022/daffodil-design-article.mjs +129 -5
- package/fesm2022/daffodil-design-article.mjs.map +1 -1
- package/fesm2022/daffodil-design-button.mjs +24 -20
- package/fesm2022/daffodil-design-button.mjs.map +1 -1
- package/fesm2022/daffodil-design-card.mjs +16 -63
- package/fesm2022/daffodil-design-card.mjs.map +1 -1
- package/fesm2022/daffodil-design-checkbox.mjs +317 -0
- package/fesm2022/daffodil-design-checkbox.mjs.map +1 -0
- package/fesm2022/daffodil-design-form-field.mjs +55 -162
- package/fesm2022/daffodil-design-form-field.mjs.map +1 -1
- package/fesm2022/daffodil-design-form.mjs +62 -0
- package/fesm2022/daffodil-design-form.mjs.map +1 -0
- package/fesm2022/daffodil-design-image.mjs +12 -4
- package/fesm2022/daffodil-design-image.mjs.map +1 -1
- package/fesm2022/daffodil-design-modal.mjs +55 -56
- package/fesm2022/daffodil-design-modal.mjs.map +1 -1
- package/fesm2022/daffodil-design-notification.mjs +14 -50
- package/fesm2022/daffodil-design-notification.mjs.map +1 -1
- package/fesm2022/daffodil-design-paginator.mjs +6 -11
- package/fesm2022/daffodil-design-paginator.mjs.map +1 -1
- package/fesm2022/daffodil-design-quantity-field.mjs +3 -5
- package/fesm2022/daffodil-design-quantity-field.mjs.map +1 -1
- package/fesm2022/daffodil-design-radio.mjs +304 -0
- package/fesm2022/daffodil-design-radio.mjs.map +1 -0
- package/fesm2022/daffodil-design-select.mjs +2 -2
- package/fesm2022/daffodil-design-select.mjs.map +1 -1
- package/fesm2022/daffodil-design-sidebar.mjs +6 -36
- package/fesm2022/daffodil-design-sidebar.mjs.map +1 -1
- package/fesm2022/daffodil-design-switch.mjs +48 -105
- package/fesm2022/daffodil-design-switch.mjs.map +1 -1
- package/fesm2022/daffodil-design-tabs.mjs +22 -14
- package/fesm2022/daffodil-design-tabs.mjs.map +1 -1
- package/fesm2022/daffodil-design-tag.mjs +131 -0
- package/fesm2022/daffodil-design-tag.mjs.map +1 -0
- package/fesm2022/daffodil-design-toast.mjs +56 -55
- package/fesm2022/daffodil-design-toast.mjs.map +1 -1
- package/fesm2022/daffodil-design-tree.mjs +4 -13
- package/fesm2022/daffodil-design-tree.mjs.map +1 -1
- package/fesm2022/daffodil-design.mjs +250 -774
- package/fesm2022/daffodil-design.mjs.map +1 -1
- package/form/README.md +75 -0
- package/form/index.d.ts +27 -0
- package/form-field/README.md +49 -39
- package/form-field/index.d.ts +58 -76
- package/image/README.md +27 -19
- package/image/index.d.ts +6 -1
- package/index.d.ts +180 -424
- package/input/README.md +32 -12
- package/modal/README.md +106 -16
- package/modal/index.d.ts +50 -21
- package/native-select/README.md +52 -15
- package/notification/index.d.ts +7 -38
- package/package.json +1 -1
- package/paginator/index.d.ts +1 -7
- package/radio/README.md +52 -0
- package/radio/index.d.ts +160 -0
- package/scss/core/error/error-to-string.scss +6 -6
- package/scss/core/map/map-get/map-get.scss +3 -3
- package/scss/layout/_breakpoint.scss +1 -1
- package/scss/theme.scss +4 -4
- package/scss/theming/_color-palettes.scss +21 -7
- package/scss/theming/_configure-theme.scss +11 -10
- package/scss/theming/_daff-theme.scss +5 -14
- package/scss/theming/_get-base-color.scss +2 -2
- package/scss/theming/_get-palette.scss +2 -2
- package/scss/theming/_get-theme-mode.scss +3 -3
- package/scss/theming/_index.scss +2 -1
- package/scss/theming/contrast/_index.scss +1 -0
- package/scss/theming/contrast/max-contrast/max-contrast.scss +47 -0
- package/scss/theming/contrast/max-contrast/max-contrast.spec.scss +57 -0
- package/scss/theming/contrast/text-contrast/text-contrast.scss +22 -16
- package/scss/theming/contrast/text-contrast/text-contrast.spec.scss +57 -0
- package/scss/theming/create-theme/_create-theme.scss +330 -0
- package/scss/theming/create-theme/_create-theme.spec.scss +122 -0
- package/scss/theming/create-theme/_index.scss +1 -0
- package/scss/theming/get-font-colors/_get-font-colors.scss +36 -0
- package/scss/theming/get-font-colors/_get-font-colors.spec.scss +72 -0
- package/scss/typography/mixins/_font-weight.scss +8 -14
- package/select/README.md +107 -4
- package/sidebar/README.md +0 -8
- package/sidebar/index.d.ts +3 -15
- package/switch/README.md +19 -27
- package/switch/index.d.ts +18 -48
- package/switch/src/switch-theme.scss +26 -18
- package/tabs/index.d.ts +7 -4
- package/tag/README.md +87 -0
- package/tag/index.d.ts +71 -0
- package/tag/src/tag-theme.scss +137 -0
- package/textarea/README.md +35 -5
- package/tree/index.d.ts +0 -6
- package/tree/src/tree-theme.scss +0 -4
- package/accordion/examples/index.d.ts +0 -20
- package/article/examples/index.d.ts +0 -50
- package/breadcrumb/examples/index.d.ts +0 -10
- package/button/examples/index.d.ts +0 -67
- package/callout/examples/index.d.ts +0 -41
- package/card/examples/index.d.ts +0 -62
- package/card/src/card/raised/raised-theme.scss +0 -28
- package/checkbox/examples/index.d.ts +0 -32
- package/container/examples/index.d.ts +0 -16
- package/fesm2022/daffodil-design-accordion-examples.mjs +0 -50
- package/fesm2022/daffodil-design-accordion-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-article-examples.mjs +0 -134
- package/fesm2022/daffodil-design-article-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-breadcrumb-examples.mjs +0 -46
- package/fesm2022/daffodil-design-breadcrumb-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-button-examples.mjs +0 -178
- package/fesm2022/daffodil-design-button-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-callout-examples.mjs +0 -116
- package/fesm2022/daffodil-design-callout-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-card-examples.mjs +0 -168
- package/fesm2022/daffodil-design-card-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-checkbox-examples.mjs +0 -76
- package/fesm2022/daffodil-design-checkbox-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-container-examples.mjs +0 -41
- package/fesm2022/daffodil-design-container-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-form-field-examples.mjs +0 -96
- package/fesm2022/daffodil-design-form-field-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-hero-examples.mjs +0 -121
- package/fesm2022/daffodil-design-hero-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-image-examples.mjs +0 -58
- package/fesm2022/daffodil-design-image-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-input-examples.mjs +0 -108
- package/fesm2022/daffodil-design-input-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-list-examples.mjs +0 -77
- package/fesm2022/daffodil-design-list-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-loading-icon-examples.mjs +0 -44
- package/fesm2022/daffodil-design-loading-icon-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-media-gallery-examples.mjs +0 -104
- package/fesm2022/daffodil-design-media-gallery-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-menu-examples.mjs +0 -50
- package/fesm2022/daffodil-design-menu-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-modal-examples.mjs +0 -51
- package/fesm2022/daffodil-design-modal-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-native-select-examples.mjs +0 -71
- package/fesm2022/daffodil-design-native-select-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-navbar-examples.mjs +0 -88
- package/fesm2022/daffodil-design-navbar-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-notification-examples.mjs +0 -102
- package/fesm2022/daffodil-design-notification-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-paginator-examples.mjs +0 -59
- package/fesm2022/daffodil-design-paginator-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-progress-bar-examples.mjs +0 -57
- package/fesm2022/daffodil-design-progress-bar-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-quantity-field-examples.mjs +0 -85
- package/fesm2022/daffodil-design-quantity-field-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-radio-examples.mjs +0 -31
- package/fesm2022/daffodil-design-radio-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-select-examples.mjs +0 -117
- package/fesm2022/daffodil-design-select-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-sidebar-examples.mjs +0 -109
- package/fesm2022/daffodil-design-sidebar-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-sticky-examples.mjs +0 -25
- package/fesm2022/daffodil-design-sticky-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-switch-examples.mjs +0 -110
- package/fesm2022/daffodil-design-switch-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-tabs-examples.mjs +0 -115
- package/fesm2022/daffodil-design-tabs-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-text-snippet-examples.mjs +0 -25
- package/fesm2022/daffodil-design-text-snippet-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-textarea-examples.mjs +0 -66
- package/fesm2022/daffodil-design-textarea-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-toast-examples.mjs +0 -147
- package/fesm2022/daffodil-design-toast-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-tree-examples.mjs +0 -104
- package/fesm2022/daffodil-design-tree-examples.mjs.map +0 -1
- package/form-field/examples/index.d.ts +0 -18
- package/hero/examples/index.d.ts +0 -45
- package/image/examples/index.d.ts +0 -10
- package/input/examples/index.d.ts +0 -10
- package/list/examples/index.d.ts +0 -29
- package/loading-icon/examples/index.d.ts +0 -16
- package/media-gallery/examples/index.d.ts +0 -38
- package/menu/examples/index.d.ts +0 -20
- package/modal/examples/index.d.ts +0 -15
- package/native-select/examples/index.d.ts +0 -10
- package/navbar/examples/index.d.ts +0 -31
- package/notification/examples/index.d.ts +0 -12
- package/paginator/examples/index.d.ts +0 -26
- package/progress-bar/examples/index.d.ts +0 -10
- package/quantity-field/examples/index.d.ts +0 -30
- package/radio/examples/index.d.ts +0 -13
- package/select/examples/index.d.ts +0 -28
- package/sidebar/examples/index.d.ts +0 -10
- package/sticky/examples/index.d.ts +0 -10
- package/switch/examples/index.d.ts +0 -46
- package/tabs/examples/index.d.ts +0 -12
- package/text-snippet/examples/index.d.ts +0 -10
- package/textarea/examples/index.d.ts +0 -10
- package/toast/examples/index.d.ts +0 -56
- package/tree/examples/index.d.ts +0 -18
- /package/{form-field → form}/src/error-message/error-message-theme.scss +0 -0
- /package/{form-field → form}/src/hint/hint-theme.scss +0 -0
package/form-field/README.md
CHANGED
|
@@ -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
|
|
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
|
-
>
|
|
54
|
+
> **Warning**
|
|
55
|
+
>
|
|
56
|
+
> This method is deprecated. It's recommended to update all custom components to standalone.
|
|
54
57
|
|
|
55
|
-
##
|
|
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
|
-
|
|
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
|
-
>
|
|
74
|
-
|
|
75
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
123
|
-
Use the `[daffFormFieldAction]`
|
|
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
|
-
|
|
131
|
-
Use the `[daffPrefix]` and `[daffSuffix]`
|
|
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
|
-
###
|
|
165
|
-
For controls that support auto-labelling, the component automatically:
|
|
174
|
+
### Daffodil provides
|
|
166
175
|
|
|
167
|
-
-
|
|
168
|
-
-
|
|
169
|
-
-
|
|
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
|
-
|
|
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
|
-
###
|
|
181
|
-
- `<daff-
|
|
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
|
|
package/form-field/index.d.ts
CHANGED
|
@@ -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
|
|
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
|
-
*
|
|
28
|
-
* used
|
|
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
|
-
*
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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,
|
|
264
|
+
export { DAFF_FORM_FIELD_COMPONENTS, DaffFormFieldActionDirective, DaffFormFieldComponent, DaffFormFieldControl, DaffFormFieldModule };
|
package/image/README.md
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
# Image
|
|
2
|
-
Image
|
|
2
|
+
Image has built-in performance and accessibility optimizations that allow users to easily display responsive images.
|
|
3
3
|
|
|
4
4
|
## Overview
|
|
5
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
##
|
|
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
|
-
|
|
59
|
-
This error appears when `<daff-image>` is missing a `src` attribute.
|
|
68
|
+
## Features
|
|
60
69
|
|
|
61
|
-
|
|
62
|
-
|
|
70
|
+
## Skeleton screen
|
|
71
|
+
Use the `skeleton` property to display a placeholder skeleton screen that helps reduce load-time frustration.
|
|
63
72
|
|
|
64
|
-
|
|
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
|
-
|
|
68
|
-
|
|
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
|
-
##
|
|
71
|
-
|
|
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
|
/**
|