@cfpb/cfpb-design-system 4.4.0 → 5.0.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 (155) hide show
  1. package/CHANGELOG.md +32 -1
  2. package/dist/index.css +1 -3
  3. package/dist/index.js +3812 -53
  4. package/package.json +5 -2
  5. package/src/components/cfpb-buttons/button-link.scss +0 -1
  6. package/src/components/cfpb-forms/multiselect-model.js +2 -5
  7. package/src/components/cfpb-forms/multiselect.js +1 -1
  8. package/src/components/cfpb-layout/email-signup.scss +4 -1
  9. package/src/components/cfpb-layout/featured-content-module.scss +10 -5
  10. package/src/components/cfpb-tables/table.scss +1 -1
  11. package/src/elements/abstracts/custom-props.css +1 -1
  12. package/src/elements/abstracts/sizing-vars.scss +25 -24
  13. package/src/elements/cfpb-button/cfpb-button.scss +2 -1
  14. package/src/elements/cfpb-button/index.js +2 -4
  15. package/src/elements/cfpb-checkbox-icon/index.js +2 -4
  16. package/src/elements/cfpb-expandable/cfpb-expandable.component.scss +6 -0
  17. package/src/elements/cfpb-expandable/index.js +4 -6
  18. package/src/elements/cfpb-file-upload/cfpb-file-upload.component.scss +0 -4
  19. package/src/elements/cfpb-file-upload/index.js +2 -4
  20. package/src/elements/cfpb-flag-usa/cfpb-flag-usa.component.scss +12 -0
  21. package/src/elements/cfpb-flag-usa/index.js +14 -0
  22. package/src/elements/cfpb-form-alert/index.js +5 -7
  23. package/src/elements/cfpb-form-choice/index.js +2 -4
  24. package/src/elements/cfpb-form-search/index.js +11 -8
  25. package/src/elements/cfpb-form-search-input/index.js +16 -6
  26. package/src/elements/cfpb-icon-text/index.js +2 -4
  27. package/src/elements/cfpb-label/index.js +2 -4
  28. package/src/elements/cfpb-list/index.js +3 -4
  29. package/src/elements/cfpb-list/index.spec.js +2 -0
  30. package/src/elements/cfpb-list-item/index.js +2 -4
  31. package/src/elements/cfpb-pagination/index.js +4 -6
  32. package/src/elements/cfpb-select/cfpb-select.component.scss +12 -12
  33. package/src/elements/cfpb-select/index.js +4 -6
  34. package/src/elements/cfpb-tag-filter/index.js +3 -5
  35. package/src/elements/cfpb-tag-group/index.js +19 -19
  36. package/src/elements/cfpb-tag-topic/index.js +2 -4
  37. package/src/elements/cfpb-tagline/cfpb-tagline.component.scss +33 -0
  38. package/src/elements/cfpb-tagline/index.js +51 -0
  39. package/src/elements/cfpb-utilities/parse-child-data.js +4 -1
  40. package/src/elements/index.js +1 -0
  41. package/src/index.scss +1 -2
  42. package/src/utilities/atomic-helpers.js +2 -2
  43. package/src/utilities/behavior/behavior.js +9 -2
  44. package/src/utilities/behavior/flyout-menu.js +5 -7
  45. package/src/utilities/event-observer.js +7 -3
  46. package/src/utilities/transition/alpha-transition.js +1 -1
  47. package/src/utilities/transition/base-transition.js +1 -1
  48. package/src/utilities/transition/max-height-transition.js +1 -1
  49. package/src/utilities/transition/move-transition.js +1 -1
  50. package/src/utilities/type-checkers.js +9 -9
  51. package/src/utilities/type-checkers.spec.js +2 -3
  52. package/dist/abstracts/index.js +0 -2
  53. package/dist/abstracts/index.js.map +0 -7
  54. package/dist/base/index.css +0 -3
  55. package/dist/base/index.css.map +0 -7
  56. package/dist/base/index.js +0 -2
  57. package/dist/base/index.js.map +0 -7
  58. package/dist/components/cfpb-buttons/index.css +0 -2
  59. package/dist/components/cfpb-buttons/index.css.map +0 -7
  60. package/dist/components/cfpb-buttons/index.js +0 -2
  61. package/dist/components/cfpb-buttons/index.js.map +0 -7
  62. package/dist/components/cfpb-expandables/index.css +0 -2
  63. package/dist/components/cfpb-expandables/index.css.map +0 -7
  64. package/dist/components/cfpb-expandables/index.js +0 -2
  65. package/dist/components/cfpb-expandables/index.js.map +0 -7
  66. package/dist/components/cfpb-forms/index.css +0 -2
  67. package/dist/components/cfpb-forms/index.css.map +0 -7
  68. package/dist/components/cfpb-forms/index.js +0 -2
  69. package/dist/components/cfpb-forms/index.js.map +0 -7
  70. package/dist/components/cfpb-icons/index.css +0 -2
  71. package/dist/components/cfpb-icons/index.css.map +0 -7
  72. package/dist/components/cfpb-icons/index.js +0 -2
  73. package/dist/components/cfpb-icons/index.js.map +0 -7
  74. package/dist/components/cfpb-layout/index.css +0 -2
  75. package/dist/components/cfpb-layout/index.css.map +0 -7
  76. package/dist/components/cfpb-layout/index.js +0 -2
  77. package/dist/components/cfpb-layout/index.js.map +0 -7
  78. package/dist/components/cfpb-notifications/index.css +0 -2
  79. package/dist/components/cfpb-notifications/index.css.map +0 -7
  80. package/dist/components/cfpb-notifications/index.js +0 -2
  81. package/dist/components/cfpb-notifications/index.js.map +0 -7
  82. package/dist/components/cfpb-pagination/index.css +0 -2
  83. package/dist/components/cfpb-pagination/index.css.map +0 -7
  84. package/dist/components/cfpb-pagination/index.js +0 -2
  85. package/dist/components/cfpb-pagination/index.js.map +0 -7
  86. package/dist/components/cfpb-tables/index.css +0 -2
  87. package/dist/components/cfpb-tables/index.css.map +0 -7
  88. package/dist/components/cfpb-tables/index.js +0 -2
  89. package/dist/components/cfpb-tables/index.js.map +0 -7
  90. package/dist/components/cfpb-tooltips/index.css +0 -2
  91. package/dist/components/cfpb-tooltips/index.css.map +0 -7
  92. package/dist/components/cfpb-tooltips/index.js +0 -2
  93. package/dist/components/cfpb-tooltips/index.js.map +0 -7
  94. package/dist/components/cfpb-typography/index.css +0 -2
  95. package/dist/components/cfpb-typography/index.css.map +0 -7
  96. package/dist/components/cfpb-typography/index.js +0 -2
  97. package/dist/components/cfpb-typography/index.js.map +0 -7
  98. package/dist/elements/abstracts/index.js +0 -2
  99. package/dist/elements/abstracts/index.js.map +0 -7
  100. package/dist/elements/base/index.css +0 -3
  101. package/dist/elements/base/index.css.map +0 -7
  102. package/dist/elements/base/index.js +0 -2
  103. package/dist/elements/base/index.js.map +0 -7
  104. package/dist/elements/cfpb-button/index.js +0 -47
  105. package/dist/elements/cfpb-button/index.js.map +0 -7
  106. package/dist/elements/cfpb-checkbox-icon/index.js +0 -29
  107. package/dist/elements/cfpb-checkbox-icon/index.js.map +0 -7
  108. package/dist/elements/cfpb-expandable/index.css +0 -2
  109. package/dist/elements/cfpb-expandable/index.css.map +0 -7
  110. package/dist/elements/cfpb-expandable/index.js +0 -33
  111. package/dist/elements/cfpb-expandable/index.js.map +0 -7
  112. package/dist/elements/cfpb-file-upload/index.js +0 -47
  113. package/dist/elements/cfpb-file-upload/index.js.map +0 -7
  114. package/dist/elements/cfpb-form-alert/index.js +0 -32
  115. package/dist/elements/cfpb-form-alert/index.js.map +0 -7
  116. package/dist/elements/cfpb-form-choice/index.js +0 -46
  117. package/dist/elements/cfpb-form-choice/index.js.map +0 -7
  118. package/dist/elements/cfpb-form-search/index.js +0 -41
  119. package/dist/elements/cfpb-form-search/index.js.map +0 -7
  120. package/dist/elements/cfpb-form-search-input/index.js +0 -41
  121. package/dist/elements/cfpb-form-search-input/index.js.map +0 -7
  122. package/dist/elements/cfpb-icon-text/index.js +0 -29
  123. package/dist/elements/cfpb-icon-text/index.js.map +0 -7
  124. package/dist/elements/cfpb-label/index.js +0 -36
  125. package/dist/elements/cfpb-label/index.js.map +0 -7
  126. package/dist/elements/cfpb-list/index.js +0 -39
  127. package/dist/elements/cfpb-list/index.js.map +0 -7
  128. package/dist/elements/cfpb-list-item/index.js +0 -39
  129. package/dist/elements/cfpb-list-item/index.js.map +0 -7
  130. package/dist/elements/cfpb-multiselect/index.js +0 -48
  131. package/dist/elements/cfpb-multiselect/index.js.map +0 -7
  132. package/dist/elements/cfpb-pagination/index.js +0 -32
  133. package/dist/elements/cfpb-pagination/index.js.map +0 -7
  134. package/dist/elements/cfpb-select/index.css +0 -2
  135. package/dist/elements/cfpb-select/index.css.map +0 -7
  136. package/dist/elements/cfpb-select/index.js +0 -42
  137. package/dist/elements/cfpb-select/index.js.map +0 -7
  138. package/dist/elements/cfpb-tag-filter/index.js +0 -31
  139. package/dist/elements/cfpb-tag-filter/index.js.map +0 -7
  140. package/dist/elements/cfpb-tag-group/index.js +0 -29
  141. package/dist/elements/cfpb-tag-group/index.js.map +0 -7
  142. package/dist/elements/cfpb-tag-topic/index.js +0 -30
  143. package/dist/elements/cfpb-tag-topic/index.js.map +0 -7
  144. package/dist/elements/cfpb-utilities/index.js +0 -2
  145. package/dist/elements/cfpb-utilities/index.js.map +0 -7
  146. package/dist/elements/index.css +0 -2
  147. package/dist/elements/index.css.map +0 -7
  148. package/dist/elements/index.js +0 -53
  149. package/dist/elements/index.js.map +0 -7
  150. package/dist/index.css.map +0 -7
  151. package/dist/index.js.map +0 -7
  152. package/dist/utilities/index.css +0 -2
  153. package/dist/utilities/index.css.map +0 -7
  154. package/dist/utilities/index.js +0 -2
  155. package/dist/utilities/index.js.map +0 -7
