@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
@@ -1,19 +1,13 @@
1
1
  @use '../utilities/variables';
2
2
 
3
- //
4
- // @deprecated
5
- //
6
- // @docs
7
- //
8
- // Changes the weight of text to bold
9
- //
10
- // @usage
11
- // ```scss
12
- // @use '@daffodil/design/scss/typography;
13
- //
14
- // @include typography.embolden;
15
- // ```
16
- //
3
+ /// @group Typography
4
+ /// @deprecated
5
+ /// @example scss
6
+ /// @use '@daffodil/design/scss/typography';
7
+ ///
8
+ /// .title {
9
+ /// @include typography.embolden;
10
+ /// }
17
11
 
18
12
  @mixin embolden() {
19
13
  font-weight: variables.$bold-font-weight;
package/select/README.md CHANGED
@@ -1,8 +1,111 @@
1
1
  # Select
2
+ Select allows users to choose from a dropdown panel with a list of options, similar to a native `<select>` element but with an enhanced UI.
3
+
4
+ ## Overview
5
+ Use select when you need users to pick one option from a list. It works like a standard dropdown menu but gives you more control over how options look and behave. It **cannot** be used by itself and must be contained within a [form field](/libs/design/form-field/README.md).
6
+
7
+ <design-land-example-viewer-container example="basic-select"></design-land-example-viewer-container>
2
8
 
3
9
  ## Usage
4
- The consuming component should pass a list of option values and a form control into `daff-select` as props. The consumer is fully in charge of rendering the options and selected option. This is accomplished by passing templates into two content projection slots.
10
+ To use select, import the components directly into your custom component:
11
+
12
+ ```ts
13
+ import { DAFF_SELECT_COMPONENTS } from '@daffodil/design/select';
14
+ import { DAFF_FORM_FIELD_COMPONENTS } from '@daffodil/design/form-field';
15
+
16
+ @Component({
17
+ selector: 'custom-component',
18
+ templateUrl: './custom-component.component.html',
19
+ imports: [
20
+ DAFF_SELECT_COMPONENTS,
21
+ DAFF_FORM_FIELD_COMPONENTS,
22
+ ],
23
+ })
24
+ export class CustomComponent {}
25
+ ```
26
+
27
+ ## Anatomy
28
+ Select must be used inside `<daff-form-field>` to enable proper state management and provide enhanced UI features such as hints, error messages, prefixes, and suffixes. The form field component also ensures accessibility compliance. For more details, see the [form field documentation](/libs/design/form-field/README.md).
29
+
30
+ ### Basic structure
31
+ Use `daffSelectOption` to render a list of options in the select panel:
32
+
33
+ ```html
34
+ <daff-form-field>
35
+ <daff-form-label>Select an address</daff-form-label>
36
+ <daff-select [options]="options" [formControl]="selectControl">
37
+ <ng-template daffSelectOption let-option="option">
38
+ <div>{{option.name}}</div>
39
+ <div>{{option.street}}</div>
40
+ <div>{{option.city}}, {{option.state}} {{option.postcode}}</div>
41
+ </ng-template>
42
+ </daff-select>
43
+ </daff-form-field>
44
+ ```
45
+
46
+ ## States
47
+
48
+ ### Disabled
49
+ Select can be disabled using Angular's reactive forms with `FormControl`.
50
+
51
+ <design-land-example-viewer-container example="disabled-select"></design-land-example-viewer-container>
52
+
53
+ ### Error
54
+ Select supports validation and error messages through Angular's form validation system. Use `<daff-error-message>` within the form field to display context-specific error messages. Error messages automatically appear when the select is invalid and has been touched or submitted.
55
+
56
+ <design-land-example-viewer-container example="select-with-error"></design-land-example-viewer-container>
57
+
58
+ Multiple error messages can be displayed conditionally based on the type of validation error. The form field component handles the styling and positioning of error messages.
59
+
60
+ ## Hints
61
+ Hints provide additional context or instructions to help users complete the select field correctly. Use `<daff-hint>` within the form field to display helpful information below the textarea. Unlike error messages, hints are always visible and provide guidance rather than validation feedback.
62
+
63
+ <design-land-example-viewer-container example="select-with-hint"></design-land-example-viewer-container>
64
+
65
+ ## Accessibility
66
+ Select follows the [Combobox WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-select-only/). The combobox activator is combined with an inner `role="listbox"` element opened in a popup.
67
+
68
+ ### Daffodil provides
69
+ - Automatic focus trapping when select panel is open
70
+ - `aria-labelledby` associated with the `<daff-form-label>`
71
+ - `aria-expanded` state management
72
+
73
+ ### Developer responsibilities
74
+ - Always provide labels for accessibility. Use `<daff-form-label>` within `<daff-form-field>` for the best experience with auto-labelling controls.
75
+
76
+ ### Keyboard interactions
77
+ **When select panel is closed:**
78
+
79
+ | Key | Action |
80
+ | --- | ------ |
81
+ | `Enter` / `Space` | Open the select panel |
82
+ | `Down Arrow` | Open the select panel |
83
+ | `Alt` + `Down Arrow` | Open the select panel |
84
+ | `Up Arrow` | Open the select panel |
85
+ | `Alt` + `Up Arrow` | Open the select panel |
86
+
87
+ **When select panel is opened:**
88
+ | Key | Action |
89
+ | --- | ------ |
90
+ | `Enter` / `Space` | Select the active option |
91
+ | `Escape` | Close the select panel and return focus to select |
92
+ | `Down Arrow` | Move focus to next option |
93
+ | `Up Arrow` | Move focus to previous option |
94
+
95
+ ## Troubleshooting
96
+
97
+ ### Error: DaffSelectComponent needs to be used with the DaffFormFieldComponent
98
+ This error is thrown when a select component is not used with a form field. Make sure your template looks like this:
5
99
 
6
- ## Slots
7
- ### `daffSelectOption`
8
- `daffSelectOption` provides the template for the list of options inside the select dropdown. Two values are bound to this slot context: `option` and `isSelected`. See `DaffSelectOptionDirectiveContext` for more info.
100
+ ```html
101
+ <daff-form-field>
102
+ <daff-form-label>Select an address</daff-form-label>
103
+ <daff-select [options]="options" [formControl]="selectControl">
104
+ <ng-template daffSelectOption let-option="option">
105
+ <div>{{option.name}}</div>
106
+ <div>{{option.street}}</div>
107
+ <div>{{option.city}}, {{option.state}} {{option.postcode}}</div>
108
+ </ng-template>
109
+ </daff-select>
110
+ </daff-form-field>
111
+ ```
package/sidebar/README.md CHANGED
@@ -214,11 +214,3 @@ body {
214
214
  ### Developer responsibilities
215
215
  - Apply a meaningful `role` attribute (e.g., `role="navigation"`) to describe the sidebar's purpose
216
216
  - Provide an `aria-label` when no title or header is present
217
-
218
- ## Deprecations
219
- `[daffSidebarHeaderAction]` has been deprecated in favor of the `dismissible` property. Replace `[daffSidebarHeaderAction]` with `<daff-sidebar-header [dismissible]="true">`
220
-
221
- ```html
222
- <daff-sidebar-header [dismissible]="true">
223
- </daff-sidebar-header>
224
- ```
@@ -308,24 +308,12 @@ declare class DaffSidebarHeaderTitleDirective {
308
308
  static ɵdir: i0.ɵɵDirectiveDeclaration<DaffSidebarHeaderTitleDirective, "[daffSidebarHeaderTitle]", never, {}, {}, never, never, true, never>;
309
309
  }
310
310
 
311
- /**
312
- * @deprecated in favor of the `dismissible` property on `DaffSidebarHeaderComponent`. Deprecated in version 0.88.0. Will be removed in version 0.91.0.
313
- */
314
- declare class DaffSidebarHeaderActionDirective {
315
- /**
316
- * @docs-private
317
- */
318
- class: boolean;
319
- static ɵfac: i0.ɵɵFactoryDeclaration<DaffSidebarHeaderActionDirective, never>;
320
- static ɵdir: i0.ɵɵDirectiveDeclaration<DaffSidebarHeaderActionDirective, "[daffSidebarHeaderAction]", never, {}, {}, never, never, true, never>;
321
- }
322
-
323
311
  /**
324
312
  * @deprecated in favor of {@link DAFF_SIDEBAR_COMPONENTS}. Deprecated in version 0.78.0. Will be removed in version 1.0.0.
325
313
  */
326
314
  declare class DaffSidebarModule {
327
315
  static ɵfac: i0.ɵɵFactoryDeclaration<DaffSidebarModule, never>;
328
- static ɵmod: i0.ɵɵNgModuleDeclaration<DaffSidebarModule, never, [typeof i1$1.CommonModule, typeof i2.A11yModule, typeof DaffSidebarComponent, typeof DaffSidebarViewportComponent, typeof DaffSidebarHeaderComponent, typeof DaffSidebarFooterComponent, typeof DaffSidebarHeaderTitleDirective, typeof DaffSidebarHeaderActionDirective], [typeof DaffSidebarComponent, typeof DaffSidebarViewportComponent, typeof DaffSidebarHeaderComponent, typeof DaffSidebarFooterComponent, typeof DaffSidebarHeaderTitleDirective, typeof DaffSidebarHeaderActionDirective]>;
316
+ static ɵmod: i0.ɵɵNgModuleDeclaration<DaffSidebarModule, never, [typeof i1$1.CommonModule, typeof i2.A11yModule, typeof DaffSidebarComponent, typeof DaffSidebarViewportComponent, typeof DaffSidebarHeaderComponent, typeof DaffSidebarFooterComponent, typeof DaffSidebarHeaderTitleDirective], [typeof DaffSidebarComponent, typeof DaffSidebarViewportComponent, typeof DaffSidebarHeaderComponent, typeof DaffSidebarFooterComponent, typeof DaffSidebarHeaderTitleDirective]>;
329
317
  static ɵinj: i0.ɵɵInjectorDeclaration<DaffSidebarModule>;
330
318
  }
331
319
 
@@ -376,7 +364,7 @@ declare const daffSidebarIsFloatingMode: (mode: DaffSidebarModeEnum) => boolean;
376
364
  /**
377
365
  * @docs-private
378
366
  */
379
- declare const DAFF_SIDEBAR_COMPONENTS: readonly [typeof DaffSidebarComponent, typeof DaffSidebarViewportComponent, typeof DaffSidebarHeaderComponent, typeof DaffSidebarFooterComponent, typeof DaffSidebarHeaderTitleDirective, typeof DaffSidebarHeaderActionDirective];
367
+ declare const DAFF_SIDEBAR_COMPONENTS: readonly [typeof DaffSidebarComponent, typeof DaffSidebarViewportComponent, typeof DaffSidebarHeaderComponent, typeof DaffSidebarFooterComponent, typeof DaffSidebarHeaderTitleDirective];
380
368
 
381
- export { DAFF_SIDEBAR_COMPONENTS, DaffSidebarComponent, DaffSidebarFooterComponent, DaffSidebarHeaderActionDirective, DaffSidebarHeaderComponent, DaffSidebarHeaderTitleDirective, DaffSidebarModeEnum, DaffSidebarModule, DaffSidebarService, DaffSidebarSideEnum, DaffSidebarViewportComponent, daffSidebarIsDockedMode, daffSidebarIsFloatingMode };
369
+ export { DAFF_SIDEBAR_COMPONENTS, DaffSidebarComponent, DaffSidebarFooterComponent, DaffSidebarHeaderComponent, DaffSidebarHeaderTitleDirective, DaffSidebarModeEnum, DaffSidebarModule, DaffSidebarService, DaffSidebarSideEnum, DaffSidebarViewportComponent, daffSidebarIsDockedMode, daffSidebarIsFloatingMode };
382
370
  export type { DaffSidebarMode, DaffSidebarRegistration, DaffSidebarSide };
package/switch/README.md CHANGED
@@ -4,10 +4,12 @@ A switch allows users to toggle the state of a single setting.
4
4
  ## Overview
5
5
  Switches provide a way to toggle between two states with a visual indicator of the current state. A label can be positioned on the left, right, top, or bottom of the switch. The switch can be set to a disabled state, display a loading indicator, or show a custom error message.
6
6
 
7
+ <design-land-example-viewer-container example="basic-switch"></design-land-example-viewer-container>
8
+
7
9
  ## Usage
8
10
 
9
11
  ### Within a standalone component
10
- To use a switch in a standalone component, import `DAFF_SWITCH_COMPONENTS` directly into your custom component:
12
+ To use switch, import `DAFF_SWITCH_COMPONENTS` directly into your custom component:
11
13
 
12
14
  ```ts
13
15
  import { DAFF_SWITCH_COMPONENTS } from '@daffodil/design/switch';
@@ -22,41 +24,31 @@ import { DAFF_SWITCH_COMPONENTS } from '@daffodil/design/switch';
22
24
  export class CustomComponent {}
23
25
  ```
24
26
 
25
- ## Examples
26
-
27
- ### Basic Switch
28
- A basic switch can be toggled by setting the `checked` property to `true` or `false`. By default, this is set to `false`.
27
+ ## Sizes
28
+ A small switch variant is available for dense layouts. Use the `size="sm"` property to render a more compact version of a switch.
29
29
 
30
- <design-land-example-viewer-container example="basic-switch"></design-land-example-viewer-container>
30
+ <design-land-example-viewer-container example="switch-sizes"></design-land-example-viewer-container>
31
31
 
32
- ### Disabled Switch
33
- A switch with the `disabled` property will be non-interactive.
32
+ ## Disable a switch
33
+ Use the `disabled` property on switch to make it non-interactive.
34
34
 
35
35
  <design-land-example-viewer-container example="disabled-switch"></design-land-example-viewer-container>
36
36
 
37
- ### Loading Switch
38
- A switch can display a loading state by setting `loading` to `true`. This will also disable the switch.
39
-
40
- <design-land-example-viewer-container example="loading-switch"></design-land-example-viewer-container>
41
-
42
- ### Switch with Error
43
- An error message can be displayed by setting `error` to `true` and including a `daff-error-message` to show the message text.
44
-
45
- <design-land-example-viewer-container example="switch-error"></design-land-example-viewer-container>
46
-
47
- ### Changing Label Position
48
- The label position can be changed by setting the `labelPosition` property. The default position is `left`.
49
-
50
- Supported positions: `left | right | top | bottom`
37
+ ## Label positions
38
+ Use the `labelPosition` property to control the visual relationship between the switch and its label. By default, labels appear to the left of the switch control.
51
39
 
52
40
  <design-land-example-viewer-container example="switch-label-positions"></design-land-example-viewer-container>
53
41
 
54
-
55
42
  ## Accessibility
56
- Switches follow the [ARIA Switch design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/switch/).
43
+ Switch follows the [ARIA Switch design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/switch/).
44
+
45
+ - The switch control is implemented as a `<button>` element with a role of `switch`.
46
+ - `aria-checked` is used to indicate the switch's on/off state.
47
+ - Links the switch to its label `id` using `aria-labelledby`.
57
48
 
58
- ### Keyboard Interactions
49
+ ### Keyboard interactions
59
50
  | Key | Action |
60
51
  | --- | ------ |
61
- | Space | Toggles the switch to the opposite state. |
62
- | Tab | Moves to next component on the page. |
52
+ | Tab | Moves focus to or away from the switch control. |
53
+ | Space | Changes the switch's state between on and off. |
54
+ | Enter | Changes the switch's state between on and off. |
package/switch/index.d.ts CHANGED
@@ -1,73 +1,43 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { EventEmitter } from '@angular/core';
3
+ import * as i1 from '@daffodil/design';
4
+ import { DaffSizableDirective, DaffSizeSmallType, DaffDisableableDirective } from '@daffodil/design';
3
5
 
4
- type DaffLabelPosition = 'daff-left' | 'daff-right' | 'daff-top' | 'daff-bottom';
6
+ type DaffSwitchLabelPosition = 'left' | 'right' | 'top' | 'bottom';
5
7
 
8
+ type DaffSwitchSize = DaffSizeSmallType;
6
9
  /**
7
10
  * The switch component provides a way to toggle between two settings.
8
11
  *
9
12
  * ```html
10
- * <daff-switch>
11
- * Label
12
- * </daff-switch>
13
+ * <daff-switch>Label</daff-switch>
13
14
  * ```
14
15
  */
15
- declare class DaffSwitchComponent {
16
+ declare class DaffSwitchComponent extends DaffSizableDirective<DaffSwitchSize> {
17
+ private disabledDirective;
16
18
  /**
17
- * Whether the switch is disabled and/or loading.
18
- */
19
- get disabled(): any;
20
- set disabled(value: any);
21
- /**
22
- * @docs-private
23
- */
24
- get disabledAttribute(): boolean;
25
- /**
26
- * @docs-private
27
- */
28
- get ariaDisabled(): boolean;
29
- /**
30
- * @docs-private
19
+ * The position of the label relative to the switch.
31
20
  */
32
- get classes(): string;
21
+ labelPosition: DaffSwitchLabelPosition;
22
+ constructor(disabledDirective: DaffDisableableDirective);
33
23
  /**
34
- * Whether the switch is loading.
24
+ * Whether the switch is disabled.
35
25
  */
36
- loading: boolean;
26
+ get disabled(): any;
27
+ set disabled(value: any);
37
28
  /**
38
29
  * Current state of switch (on/off).
39
30
  */
40
31
  checked: boolean;
41
- /**
42
- * The position of the label relative to the switch.
43
- */
44
- labelPosition: DaffLabelPosition;
45
- /**
46
- * Whether the switch shows an error.
47
- */
48
- error: boolean;
49
32
  /**
50
33
  * @docs-private
51
34
  */
52
- _disabled: boolean;
53
- handleKeydown(event: KeyboardEvent): void;
35
+ labelId: string;
54
36
  /**
55
- * @docs-private
56
- */
57
- private externalAriaLabel;
58
- /**
59
- * aria-label for the switch.
60
- */
61
- ariaLabel: string;
62
- /**
63
- * A unique id for the switch.
64
- *
65
- * The `id` is automatically generated by linking the prefix 'daff-switch-' with an incrementing number. This value can be customized by passing a different `id` value via the component's `id` input.
37
+ * The unique id of the switch. Defaults to an autogenerated value. When using this,
38
+ * it's your responsibility to ensure that the id for each switch is unique.
66
39
  *
67
- * @example Using the `id` property
68
- * ```html
69
- * <daff-switch [id]="'custom-id'"></daff-switch>
70
- * ```
40
+ * It gets assigned to the `for` attribute on the `<label>` inside of the switch.
71
41
  */
72
42
  id: string;
73
43
  /**
@@ -79,7 +49,7 @@ declare class DaffSwitchComponent {
79
49
  */
80
50
  onToggle(): void;
81
51
  static ɵfac: i0.ɵɵFactoryDeclaration<DaffSwitchComponent, never>;
82
- static ɵcmp: i0.ɵɵComponentDeclaration<DaffSwitchComponent, "daff-switch", never, { "disabled": { "alias": "disabled"; "required": false; }; "loading": { "alias": "loading"; "required": false; }; "checked": { "alias": "checked"; "required": false; }; "labelPosition": { "alias": "labelPosition"; "required": false; }; "error": { "alias": "error"; "required": false; }; "ariaLabel": { "alias": "aria-label"; "required": false; }; "id": { "alias": "id"; "required": false; }; }, { "toggled": "toggled"; }, never, ["*", "daff-error-message"], true, never>;
52
+ static ɵcmp: i0.ɵɵComponentDeclaration<DaffSwitchComponent, "daff-switch", never, { "labelPosition": { "alias": "labelPosition"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "checked": { "alias": "checked"; "required": false; }; "id": { "alias": "id"; "required": false; }; }, { "toggled": "toggled"; }, never, ["*"], true, [{ directive: typeof i1.DaffSizableDirective; inputs: { "size": "size"; }; outputs: {}; }, { directive: typeof i1.DaffDisableableDirective; inputs: { "disabled": "disabled"; }; outputs: {}; }]>;
83
53
  }
84
54
 
85
55
  /**
@@ -1,45 +1,53 @@
1
1
  @use '../../scss/theming' as *;
2
2
 
3
+ // stylelint-disable selector-class-pattern
3
4
  @mixin daff-switch-theme($theme) {
4
5
  $primary: daff-get-palette($theme, primary);
5
6
  $white: daff-get-base-color($theme, 'white');
6
7
  $neutral: daff-get-palette($theme, neutral);
8
+ $base-contrast: daff-get-base-color($theme, base-contrast);
7
9
  $mode: daff-get-theme-mode($theme);
8
10
 
9
11
  .daff-switch {
10
- &__toggle {
11
- border: 2px solid transparent;
12
+ $root: '.daff-switch';
12
13
 
13
- &.daff-checked {
14
+ &__label {
15
+ color: $base-contrast;
16
+ }
17
+
18
+ &.checked {
19
+ #{$root}__toggle {
14
20
  background-color: daff-color($primary);
15
21
  }
22
+ }
16
23
 
17
- @include light($mode) {
24
+ @include light($mode) {
25
+ &__toggle {
18
26
  background-color: daff-color($neutral, 30);
19
27
 
20
- &:focus-within {
21
- border: 2px solid daff-color($neutral, 20);
22
- }
23
-
24
28
  &::before {
25
29
  background-color: $white;
26
30
  }
27
- }
28
31
 
29
- @include dark($mode) {
30
- background-color: daff-color($neutral, 80);
31
-
32
- &:focus-within {
33
- border: 2px solid daff-color($neutral, 90);
32
+ &:focus {
33
+ &::after {
34
+ outline: 2px solid rgba($base-contrast, 0.08);
35
+ }
34
36
  }
37
+ }
38
+ }
39
+
40
+ @include dark($mode) {
41
+ &__toggle {
42
+ background-color: daff-color($neutral, 70);
35
43
 
36
44
  &::before {
37
- background-color: daff-color($neutral, 40);
45
+ background-color: $white;
38
46
  }
39
47
 
40
- &.daff-checked {
41
- &::before {
42
- background-color: $white;
48
+ &:focus {
49
+ &::after {
50
+ outline: 2px solid rgba($base-contrast, 0.15);
43
51
  }
44
52
  }
45
53
  }
package/tabs/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { TemplateRef, ElementRef, AfterContentInit, OnInit, EventEmitter, QueryList, ChangeDetectorRef } from '@angular/core';
3
3
  import * as i1 from '@daffodil/design';
4
- import { DaffPrefixDirective, DaffSuffixDirective, DaffSelectableDirective } from '@daffodil/design';
4
+ import { DaffDisableableDirective, DaffPrefixDirective, DaffSuffixDirective, DaffSelectableDirective } from '@daffodil/design';
5
5
  import { Location } from '@angular/common';
6
6
  import { Params } from '@angular/router';
7
7
 
@@ -24,10 +24,13 @@ import { Params } from '@angular/router';
24
24
  * ```
25
25
  */
26
26
  declare class DaffTabComponent {
27
+ private disabledDirective;
27
28
  /**
29
+ * @docs-private
30
+ *
28
31
  * Whether the tab is disabled.
29
32
  */
30
- disabled: boolean;
33
+ get disabled(): boolean;
31
34
  /**
32
35
  * @docs-private
33
36
  */
@@ -45,9 +48,9 @@ declare class DaffTabComponent {
45
48
  * @docs-private
46
49
  */
47
50
  panelId: string;
48
- constructor();
51
+ constructor(disabledDirective: DaffDisableableDirective);
49
52
  static ɵfac: i0.ɵɵFactoryDeclaration<DaffTabComponent, never>;
50
- static ɵcmp: i0.ɵɵComponentDeclaration<DaffTabComponent, "daff-tab", never, { "disabled": { "alias": "disabled"; "required": false; }; "id": { "alias": "id"; "required": false; }; }, {}, never, ["daff-tab-label", "daff-tab-panel"], true, never>;
53
+ static ɵcmp: i0.ɵɵComponentDeclaration<DaffTabComponent, "daff-tab", never, { "id": { "alias": "id"; "required": false; }; }, {}, never, ["daff-tab-label", "daff-tab-panel"], true, [{ directive: typeof i1.DaffDisableableDirective; inputs: { "disabled": "disabled"; }; outputs: {}; }]>;
51
54
  }
52
55
 
53
56
  /**
package/tag/README.md ADDED
@@ -0,0 +1,87 @@
1
+ # Tag
2
+ Tags are compact visual indicators used to display short pieces of information, such as status, categories, or labels. They typically contain an icon, text label, and optionally a delete button for removable items.
3
+
4
+ ## Overview
5
+ Tag supports flexible content projection to allow for various combinations of icons, labels, and interactive elements within a consistent container.
6
+
7
+ | Attribute | Description |
8
+ | --------- | ----------- |
9
+ | `daff-tag` | Flexible tag container that can contain an icon, a label, and a dismiss button |
10
+
11
+
12
+ **Basic tag**
13
+ <design-land-example-viewer-container example="basic-tag"></design-land-example-viewer-container>
14
+
15
+ ## Usage
16
+
17
+ ### Within a standalone component
18
+ To use tag in a standalone component, import `DAFF_TAG_COMPONENTS` directly into your custom component.
19
+
20
+ ```ts
21
+ import { DAFF_TAG_COMPONENTS } from '@daffodil/design/tag';
22
+
23
+ @Component({
24
+ selector: 'custom-component',
25
+ templateUrl: './custom-component.component.html',
26
+ imports: [
27
+ DAFF_TAG_COMPONENTS,
28
+ ],
29
+ })
30
+ export class CustomComponent {}
31
+ ```
32
+
33
+ ## Anatomy
34
+ Tags should always have a label, unless you are only using an icon that is universally understood and accessible.
35
+
36
+ ### Icon support
37
+ An icon can be rendered within the tag using the `daffPrefix` directive.
38
+
39
+ ```html
40
+ <daff-tag>
41
+ <fa-icon [icon]="faCircleCheck" daffPrefix></fa-icon>
42
+ <div>Tag label</div>
43
+ </daff-tag>
44
+ ```
45
+
46
+ ### Dismissible support
47
+ A tag can be made dismissible by setting the `dismissible` property to `true`. This displays a close button that emits a `closeTag` event when clicked.
48
+
49
+ ```html
50
+ <daff-tag dismissible (closeTag)="onCloseTag()">
51
+ <fa-icon [icon]="faCircleCheck" daffPrefix></fa-icon>
52
+ <div>Tag label</div>
53
+ </daff-tag>
54
+ ```
55
+
56
+ ### Disabled state
57
+ Tags can be disabled by setting the `disabled` property to `true`. Disabled tags cannot be dismissed.
58
+
59
+ ```html
60
+ <daff-tag dismissible disabled>
61
+ <fa-icon [icon]="faCircleCheck" daffPrefix></fa-icon>
62
+ <div>Disabled tag</div>
63
+ </daff-tag>
64
+ ```
65
+
66
+ ## Sizes
67
+ Use the `size` property to control tag dimensions. The default size is `md`. Supported sizes: `sm`, `md`, `lg`.
68
+
69
+ <design-land-example-viewer-container example="sizeable-tag"></design-land-example-viewer-container>
70
+
71
+ ## Colors
72
+ Use the `color` property to change the color of a tag. Supported colors: `primary`, `secondary`, `tertiary`, `dark`, `light`, `theme`, `theme-contrast`.
73
+
74
+ > Note: `dark`, `light`, and `theme` should be used on appropriate backgrounds for sufficient contrast.
75
+
76
+ <design-land-example-viewer-container example="colorable-tag"></design-land-example-viewer-container>
77
+
78
+ ## Status indicators
79
+ Status indicators help users understand the type of information a tag represents and its importance relative to other tags in the same context. Use the `status` property to convey different semantic meanings. Supported status: `warn`, `critical`, `info`, `success`.
80
+
81
+ <design-land-example-viewer-container example="statusable-tag"></design-land-example-viewer-container>
82
+
83
+ ## Accessibility
84
+ Daffodil uses semantic HTML elements and proper ARIA attributes to ensure an accessible experience by default.
85
+
86
+ - The close button supports the `disabled` state with appropriate `aria-disabled` attributes
87
+ - Use appropriate contrast ratios for text and background colors
package/tag/index.d.ts ADDED
@@ -0,0 +1,71 @@
1
+ import * as _fortawesome_fontawesome_common_types from '@fortawesome/fontawesome-common-types';
2
+ import * as i0 from '@angular/core';
3
+ import { EventEmitter } from '@angular/core';
4
+ import * as i1 from '@daffodil/design';
5
+ import { DaffSizableDirective, DaffSizeSmallType, DaffSizeMediumType, DaffSizeLargeType, DaffPrefixDirective } from '@daffodil/design';
6
+
7
+ /**
8
+ * The size types that the DaffTagComponent can implement.
9
+ */
10
+ type DaffTagSize = DaffSizeSmallType | DaffSizeMediumType | DaffSizeLargeType;
11
+ declare class DaffTagSizableDirective extends DaffSizableDirective<DaffTagSize> {
12
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffTagSizableDirective, never>;
13
+ static ɵdir: i0.ɵɵDirectiveDeclaration<DaffTagSizableDirective, never, never, {}, {}, never, never, true, never>;
14
+ }
15
+
16
+ /**
17
+ * Contains the tag content: checkmark icon, label, and delete button.
18
+ *
19
+ * @example
20
+ * ```html
21
+ * <daff-tag dismissible (closeTag)="onCloseTag()">
22
+ * <fa-icon daffPrefix [icon]="faCircleCheck"></fa-icon>
23
+ * <div>Label</div>
24
+ * </daff-tag>
25
+ * ```
26
+ */
27
+ declare class DaffTagComponent {
28
+ private size;
29
+ /**
30
+ * @docs-private
31
+ */
32
+ faTimes: _fortawesome_fontawesome_common_types.IconDefinition;
33
+ /**
34
+ * @docs-private
35
+ */
36
+ _prefix: DaffPrefixDirective;
37
+ private _disabled;
38
+ /**
39
+ * The disabled state of the tag.
40
+ */
41
+ get disabled(): any;
42
+ set disabled(value: any);
43
+ private _dismissible;
44
+ /** Whether the tag can be dismissed by the user.
45
+ * Displays a close icon if `true`.
46
+ */
47
+ get dismissible(): any;
48
+ set dismissible(value: any);
49
+ /**
50
+ * Emits when the tag is closed.
51
+ */
52
+ closeTag: EventEmitter<void>;
53
+ /**
54
+ * @docs-private
55
+ *
56
+ * Internal handler for the close icon click.
57
+ */
58
+ onCloseTag(event: Event): void;
59
+ constructor(size: DaffTagSizableDirective);
60
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffTagComponent, never>;
61
+ static ɵcmp: i0.ɵɵComponentDeclaration<DaffTagComponent, "daff-tag", never, { "disabled": { "alias": "disabled"; "required": false; }; "dismissible": { "alias": "dismissible"; "required": false; }; }, { "closeTag": "closeTag"; }, ["_prefix"], ["[daffPrefix]", "*"], true, [{ directive: typeof i1.DaffArticleEncapsulatedDirective; inputs: {}; outputs: {}; }, { directive: typeof DaffTagSizableDirective; inputs: { "size": "size"; }; outputs: {}; }, { directive: typeof i1.DaffColorableDirective; inputs: { "color": "color"; }; outputs: {}; }, { directive: typeof i1.DaffStatusableDirective; inputs: { "status": "status"; }; outputs: {}; }]>;
62
+ }
63
+
64
+ /**
65
+ * @docs-private
66
+ *
67
+ * `DAFF_TAG_COMPONENTS` imports all the available components and directives.
68
+ */
69
+ declare const DAFF_TAG_COMPONENTS: readonly [typeof DaffTagComponent, typeof DaffTagSizableDirective, typeof DaffPrefixDirective];
70
+
71
+ export { DAFF_TAG_COMPONENTS, DaffTagComponent, DaffTagSizableDirective };