@daffodil/design 0.90.0 → 0.92.3-rc.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/accordion/README.md +26 -38
- package/accordion/index.d.ts +9 -6
- package/article/README.md +66 -46
- package/article/index.d.ts +41 -0
- package/article/src/article-theme.scss +22 -0
- package/breadcrumb/README.md +6 -1
- package/breadcrumb/index.d.ts +65 -11
- package/breadcrumb/src/breadcrumb-theme.scss +1 -1
- package/button/README.md +36 -33
- package/button/index.d.ts +27 -6
- package/button/src/button/basic/button-theme.scss +4 -2
- package/button/src/button/button-base.scss +29 -6
- package/button/src/button/icon/icon-theme.scss +10 -6
- package/button/src/button/raised/raised-theme.scss +6 -4
- package/callout/README.md +15 -27
- package/card/README.md +36 -69
- 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/container/README.md +18 -23
- package/fesm2022/daffodil-design-accordion.mjs +34 -25
- package/fesm2022/daffodil-design-accordion.mjs.map +1 -1
- package/fesm2022/daffodil-design-article.mjs +283 -17
- package/fesm2022/daffodil-design-article.mjs.map +1 -1
- package/fesm2022/daffodil-design-breadcrumb.mjs +180 -28
- package/fesm2022/daffodil-design-breadcrumb.mjs.map +1 -1
- package/fesm2022/daffodil-design-button.mjs +90 -45
- package/fesm2022/daffodil-design-button.mjs.map +1 -1
- package/fesm2022/daffodil-design-callout.mjs +23 -23
- package/fesm2022/daffodil-design-callout.mjs.map +1 -1
- package/fesm2022/daffodil-design-card.mjs +43 -90
- 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-container.mjs +8 -8
- package/fesm2022/daffodil-design-container.mjs.map +1 -1
- package/fesm2022/daffodil-design-form-field.mjs +56 -86
- 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-hero.mjs +23 -23
- package/fesm2022/daffodil-design-hero.mjs.map +1 -1
- package/fesm2022/daffodil-design-image.mjs +19 -11
- package/fesm2022/daffodil-design-image.mjs.map +1 -1
- package/fesm2022/daffodil-design-input.mjs +18 -14
- package/fesm2022/daffodil-design-input.mjs.map +1 -1
- package/fesm2022/daffodil-design-link-set.mjs +25 -17
- package/fesm2022/daffodil-design-link-set.mjs.map +1 -1
- package/fesm2022/daffodil-design-list.mjs +16 -16
- package/fesm2022/daffodil-design-list.mjs.map +1 -1
- package/fesm2022/daffodil-design-loading-icon.mjs +8 -8
- package/fesm2022/daffodil-design-loading-icon.mjs.map +1 -1
- package/fesm2022/daffodil-design-media-gallery.mjs +13 -13
- package/fesm2022/daffodil-design-media-gallery.mjs.map +1 -1
- package/fesm2022/daffodil-design-menu.mjs +223 -60
- package/fesm2022/daffodil-design-menu.mjs.map +1 -1
- package/fesm2022/daffodil-design-modal.mjs +86 -83
- package/fesm2022/daffodil-design-modal.mjs.map +1 -1
- package/fesm2022/daffodil-design-native-select.mjs +47 -41
- package/fesm2022/daffodil-design-native-select.mjs.map +1 -1
- package/fesm2022/daffodil-design-navbar.mjs +25 -21
- package/fesm2022/daffodil-design-navbar.mjs.map +1 -1
- package/fesm2022/daffodil-design-notification.mjs +28 -64
- package/fesm2022/daffodil-design-notification.mjs.map +1 -1
- package/fesm2022/daffodil-design-paginator.mjs +11 -16
- package/fesm2022/daffodil-design-paginator.mjs.map +1 -1
- package/fesm2022/daffodil-design-progress-bar.mjs +10 -10
- package/fesm2022/daffodil-design-progress-bar.mjs.map +1 -1
- package/fesm2022/daffodil-design-quantity-field.mjs +19 -18
- package/fesm2022/daffodil-design-quantity-field.mjs.map +1 -1
- package/fesm2022/daffodil-design-radio.mjs +27 -56
- package/fesm2022/daffodil-design-radio.mjs.map +1 -1
- package/fesm2022/daffodil-design-select.mjs +6 -6
- package/fesm2022/daffodil-design-select.mjs.map +1 -1
- package/fesm2022/daffodil-design-sidebar.mjs +30 -60
- package/fesm2022/daffodil-design-sidebar.mjs.map +1 -1
- package/fesm2022/daffodil-design-spinner.mjs +99 -0
- package/fesm2022/daffodil-design-spinner.mjs.map +1 -0
- package/fesm2022/daffodil-design-switch.mjs +49 -106
- package/fesm2022/daffodil-design-switch.mjs.map +1 -1
- package/fesm2022/daffodil-design-tabs.mjs +35 -27
- package/fesm2022/daffodil-design-tabs.mjs.map +1 -1
- package/fesm2022/daffodil-design-tag.mjs +7 -7
- package/fesm2022/daffodil-design-tag.mjs.map +1 -1
- package/fesm2022/daffodil-design-text-snippet.mjs +6 -8
- package/fesm2022/daffodil-design-text-snippet.mjs.map +1 -1
- package/fesm2022/daffodil-design-textarea.mjs +6 -3
- package/fesm2022/daffodil-design-textarea.mjs.map +1 -1
- package/fesm2022/daffodil-design-toast.mjs +79 -80
- package/fesm2022/daffodil-design-toast.mjs.map +1 -1
- package/fesm2022/daffodil-design-tree.mjs +152 -112
- package/fesm2022/daffodil-design-tree.mjs.map +1 -1
- package/fesm2022/daffodil-design-youtube-player.mjs +6 -6
- package/fesm2022/daffodil-design-youtube-player.mjs.map +1 -1
- package/fesm2022/daffodil-design.mjs +559 -711
- 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 +74 -99
- package/form-field/index.d.ts +64 -42
- package/hero/README.md +5 -5
- package/image/README.md +27 -19
- package/image/index.d.ts +6 -1
- package/index.d.ts +282 -447
- package/input/README.md +36 -16
- package/input/index.d.ts +4 -3
- package/link-set/index.d.ts +9 -1
- package/list/README.md +2 -2
- package/loading-icon/README.md +1 -1
- package/loading-icon/index.d.ts +1 -1
- package/media-gallery/README.md +3 -3
- package/menu/README.md +107 -10
- package/menu/index.d.ts +143 -11
- package/modal/README.md +107 -17
- package/modal/index.d.ts +72 -35
- package/native-select/README.md +52 -15
- package/native-select/index.d.ts +8 -7
- package/navbar/README.md +23 -17
- package/navbar/index.d.ts +12 -2
- package/navbar/src/navbar-theme.scss +4 -46
- package/notification/README.md +4 -4
- package/notification/index.d.ts +7 -38
- package/package.json +1 -1
- package/paginator/README.md +42 -6
- package/paginator/index.d.ts +5 -9
- package/progress-bar/README.md +3 -3
- package/quantity-field/README.md +4 -4
- package/quantity-field/index.d.ts +4 -1
- package/radio/README.md +1 -1
- package/radio/index.d.ts +0 -16
- package/scss/layout/_breakpoint.scss +1 -1
- package/scss/theme.scss +9 -5
- package/scss/theming/_color-palettes.scss +19 -11
- 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/max-contrast/max-contrast.scss +3 -3
- 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 +6 -14
- package/sidebar/index.d.ts +3 -15
- package/spinner/README.md +57 -0
- package/spinner/index.d.ts +53 -0
- package/spinner/src/spinner-theme.scss +62 -0
- package/switch/README.md +21 -29
- package/switch/index.d.ts +18 -48
- package/switch/src/switch-theme.scss +26 -18
- package/tabs/README.md +1 -1
- package/tabs/index.d.ts +8 -5
- package/tag/README.md +24 -30
- package/tag/index.d.ts +1 -1
- package/tag/src/tag-theme.scss +11 -9
- package/text-snippet/README.md +1 -1
- package/text-snippet/src/text-snippet-theme.scss +12 -0
- package/textarea/README.md +36 -6
- package/textarea/index.d.ts +4 -4
- package/toast/README.md +4 -4
- package/tree/README.md +39 -22
- package/tree/index.d.ts +57 -96
- 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 -34
- 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-tag-examples.mjs +0 -125
- package/fesm2022/daffodil-design-tag-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/tag/examples/index.d.ts +0 -50
- 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,18 +2,20 @@
|
|
|
2
2
|
Form field is a wrapping component that provides consistent styling and behavior for form control elements.
|
|
3
3
|
|
|
4
4
|
## Overview
|
|
5
|
-
|
|
5
|
+
Form field is 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
|
+
## Supported controls
|
|
7
8
|
The following Daffodil Design components are designed to work inside a form field:
|
|
8
9
|
|
|
9
10
|
- [Native Input](/libs/design/input/README.md)
|
|
10
11
|
- [Native Select](/libs/design/native-select/README.md)
|
|
11
12
|
- [Native Textarea](/libs/design/textarea/README.md)
|
|
13
|
+
- [Custom Select](/libs/design/select/README.md)
|
|
14
|
+
- [Quantity Field](/libs/storefront/quantity-field/README.md)
|
|
12
15
|
|
|
13
16
|
## Usage
|
|
14
17
|
|
|
15
|
-
|
|
16
|
-
To use form field in a standalone component, import `DAFF_FORM_FIELD_COMPONENTS` directly into your custom component:
|
|
18
|
+
Import `DAFF_FORM_FIELD_COMPONENTS` into your component:
|
|
17
19
|
|
|
18
20
|
```ts
|
|
19
21
|
import { DAFF_FORM_FIELD_COMPONENTS } from '@daffodil/design/form-field';
|
|
@@ -28,52 +30,65 @@ import { DAFF_FORM_FIELD_COMPONENTS } from '@daffodil/design/form-field';
|
|
|
28
30
|
export class CustomComponent {}
|
|
29
31
|
```
|
|
30
32
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
> **Deprecation notice:**
|
|
34
|
+
>
|
|
35
|
+
> `DaffFormFieldModule` is deprecated. Use the standalone component imports instead.
|
|
33
36
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
import { DaffFormFieldModule } from '@daffodil/design/form-field';
|
|
37
|
-
import { CustomComponent } from './custom.component';
|
|
37
|
+
## Anatomy
|
|
38
|
+
A form field is composed of a wrapper, label, form control, prefix, suffix, action, hint, and error message:
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
]
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
})
|
|
50
|
-
export class CustomComponentModule { }
|
|
40
|
+
```html
|
|
41
|
+
<daff-form-field>
|
|
42
|
+
<daff-form-label>Email</daff-form-label>
|
|
43
|
+
<fa-icon daffPrefix [icon]="faEnvelope"></fa-icon>
|
|
44
|
+
<input daff-input type="email" name="email" required />
|
|
45
|
+
<fa-icon daffSuffix [icon]="faCheck"></fa-icon>
|
|
46
|
+
<button daffFormFieldAction>Clear</button>
|
|
47
|
+
<daff-hint>We'll never share your email.</daff-hint>
|
|
48
|
+
<daff-error-message>Email is a required field.</daff-error-message>
|
|
49
|
+
</daff-form-field>
|
|
51
50
|
```
|
|
52
51
|
|
|
53
|
-
|
|
52
|
+
- **`<daff-form-field>`**: The wrapper component that holds all form field content.
|
|
53
|
+
- **`<daff-form-label>`**: The label for the form control. An asterisk is appended automatically when the control is required.
|
|
54
|
+
- **Form control**: Any element implementing `DaffFormFieldControl` (See [supported controls](/libs/design/form-field/README.md#supported-controls))
|
|
55
|
+
- **`[daffPrefix]`**: A leading visual, typically an icon, displayed before the form control.
|
|
56
|
+
- **`[daffSuffix]`**: A trailing visual, typically an icon, displayed after the form control.
|
|
57
|
+
- **`[daffFormFieldAction]`**: An action element, typically a button, attached to the form control.
|
|
58
|
+
- **`<daff-hint>`**: Helpful information displayed below the form field.
|
|
59
|
+
- **`<daff-error-message>`**: A validation error displayed below the form field, positioned after any hints.
|
|
60
|
+
|
|
61
|
+
> **Warning**
|
|
62
|
+
>
|
|
63
|
+
> The `DaffFormLabelDirective` (using `daffFormLabel` on `<label>`) is deprecated and will be removed in `v1.0.0`. Use `<daff-form-label>` instead for new implementations.
|
|
64
|
+
|
|
65
|
+
## Features
|
|
54
66
|
|
|
55
|
-
|
|
67
|
+
### Appearances
|
|
56
68
|
Form field supports two `appearances`: `fluid` and `fixed`. It will default to `fluid` if an `appearance` is not specified.
|
|
57
69
|
|
|
58
70
|
- `fluid`: alternate, stylized UI where the label is placed inside of the form control.
|
|
59
71
|
- `fixed`: corresponds with a traditional style where the label is positioned outside and above the form control.
|
|
60
72
|
|
|
61
|
-
<
|
|
73
|
+
<daff-docs-example-viewer example="form-field-appearances"></daff-docs-example-viewer>
|
|
62
74
|
|
|
63
|
-
|
|
64
|
-
|
|
75
|
+
### Action
|
|
76
|
+
- Fluid appearance: The action is positioned within the form control's UI.
|
|
77
|
+
- Fixed appearance: The action is positioned adjacent to the form control's UI.
|
|
65
78
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
<input daff-input type="text" name="first-name" required />
|
|
70
|
-
</daff-form-field>
|
|
71
|
-
```
|
|
79
|
+
> **Note**
|
|
80
|
+
>
|
|
81
|
+
> In a fluid appearance, avoid using a suffix alongside an action.
|
|
72
82
|
|
|
73
|
-
|
|
83
|
+
<daff-docs-example-viewer example="form-field-with-action"></daff-docs-example-viewer>
|
|
74
84
|
|
|
75
|
-
|
|
76
|
-
|
|
85
|
+
### Validated hints
|
|
86
|
+
Use the `validated` property on `<daff-hint>` to apply validation styling:
|
|
87
|
+
|
|
88
|
+
<daff-docs-example-viewer example="form-field-validated-hint"></daff-docs-example-viewer>
|
|
89
|
+
|
|
90
|
+
### Custom IDs
|
|
91
|
+
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.
|
|
77
92
|
|
|
78
93
|
```html
|
|
79
94
|
<daff-form-field id="user-email-address">
|
|
@@ -82,61 +97,11 @@ The `id` property allows you to set a custom identifier for the form field. Whil
|
|
|
82
97
|
</daff-form-field>
|
|
83
98
|
```
|
|
84
99
|
|
|
100
|
+
> **Note**
|
|
101
|
+
>
|
|
85
102
|
> When you provide a custom `id`, the `<daff-form-label>` automatically gets the correct `for` attribute that matches the control's `id`.
|
|
86
103
|
|
|
87
|
-
|
|
88
|
-
Hints are shown below the form field and are used to provide helpful information that assists users in correctly completing a field.
|
|
89
|
-
|
|
90
|
-
```html
|
|
91
|
-
<daff-form-field>
|
|
92
|
-
<daff-form-label>Password</daff-form-label>
|
|
93
|
-
<input daff-input type="text" name="password" />
|
|
94
|
-
<daff-hint>Password must have 8 characters.</daff-hint>
|
|
95
|
-
</daff-form-field>
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
### Validated hints
|
|
99
|
-
Use the `validated` property to show hints with validation styling:
|
|
100
|
-
|
|
101
|
-
```html
|
|
102
|
-
<daff-form-field>
|
|
103
|
-
<daff-form-label>Password</daff-form-label>
|
|
104
|
-
<input daff-input type="text" name="password" />
|
|
105
|
-
<daff-hint [validated]="isControlValid">Password must have 8 characters.</daff-hint>
|
|
106
|
-
</daff-form-field>
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
## Errors
|
|
110
|
-
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
|
-
|
|
112
|
-
```html
|
|
113
|
-
<daff-form-field>
|
|
114
|
-
<daff-form-label>Email*</daff-form-label>
|
|
115
|
-
<input daff-input type="text" name="email" />
|
|
116
|
-
@if (control.errors?.required) {
|
|
117
|
-
<daff-error-message>Email is a required field.</daff-error-message>
|
|
118
|
-
}
|
|
119
|
-
</daff-form-field>
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
## Action
|
|
123
|
-
Use the `[daffFormFieldAction]` directive to add an action element to a form field.
|
|
124
|
-
|
|
125
|
-
- Fluid appearance: The action is positioned within the form control's UI.
|
|
126
|
-
- Fixed appearance: The action is positioned adjacent to the form control's UI.
|
|
127
|
-
|
|
128
|
-
<design-land-example-viewer-container example="form-field-with-action"></design-land-example-viewer-container>
|
|
129
|
-
|
|
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.
|
|
132
|
-
|
|
133
|
-
> In a fluid appearance, avoid using suffix alongside an action.
|
|
134
|
-
|
|
135
|
-
<design-land-example-viewer-container example="form-field-with-prefix"></design-land-example-viewer-container>
|
|
136
|
-
|
|
137
|
-
<design-land-example-viewer-container example="form-field-with-suffix"></design-land-example-viewer-container>
|
|
138
|
-
|
|
139
|
-
## Creating a custom form field control
|
|
104
|
+
### Custom controls
|
|
140
105
|
In addition to the controls that Daffodil Design provides, you can create your own custom control by using the `DaffFormFieldControl` interface.
|
|
141
106
|
|
|
142
107
|
1. Your control component must implement the `DaffFormFieldControl` interface.
|
|
@@ -155,20 +120,29 @@ In addition to the controls that Daffodil Design provides, you can create your o
|
|
|
155
120
|
export class CustomControlComponent implements DaffFormFieldControl<any> {}
|
|
156
121
|
```
|
|
157
122
|
|
|
123
|
+
## Examples
|
|
124
|
+
|
|
125
|
+
### Form field with prefix
|
|
126
|
+
<daff-docs-example-viewer example="form-field-with-prefix"></daff-docs-example-viewer>
|
|
127
|
+
|
|
128
|
+
### Form field with suffix
|
|
129
|
+
<daff-docs-example-viewer example="form-field-with-suffix"></daff-docs-example-viewer>
|
|
130
|
+
|
|
158
131
|
## Best practices
|
|
159
132
|
- Always provide labels for accessibility. Use `<daff-form-label>` for the best experience with auto-labelling controls.
|
|
160
133
|
- Set meaningful custom IDs for form fields to improve accessibility and form management.
|
|
161
134
|
|
|
162
135
|
## Accessibility
|
|
163
136
|
|
|
164
|
-
###
|
|
165
|
-
For controls that support auto-labelling, the component automatically:
|
|
137
|
+
### Built-in behavior
|
|
166
138
|
|
|
167
|
-
-
|
|
168
|
-
-
|
|
169
|
-
-
|
|
139
|
+
- `<daff-hint>` and `<daff-error-message>` are linked to the form control via `aria-describedby`.
|
|
140
|
+
- `<daff-error-message>` is set to `aria-live="polite"` by default so that assistive technology only announce errors when they appear.
|
|
141
|
+
- For controls that support auto-labelling, the component automatically associates labels with controls using `for` and `id` attributes.
|
|
170
142
|
|
|
171
|
-
|
|
143
|
+
> **Note**
|
|
144
|
+
>
|
|
145
|
+
> 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
146
|
|
|
173
147
|
```html
|
|
174
148
|
<daff-form-field>
|
|
@@ -177,11 +151,12 @@ If a `<daff-form-label>` is not specified, use the `label` element to associate
|
|
|
177
151
|
</daff-form-field>
|
|
178
152
|
```
|
|
179
153
|
|
|
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.
|
|
154
|
+
### Developer responsibilities
|
|
155
|
+
- Always provide labels for accessibility. Use `<daff-form-label>` within `<daff-form-field>` for the best experience with auto-labelling controls.
|
|
183
156
|
|
|
184
157
|
## Troubleshooting
|
|
185
158
|
|
|
186
|
-
###
|
|
187
|
-
|
|
159
|
+
### Missing child control
|
|
160
|
+
> A DaffFormFieldComponent must contain a DaffFormFieldControl
|
|
161
|
+
|
|
162
|
+
`DaffFormFieldComponent` requires a child component that implements `DaffFormFieldControl`. To fix this, add a control like `daff-input` inside the form field.
|
package/form-field/index.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
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
|
|
|
10
|
+
/**
|
|
11
|
+
* DaffFormFieldActionDirective marks an element, typically a button, as an action attached to a form control inside `DaffFormFieldComponent`.
|
|
12
|
+
*/
|
|
8
13
|
declare class DaffFormFieldActionDirective {
|
|
9
|
-
/**
|
|
10
|
-
* @docs-private
|
|
11
|
-
*/
|
|
12
|
-
class: boolean;
|
|
13
14
|
static ɵfac: i0.ɵɵFactoryDeclaration<DaffFormFieldActionDirective, never>;
|
|
14
15
|
static ɵdir: i0.ɵɵDirectiveDeclaration<DaffFormFieldActionDirective, "[daffFormFieldAction]", never, {}, {}, never, never, true, never>;
|
|
15
16
|
}
|
|
@@ -23,28 +24,63 @@ interface DaffFormFieldState {
|
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
/**
|
|
27
|
+
* Form controls must extend this class to be used inside `DaffFormFieldComponent`.
|
|
26
28
|
*
|
|
27
|
-
*
|
|
28
|
-
* used
|
|
29
|
-
*
|
|
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.
|
|
29
|
+
* > **Note**
|
|
30
|
+
* > The control is defined as 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.
|
|
31
|
+
* >
|
|
32
|
+
* > By using an abstract class, the Angular DI container can match the class token for injection.
|
|
35
33
|
*/
|
|
36
34
|
declare abstract class DaffFormFieldControl<T> {
|
|
37
35
|
ngControl: NgControl | null;
|
|
36
|
+
/**
|
|
37
|
+
* The type of the control (e.g., 'input', 'select', 'textarea').
|
|
38
|
+
* Used to apply control-specific styling or behavior.
|
|
39
|
+
*/
|
|
38
40
|
abstract readonly controlType?: any;
|
|
41
|
+
/**
|
|
42
|
+
* Whether the control supports automatic label behavior.
|
|
43
|
+
* When `true`, the form field will associate the label with the control using `for` and `id` attributes.
|
|
44
|
+
*
|
|
45
|
+
* Defaults to `true`.
|
|
46
|
+
*/
|
|
39
47
|
readonly supportsAutoLabelling?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Whether the control currently has focus.
|
|
50
|
+
*/
|
|
40
51
|
abstract readonly focused: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Whether the control is required for form validation.
|
|
54
|
+
*/
|
|
41
55
|
abstract readonly required: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Whether the control is disabled.
|
|
58
|
+
*/
|
|
42
59
|
abstract readonly disabled: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* The unique identifier for the control element.
|
|
62
|
+
*/
|
|
43
63
|
readonly id?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Whether the label should be in the raised position.
|
|
66
|
+
* By default, matches the focused state.
|
|
67
|
+
*/
|
|
44
68
|
get raised(): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Sets focus on the control.
|
|
71
|
+
*
|
|
72
|
+
* @param event - Optional event that triggers the focus.
|
|
73
|
+
*/
|
|
45
74
|
abstract focus(event?: Event): void;
|
|
75
|
+
/**
|
|
76
|
+
* The current value of the control.
|
|
77
|
+
*/
|
|
46
78
|
abstract readonly value: T;
|
|
47
79
|
constructor(ngControl: NgControl | null);
|
|
80
|
+
/**
|
|
81
|
+
* Computes the current state of the form field control.
|
|
82
|
+
* Combines control properties and form validation state.
|
|
83
|
+
*/
|
|
48
84
|
get state(): DaffFormFieldState;
|
|
49
85
|
_stateChanges: BehaviorSubject<{
|
|
50
86
|
focused: boolean;
|
|
@@ -53,16 +89,20 @@ declare abstract class DaffFormFieldControl<T> {
|
|
|
53
89
|
error: boolean;
|
|
54
90
|
valid: boolean;
|
|
55
91
|
}>;
|
|
92
|
+
/**
|
|
93
|
+
* Observable stream of state changes for the form field control.
|
|
94
|
+
*/
|
|
56
95
|
stateChanges: Observable<DaffFormFieldState>;
|
|
96
|
+
/**
|
|
97
|
+
* Emits the current state.
|
|
98
|
+
*/
|
|
57
99
|
emitState(deferred?: boolean): void;
|
|
58
100
|
}
|
|
59
101
|
|
|
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
102
|
type DaffFormFieldApperanace = 'fluid' | 'fixed';
|
|
103
|
+
/**
|
|
104
|
+
* DaffFormFieldComponent is a wrapping component that provides consistent styling and behavior for form control elements.
|
|
105
|
+
*/
|
|
66
106
|
declare class DaffFormFieldComponent implements AfterContentInit, AfterContentChecked, AfterViewInit {
|
|
67
107
|
private cd;
|
|
68
108
|
elementRef: ElementRef;
|
|
@@ -81,7 +121,7 @@ declare class DaffFormFieldComponent implements AfterContentInit, AfterContentCh
|
|
|
81
121
|
_control: DaffFormFieldControl<unknown>;
|
|
82
122
|
/**
|
|
83
123
|
* @docs-private
|
|
84
|
-
* @deprecated Deprecated in version 0.86.0. Will be removed in
|
|
124
|
+
* @deprecated Deprecated in version 0.86.0. Will be removed in version 1.0.0.
|
|
85
125
|
*/
|
|
86
126
|
_formLabelDirective: DaffFormLabelDirective;
|
|
87
127
|
/**
|
|
@@ -140,7 +180,7 @@ declare class DaffFormFieldComponent implements AfterContentInit, AfterContentCh
|
|
|
140
180
|
get isRaised(): boolean;
|
|
141
181
|
private _appearance;
|
|
142
182
|
/**
|
|
143
|
-
* The appearance
|
|
183
|
+
* The appearance of the form field. Defaults to `fluid`.
|
|
144
184
|
*/
|
|
145
185
|
get appearance(): DaffFormFieldApperanace;
|
|
146
186
|
set appearance(value: DaffFormFieldApperanace);
|
|
@@ -206,25 +246,7 @@ declare class DaffFormFieldComponent implements AfterContentInit, AfterContentCh
|
|
|
206
246
|
*/
|
|
207
247
|
ngAfterContentChecked(): void;
|
|
208
248
|
static ɵfac: i0.ɵɵFactoryDeclaration<DaffFormFieldComponent, never>;
|
|
209
|
-
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
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
declare class DaffErrorMessageComponent {
|
|
213
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<DaffErrorMessageComponent, never>;
|
|
214
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<DaffErrorMessageComponent, "daff-error-message", never, {}, {}, never, ["*"], true, never>;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
declare class DaffHintComponent {
|
|
218
|
-
/**
|
|
219
|
-
* @docs-private
|
|
220
|
-
*/
|
|
221
|
-
class: boolean;
|
|
222
|
-
/**
|
|
223
|
-
* Displays a validated hint UI.
|
|
224
|
-
* */
|
|
225
|
-
validated: boolean;
|
|
226
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<DaffHintComponent, never>;
|
|
227
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<DaffHintComponent, "daff-hint", never, { "validated": { "alias": "validated"; "required": false; }; }, {}, never, ["*"], true, never>;
|
|
249
|
+
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: {}; }]>;
|
|
228
250
|
}
|
|
229
251
|
|
|
230
252
|
/**
|
|
@@ -232,13 +254,13 @@ declare class DaffHintComponent {
|
|
|
232
254
|
*/
|
|
233
255
|
declare class DaffFormFieldModule {
|
|
234
256
|
static ɵfac: i0.ɵɵFactoryDeclaration<DaffFormFieldModule, never>;
|
|
235
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<DaffFormFieldModule, never, [typeof DaffFormFieldComponent, typeof DaffErrorMessageComponent, typeof DaffHintComponent, typeof
|
|
257
|
+
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]>;
|
|
236
258
|
static ɵinj: i0.ɵɵInjectorDeclaration<DaffFormFieldModule>;
|
|
237
259
|
}
|
|
238
260
|
|
|
239
261
|
/**
|
|
240
262
|
* @docs-private
|
|
241
263
|
*/
|
|
242
|
-
declare const DAFF_FORM_FIELD_COMPONENTS: readonly [typeof DaffFormFieldComponent, typeof
|
|
264
|
+
declare const DAFF_FORM_FIELD_COMPONENTS: readonly [typeof DaffFormFieldComponent, typeof DaffFormLabelDirective, typeof DaffPrefixDirective, typeof DaffSuffixDirective, typeof DaffFormFieldActionDirective, typeof DaffHintComponent, typeof DaffFormFieldLabelDirective, typeof DaffErrorMessageComponent];
|
|
243
265
|
|
|
244
|
-
export { DAFF_FORM_FIELD_COMPONENTS,
|
|
266
|
+
export { DAFF_FORM_FIELD_COMPONENTS, DaffFormFieldActionDirective, DaffFormFieldComponent, DaffFormFieldControl, DaffFormFieldModule };
|
package/hero/README.md
CHANGED
|
@@ -4,7 +4,7 @@ A hero is a top-level container designed to be large and captivating, typically
|
|
|
4
4
|
## Overview
|
|
5
5
|
Heroes are the first visual element users see on a page and are intended to make a bold statement. They're flexible and extensible, including pre-styled content containers for common layouts such as titles, subtitles, taglines, and body content. Heroes should only be used once per page.
|
|
6
6
|
|
|
7
|
-
<
|
|
7
|
+
<daff-docs-example-viewer example="basic-hero"></daff-docs-example-viewer>
|
|
8
8
|
|
|
9
9
|
## Best practices
|
|
10
10
|
|
|
@@ -103,21 +103,21 @@ A hero consists of the following components, displayed in the order listed:
|
|
|
103
103
|
### Colors
|
|
104
104
|
Use the `color` property to change the background of a hero.
|
|
105
105
|
|
|
106
|
-
<
|
|
106
|
+
<daff-docs-example-viewer example="hero-theming"></daff-docs-example-viewer>
|
|
107
107
|
|
|
108
108
|
### Text alignment
|
|
109
109
|
Control hero-specific text alignment with the `textAlignment` property. It defaults to `left` and **does not** affect `[daffHeroBody]` content or nested elements.
|
|
110
110
|
|
|
111
|
-
<
|
|
111
|
+
<daff-docs-example-viewer example="hero-text-alignment"></daff-docs-example-viewer>
|
|
112
112
|
|
|
113
113
|
### Compact
|
|
114
114
|
Use the `compact` property on hero to reduce padding and suit UIs with tighter spacing requirements.
|
|
115
115
|
|
|
116
|
-
<
|
|
116
|
+
<daff-docs-example-viewer example="compact-hero"></daff-docs-example-viewer>
|
|
117
117
|
|
|
118
118
|
## Examples
|
|
119
119
|
|
|
120
120
|
### Hero with two columns
|
|
121
121
|
Heroes are flexible enough to support custom grid layouts for more complex arrangements:
|
|
122
122
|
|
|
123
|
-
<
|
|
123
|
+
<daff-docs-example-viewer example="hero-with-grid"></daff-docs-example-viewer>
|
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
|
+
<daff-docs-example-viewer example="basic-image"></daff-docs-example-viewer>
|
|
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
|
+
<daff-docs-example-viewer example="skeleton-image"></daff-docs-example-viewer>
|
|
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
|
/**
|