package/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "@cfpb/cfpb-design-system",
3
- "version": "4.4.0",
3
+ "version": "5.0.0",
4
4
  "description": "CFPB's UI framework",
5
5
  "exports": {
6
6
  ".": "./src/index.js",
7
7
  "./tooltips": "./src/components/cfpb-tooltips/index.js",
8
- "./icons/": "./src/components/cfpb-icons/icons/"
8
+ "./icons/": "./src/components/cfpb-icons/icons/",
9
+ "./src/elements/abstracts/*": "./src/elements/abstracts/*",
10
+ "./src/elements/*": "./src/elements/*",
11
+ "./src/components/*": "./src/components/*"
9
12
  },
10
13
  "author": {
11
14
  "name": "Consumer Financial Protection Bureau",
@@ -3,7 +3,6 @@
3
3
  @use '@cfpb/cfpb-design-system/src/elements/abstracts' as *;
4
4
  @use '@cfpb/cfpb-design-system/src/elements/cfpb-button/cfpb-button-link' as *;
5
5
 
6
-
7
6
  .a-btn--link {
8
7
  // Padding added so the focus rectangle falls below the underline.
9
8
  padding: 1.5px 0;
@@ -1,6 +1,3 @@
1
- // Undefined return value for void methods.
2
- let UNDEFINED;
3
-
4
1
  // How many options may be checked.
5
2
  export const MAX_SELECTIONS = 5;
6
3
 
@@ -74,7 +71,7 @@ function MultiselectModel(options, name, config) {
74
71
  let item;
75
72
  const cleaned = [];
76
73
 
77
- let isChecked = false;
74
+ let isChecked;
78
75
  for (let i = 0, len = list.length; i < len; i++) {
79
76
  item = list[i];
80
77
  isChecked = isAtMaxSelections() ? false : item.defaultSelected;
@@ -209,7 +206,7 @@ function MultiselectModel(options, name, config) {
209
206
  this.filterIndices = filterIndices;
210
207
  this.clearFilter = function () {
211
208
  _filterIndices = _lastFilterIndices = [];
212
- return UNDEFINED;
209
+ return undefined;
213
210
  };
214
211
  this.getFilterIndices = function () {
215
212
  return _filterIndices;
@@ -10,7 +10,7 @@ import { create } from './multiselect-utils.js';
10
10
 
11
11
  import * as MultiselectStyles from './multiselect.scss';
12
12
 
13
- import * as closeIconSrc from '../cfpb-icons/icons/error.svg';
13
+ import * as closeIconSrc from '../cfpb-icons/icons/error.svg?raw';
14
14
  const closeIcon = closeIconSrc.default;
15
15
 
16
16
  const BASE_CLASS = 'o-multiselect';
@@ -3,7 +3,10 @@
3
3
 
4
4
  .o-email-signup {
5
5
  .m-notification {
6
- margin-bottom: math.div(math.div($grid-gutter-width, 2), $base-font-size-px) +
6
+ margin-bottom: math.div(
7
+ math.div($grid-gutter-width, 2),
8
+ $base-font-size-px
9
+ ) +
7
10
  em;
8
11
  }
9
12
 
@@ -22,25 +22,30 @@
22
22
  padding-right: math.div(
23
23
  math.div($grid-gutter-width, 2),
24
24
  $base-font-size-px
25
- ) + em;
25
+ ) +
26
+ em;
26
27
  padding-left: math.div(
27
28
  math.div($grid-gutter-width, 2),
28
29
  $base-font-size-px
29
- ) + em;
30
+ ) +
31
+ em;
30
32
  }
31
33
  &__visual {
32
34
  padding-right: math.div(
33
35
  math.div($grid-gutter-width, 2),
34
36
  $base-font-size-px
35
- ) + em;
37
+ ) +
38
+ em;
36
39
  padding-bottom: math.div(
37
40
  math.div($grid-gutter-width, 2),
38
41
  $base-font-size-px
39
- ) + em;
42
+ ) +
43
+ em;
40
44
  padding-left: math.div(
41
45
  math.div($grid-gutter-width, 2),
42
46
  $base-font-size-px
43
- ) + em;
47
+ ) +
48
+ em;
44
49
  }
45
50
  &__img {
46
51
  margin-right: auto;
@@ -83,7 +83,7 @@
83
83
 
84
84
  // Yeilds 1.83333333
85
85
  // TODO: Research alternative to this magic number
86
- line-height: math.div(11,6);
86
+ line-height: math.div(11, 6);
87
87
 
88
88
  // h5 size.
89
89
  font-size: math.div($size-v, $base-font-size-px) + em;
@@ -119,5 +119,5 @@
119
119
  --teal-90: #3e8685;
120
120
  --teal-dark: #005e5d;
121
121
  --teal-mid-dark: #126b69;
122
- --white: #ffffff;
122
+ --white: #fff;
123
123
  }
@@ -1,7 +1,7 @@
1
1
  @use 'sass:math';
2
2
 
3
3
  // Seperating sizing vars out because for now we are only doing JSON color tokens
4
- // Putting these in a partial.
4
+ // Putting these in a partial.
5
5
  $base-font-size: 16;
6
6
  $base-font-size-px: 16px;
7
7
  $base-line-height-px: 22px;
@@ -38,29 +38,30 @@ $fcm-visual-width: 270px;
38
38
  $fcm-min-height: 220px;
39
39
 
40
40
  :root {
41
- // Typography normalization
42
- --font-adjust-base: 0.517;
43
- --font-adjust-step: 0.0054;
41
+ // Typography normalization
42
+ --font-adjust-base: 0.517;
43
+ --font-adjust-step: 0.0054;
44
44
 
45
- /* Derived font-size-adjust-values */
46
- --font-adjust-h1: calc(
47
- var(--font-size-adjust-base) + (5 * var(--font-adjust-step))
48
- );
49
- --font-adjust-h2: calc(
50
- var(--font-size-adjust-base) + (4 * var(--font-adjust-step))
51
- );
52
- --font-adjust-h3: calc(
53
- var(--font-size-adjust-base) + (3 * var(--font-adjust-step))
54
- );
55
- --font-adjust-h4: calc(
56
- var(--font-size-adjust-base) + (2 * var(--font-adjust-step))
57
- );
58
- --font-adjust-h5: calc(
59
- var(--font-size-adjust-base) + (1 * var(--font-adjust-step))
60
- );
61
- --font-adjust-h6: var(--font-adjust-base);
62
- --font-adjust-body: var(--font-adjust-base);
45
+ /* Derived font-size-adjust-values */
46
+ --font-adjust-h1: calc(
47
+ var(--font-size-adjust-base) + (5 * var(--font-adjust-step))
48
+ );
49
+ --font-adjust-h2: calc(
50
+ var(--font-size-adjust-base) + (4 * var(--font-adjust-step))
51
+ );
52
+ --font-adjust-h3: calc(
53
+ var(--font-size-adjust-base) + (3 * var(--font-adjust-step))
54
+ );
55
+ --font-adjust-h4: calc(
56
+ var(--font-size-adjust-base) + (2 * var(--font-adjust-step))
57
+ );
58
+ --font-adjust-h5: calc(
59
+ var(--font-size-adjust-base) + (1 * var(--font-adjust-step))
60
+ );
61
+ --font-adjust-h6: var(--font-adjust-base);
62
+ --font-adjust-body: var(--font-adjust-base);
63
63
 
64
- // .a-select
65
- --select-border-width-default: 1px;
64
+ // .a-select
65
+ --select-border-width-default: 1px;
66
+ --select-border-width-error: 2px;
66
67
  }
@@ -1,7 +1,8 @@
1
1
  @use 'sass:math';
2
2
  @use './vars' as *;
3
3
  @use '@cfpb/cfpb-design-system/src/elements/abstracts' as *;
4
- @use '@cfpb/cfpb-design-system/src/elements/cfpb-icon-text/cfpb-icon-text.component' as *;
4
+ @use '@cfpb/cfpb-design-system/src/elements/cfpb-icon-text/cfpb-icon-text.component'
5
+ as *;
5
6
 
6
7
  :host {
7
8
  //
@@ -1,4 +1,4 @@
1
- import { html, LitElement, css, unsafeCSS } from 'lit';
1
+ import { html, LitElement } from 'lit';
2
2
  import { classMap } from 'lit/directives/class-map.js';
3
3
  import { ref, createRef } from 'lit/directives/ref.js';
4
4
  import styles from './cfpb-button.component.scss';
@@ -16,9 +16,7 @@ const VALID_TYPES = ['button', 'submit', 'reset'];
16
16
  * @slot - The main content for the button.
17
17
  */
18
18
  export class CfpbButton extends LitElement {
19
- static styles = css`
20
- ${unsafeCSS(styles)}
21
- `;
19
+ static styles = styles;
22
20
 
23
21
  /**
24
22
  * @property {string} type - The button type: button, submit, or reset.
@@ -1,4 +1,4 @@
1
- import { html, LitElement, css, unsafeCSS } from 'lit';
1
+ import { html, LitElement } from 'lit';
2
2
  import styles from './cfpb-checkbox-icon.component.scss';
3
3
 
4
4
  // The validation states are error, warning, or success.
@@ -8,9 +8,7 @@ const VALID_VALIDATION = ['error', 'warning', 'success'];
8
8
  * @element cfpb-checkbox-icon
9
9
  */
10
10
  export class CfpbCheckboxIcon extends LitElement {
11
- static styles = css`
12
- ${unsafeCSS(styles)}
13
- `;
11
+ static styles = styles;
14
12
 
15
13
  #hover;
16
14
  #focus;
@@ -29,6 +29,7 @@
29
29
  font-size: math.div(16px, $base-font-size-px) + em !important;
30
30
  }
31
31
 
32
+ /*
32
33
  .o-expandable--padded {
33
34
  // h2 size.
34
35
  font-size: math.div(26px, $base-font-size-px) + em !important;
@@ -38,6 +39,7 @@
38
39
  font-size: math.div(22px, $base-font-size-px) + em !important;
39
40
  }
40
41
  }
42
+ */
41
43
  }
42
44
 
43
45
  //
@@ -136,6 +138,9 @@
136
138
  // Padded expandable modifier
137
139
  //
138
140
 
141
+ // NOTE: Padded expandle is disabled pending possible deletion.
142
+
143
+ /*
139
144
  &--padded {
140
145
  .o-expandable {
141
146
  &__header {
@@ -155,6 +160,7 @@
155
160
  }
156
161
  }
157
162
  }
163
+ */
158
164
 
159
165
  //
160
166
  // Expandable with a background color modifier
@@ -1,8 +1,8 @@
1
- import { html, LitElement, css, unsafeCSS } from 'lit';
1
+ import { html, LitElement } from 'lit';
2
2
  import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
3
3
  import styles from './cfpb-expandable.component.scss';
4
- import expandIcon from '../../components/cfpb-icons/icons/plus-round.svg';
5
- import collapseIcon from '../../components/cfpb-icons/icons/minus-round.svg';
4
+ import expandIcon from '../../components/cfpb-icons/icons/plus-round.svg?raw';
5
+ import collapseIcon from '../../components/cfpb-icons/icons/minus-round.svg?raw';
6
6
  import { MaxHeightTransition } from '../../utilities/transition/max-height-transition';
7
7
  import { FlyoutMenu } from '../../utilities/behavior/flyout-menu';
8
8
 
@@ -12,9 +12,7 @@ import { FlyoutMenu } from '../../utilities/behavior/flyout-menu';
12
12
  * @slot - The main content for the button.
13
13
  */
14
14
  export class CfpbExpandable extends LitElement {
15
- static styles = css`
16
- ${unsafeCSS(styles)}
17
- `;
15
+ static styles = styles;
18
16
 
19
17
  #flyoutMenu;
20
18
  #transition;
@@ -8,7 +8,3 @@
8
8
 
9
9
  flex-direction: column;
10
10
  }
11
-
12
- :host::part(upload-details)[hidden='true'] {
13
- display: none;
14
- }
@@ -1,4 +1,4 @@
1
- import { html, LitElement, css, unsafeCSS } from 'lit';
1
+ import { html, LitElement } from 'lit';
2
2
  import { ref, createRef } from 'lit/directives/ref.js';
3
3
  import styles from './cfpb-file-upload.component.scss';
4
4
  import { CfpbButton } from '../cfpb-button';
@@ -9,9 +9,7 @@ import { CfpbButton } from '../cfpb-button';
9
9
  * @slot - The main content for the upload button.
10
10
  */
11
11
  export class CfpbFileUpload extends LitElement {
12
- static styles = css`
13
- ${unsafeCSS(styles)}
14
- `;
12
+ static styles = styles;
15
13
 
16
14
  static properties = {
17
15
  isDetailHidden: {
@@ -0,0 +1,12 @@
1
+ :host {
2
+ display: inline-block;
3
+
4
+ // Standard flag size.
5
+ width: 24px;
6
+ height: 13px;
7
+
8
+ // 48px x 25px USA flag image.
9
+ background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAZCAMAAABAf11LAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAE5QTFRF////sxlC7MbQ2YyhxlNxCjFhR2WJV3GSKUt1dYumOFh/GT5rhZiwwszYsr/OlKW6Zn6c0djh8PL1iR9Ko7LE4OXrl0pttKC0pXWRtYKbSuJhRQAAANFJREFUeNrkkctuwyAUREnSuW/ApHYf//+jBVdZVcJi3aORgAXcMyLBAAJEzsVG3m8TkifyI3zfPQ6nJJLo421CArSBmkgjNEWtQE4zXJmClXuCWIlU5hdQxCqbqnE1KdIz79CVDvBwZxyKfQfmHTyzl01UZSvOWSTbhZLSWeDMufWLC/1ls3amT4qQq394EjIjApxBT+/nr8eEBNuKcB9SWMpmEXalNOylmlUZNTr4vE/4VdKhpC+leQf6y/e0wzL3RdJtkfUJyzwW+ZcdfgQYAJmJD3zerW6OAAAAAElFTkSuQmCC');
10
+ background-size: contain;
11
+ background-repeat: no-repeat;
12
+ }
@@ -0,0 +1,14 @@
1
+ import { LitElement } from 'lit';
2
+ import styles from './cfpb-flag-usa.component.scss';
3
+
4
+ /**
5
+ * @element cfpb-flag-usa
6
+ */
7
+ export class CfpbFlagUsa extends LitElement {
8
+ static styles = styles;
9
+
10
+ static init() {
11
+ globalThis.customElements.get('cfpb-flag-usa') ??
12
+ globalThis.customElements.define('cfpb-flag-usa', CfpbFlagUsa);
13
+ }
14
+ }
@@ -1,18 +1,16 @@
1
- import { html, LitElement, css, unsafeCSS } from 'lit';
1
+ import { html, LitElement } from 'lit';
2
2
  import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
3
3
  import styles from './cfpb-form-alert.component.scss';
4
- import errorIcon from '../../components/cfpb-icons/icons/error-round.svg';
5
- import warningIcon from '../../components/cfpb-icons/icons/warning-round.svg';
6
- import successIcon from '../../components/cfpb-icons/icons/approved-round.svg';
4
+ import errorIcon from '../../components/cfpb-icons/icons/error-round.svg?raw';
5
+ import warningIcon from '../../components/cfpb-icons/icons/warning-round.svg?raw';
6
+ import successIcon from '../../components/cfpb-icons/icons/approved-round.svg?raw';
7
7
 
8
8
  /**
9
9
  * @element cfpb-form-search
10
10
  * @slot - The label for the form input.
11
11
  */
12
12
  export class CfpbFormAlert extends LitElement {
13
- static styles = css`
14
- ${unsafeCSS(styles)}
15
- `;
13
+ static styles = styles;
16
14
 
17
15
  /**
18
16
  * @property {string} validation - Validation style: error, warning, success.
@@ -1,4 +1,4 @@
1
- import { html, LitElement, css, unsafeCSS } from 'lit';
1
+ import { html, LitElement } from 'lit';
2
2
  import { classMap } from 'lit/directives/class-map.js';
3
3
  import { ref, createRef } from 'lit/directives/ref.js';
4
4
  import styles from './cfpb-form-choice.component.scss';
@@ -15,9 +15,7 @@ const VALID_TYPES = ['checkbox', 'radio'];
15
15
  * @slot - The label for the form input.
16
16
  */
17
17
  export class CfpbFormChoice extends LitElement {
18
- static styles = css`
19
- ${unsafeCSS(styles)}
20
- `;
18
+ static styles = styles;
21
19
 
22
20
  #checkboxIcon = createRef();
23
21
 
@@ -1,4 +1,4 @@
1
- import { html, LitElement, css, unsafeCSS } from 'lit';
1
+ import { html, LitElement } from 'lit';
2
2
  import styles from './cfpb-form-search.component.scss';
3
3
  import { ref, createRef } from 'lit/directives/ref.js';
4
4
  import { CfpbFormSearchInput } from '../cfpb-form-search-input';
@@ -10,9 +10,7 @@ import { CfpbFormAlert } from '../cfpb-form-alert';
10
10
  * @element cfpb-form-search
11
11
  */
12
12
  export class CfpbFormSearch extends LitElement {
13
- static styles = css`
14
- ${unsafeCSS(styles)}
15
- `;
13
+ static styles = styles;
16
14
 
17
15
  static formAssociated = true;
18
16
 
@@ -95,6 +93,7 @@ export class CfpbFormSearch extends LitElement {
95
93
  }
96
94
 
97
95
  #onClear() {
96
+ this.value = '';
98
97
  this.#popup.value.classList.remove('show');
99
98
  this.#list.value.showAllItems();
100
99
  }
@@ -112,6 +111,11 @@ export class CfpbFormSearch extends LitElement {
112
111
  this.value = evt.target.value;
113
112
  }
114
113
 
114
+ #onEnterDown(evt) {
115
+ // Submit search when enter is pressed inside the input.
116
+ this.#onClickSearch(evt);
117
+ }
118
+
115
119
  #onBlur() {
116
120
  this.#popup.value.classList.remove('show');
117
121
  }
@@ -131,10 +135,8 @@ export class CfpbFormSearch extends LitElement {
131
135
  evt.preventDefault();
132
136
  if (this.disabled) return;
133
137
 
134
- if (this.value !== '') {
135
- this.#internals.setFormValue(this.value);
136
- this.#internals.form?.requestSubmit();
137
- }
138
+ this.#internals.setFormValue(this.value);
139
+ this.#internals.form?.requestSubmit();
138
140
  }
139
141
 
140
142
  render() {
@@ -154,6 +156,7 @@ export class CfpbFormSearch extends LitElement {
154
156
  ?validation=${this.validation}
155
157
  @clear=${this.#onClear}
156
158
  @input=${this.#onInput}
159
+ @enter-down=${this.#onEnterDown}
157
160
  @blur=${this.#onBlur}
158
161
  ></cfpb-form-search-input>
159
162
 
@@ -1,18 +1,16 @@
1
- import { html, LitElement, css, unsafeCSS } from 'lit';
1
+ import { html, LitElement } from 'lit';
2
2
  import { ref, createRef } from 'lit/directives/ref.js';
3
3
  import styles from './cfpb-form-search-input.component.scss';
4
4
  import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
5
5
 
6
- import searchIcon from '../../components/cfpb-icons/icons/search.svg';
7
- import clearIcon from '../../components/cfpb-icons/icons/error.svg';
6
+ import searchIcon from '../../components/cfpb-icons/icons/search.svg?raw';
7
+ import clearIcon from '../../components/cfpb-icons/icons/error.svg?raw';
8
8
 
9
9
  /**
10
10
  * @element cfpb-form-search-input
11
11
  */
12
12
  export class CfpbFormSearchInput extends LitElement {
13
- static styles = css`
14
- ${unsafeCSS(styles)}
15
- `;
13
+ static styles = styles;
16
14
 
17
15
  /**
18
16
  * @property {boolean} disabled - Whether the input is disabled or not.
@@ -65,6 +63,17 @@ export class CfpbFormSearchInput extends LitElement {
65
63
  this.value = evt.target.value;
66
64
  }
67
65
 
66
+ #onKeyDown(evt) {
67
+ if (evt.key === 'Enter') {
68
+ this.dispatchEvent(
69
+ new CustomEvent('enter-down', {
70
+ bubbles: true,
71
+ composed: true,
72
+ }),
73
+ );
74
+ }
75
+ }
76
+
68
77
  #onBlur() {
69
78
  this.dispatchEvent(
70
79
  new Event('blur', {
@@ -116,6 +125,7 @@ export class CfpbFormSearchInput extends LitElement {
116
125
  aria-label=${this.ariaLabelInput}
117
126
  ${ref(this.#searchInput)}
118
127
  @input=${this.#onInput}
128
+ @keydown=${this.#onKeyDown}
119
129
  @blur=${this.#onBlur}
120
130
  />
121
131
  <button
@@ -1,4 +1,4 @@
1
- import { html, LitElement, css, unsafeCSS } from 'lit';
1
+ import { html, LitElement } from 'lit';
2
2
  import styles from './cfpb-icon-text.component.scss';
3
3
 
4
4
  /**
@@ -6,9 +6,7 @@ import styles from './cfpb-icon-text.component.scss';
6
6
  * @slot - The main content for the text and icon.
7
7
  */
8
8
  export class CfpbIconText extends LitElement {
9
- static styles = css`
10
- ${unsafeCSS(styles)}
11
- `;
9
+ static styles = styles;
12
10
 
13
11
  /**
14
12
  * @property {boolean} disabled - Apply disabled styles or not.
@@ -1,4 +1,4 @@
1
- import { html, LitElement, css, unsafeCSS } from 'lit';
1
+ import { html, LitElement } from 'lit';
2
2
  import styles from './cfpb-label.component.scss';
3
3
  import { ifDefined } from 'lit/directives/if-defined.js';
4
4
 
@@ -9,9 +9,7 @@ import { ifDefined } from 'lit/directives/if-defined.js';
9
9
  * @slot helper - The content for the label helper text.
10
10
  */
11
11
  export class CfpbLabel extends LitElement {
12
- static styles = css`
13
- ${unsafeCSS(styles)}
14
- `;
12
+ static styles = styles;
15
13
 
16
14
  /**
17
15
  * @property {boolean} block - Whether this has block or inline helper text.
@@ -1,13 +1,11 @@
1
- import { LitElement, html, css, unsafeCSS } from 'lit';
1
+ import { LitElement, html } from 'lit';
2
2
  import { ref, createRef } from 'lit/directives/ref.js';
3
3
  import styles from './cfpb-list.component.scss';
4
4
  import { CfpbListItem } from '../cfpb-list-item';
5
5
  import { parseChildData } from '../cfpb-utilities/parse-child-data';
6
6
 
7
7
  export class CfpbList extends LitElement {
8
- static styles = css`
9
- ${unsafeCSS(styles)}
10
- `;
8
+ static styles = styles;
11
9
 
12
10
  #internalSync = false;
13
11
  #container = createRef();
@@ -186,6 +184,7 @@ export class CfpbList extends LitElement {
186
184
 
187
185
  #applyTypeToItems() {
188
186
  if (!['plain', 'check', 'checkbox'].includes(this.type)) {
187
+ // eslint-disable-next-line no-console
189
188
  console.warn(`<cfpb-list>: invalid type "${this.type}".`);
190
189
  return;
191
190
  }
@@ -157,9 +157,11 @@ describe('<cfpb-list> tests', () => {
157
157
  });
158
158
 
159
159
  test('invalid childData logs error', async () => {
160
+ // eslint-disable-next-line no-console
160
161
  console.error = jest.fn();
161
162
  list.childData = 'not-json';
162
163
  await list.updateComplete;
164
+ // eslint-disable-next-line no-console
163
165
  expect(console.error).toHaveBeenCalled();
164
166
  });
165
167
 
@@ -1,4 +1,4 @@
1
- import { html, LitElement, css, unsafeCSS } from 'lit';
1
+ import { html, LitElement } from 'lit';
2
2
  import styles from './cfpb-list-item.component.scss';
3
3
  import { ref, createRef } from 'lit/directives/ref.js';
4
4
  import { CfpbCheckboxIcon } from '../cfpb-checkbox-icon';
@@ -8,9 +8,7 @@ import { CfpbCheckboxIcon } from '../cfpb-checkbox-icon';
8
8
  * @slot - The text for the list item.
9
9
  */
10
10
  export class CfpbListItem extends LitElement {
11
- static styles = css`
12
- ${unsafeCSS(styles)}
13
- `;
11
+ static styles = styles;
14
12
 
15
13
  #checkboxIcon = createRef();
16
14
  #value;
@@ -1,8 +1,8 @@
1
- import { html, LitElement, css, unsafeCSS } from 'lit';
1
+ import { html, LitElement } from 'lit';
2
2
  import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
3
3
  import styles from './cfpb-pagination.component.scss';
4
- import leftIcon from '../../components/cfpb-icons/icons/left.svg';
5
- import rightIcon from '../../components/cfpb-icons/icons/right.svg';
4
+ import leftIcon from '../../components/cfpb-icons/icons/left.svg?raw';
5
+ import rightIcon from '../../components/cfpb-icons/icons/right.svg?raw';
6
6
  import { I18nService, MediaQueryService } from '../cfpb-utilities/';
7
7
 
8
8
  /**
@@ -15,9 +15,7 @@ export class CfpbPagination extends LitElement {
15
15
  #isMobile;
16
16
  #i18n;
17
17
 
18
- static styles = css`
19
- ${unsafeCSS(styles)}
20
- `;
18
+ static styles = styles;
21
19
 
22
20
  /**
23
21
  * @property {number} currentPage - The currently selected page.
@@ -173,19 +173,19 @@
173
173
  top: unset;
174
174
  }
175
175
  }
176
- }
177
176
 
178
- @media print {
179
- // Hide the interactive select cues when printing
180
- &__cues[aria-expanded='true'] &__cue-close,
181
- &__cues[aria-expanded='false'] &__cue-open {
182
- display: none;
183
- } // Ensure all selects are expanded when printing.
184
- // To accommodate print stylesheets that display the raw URL after links,
185
- // set an enormous max height to accommodate selects that have a lot of links.
186
- &__content[aria-expanded='false'] {
187
- display: block;
188
- max-height: 99999px !important;
177
+ @media print {
178
+ // Hide the interactive select cues when printing
179
+ &__cues[aria-expanded='true'] &__cue-close,
180
+ &__cues[aria-expanded='false'] &__cue-open {
181
+ display: none;
182
+ } // Ensure all selects are expanded when printing.
183
+ // To accommodate print stylesheets that display the raw URL after links,
184
+ // set an enormous max height to accommodate selects that have a lot of links.
185
+ &__content[aria-expanded='false'] {
186
+ display: block;
187
+ max-height: 99999px !important;
188
+ }
189
189
  }
190
190
  }
191
191
  }