@cfpb/cfpb-design-system 5.0.0 → 5.2.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 (33) hide show
  1. package/CHANGELOG.md +39 -1
  2. package/dist/index.css +2 -1
  3. package/dist/index.js +3089 -3473
  4. package/package.json +1 -1
  5. package/src/components/cfpb-forms/form-field.scss +3 -4
  6. package/src/components/cfpb-forms/multiselect.js +1 -2
  7. package/src/components/cfpb-forms/multiselect.scss +3 -2
  8. package/src/components/cfpb-forms/select.scss +3 -2
  9. package/src/components/cfpb-icons/icons-lib.js +680 -0
  10. package/src/components/cfpb-icons/icons-lib.scss +679 -0
  11. package/src/elements/cfpb-button/index.js +5 -3
  12. package/src/elements/cfpb-checkbox-icon/cfpb-checkbox-icon.component.scss +3 -4
  13. package/src/elements/cfpb-checkbox-icon/index.js +5 -3
  14. package/src/elements/cfpb-expandable/cfpb-expandable.component.scss +1 -1
  15. package/src/elements/cfpb-expandable/index.js +9 -5
  16. package/src/elements/cfpb-file-upload/index.js +5 -3
  17. package/src/elements/cfpb-flag-usa/index.js +5 -3
  18. package/src/elements/cfpb-form-alert/index.js +10 -6
  19. package/src/elements/cfpb-form-choice/index.js +5 -3
  20. package/src/elements/cfpb-form-search/index.js +5 -3
  21. package/src/elements/cfpb-form-search-input/index.js +9 -5
  22. package/src/elements/cfpb-icon-text/index.js +5 -3
  23. package/src/elements/cfpb-label/index.js +5 -3
  24. package/src/elements/cfpb-list/index.js +5 -3
  25. package/src/elements/cfpb-list-item/cfpb-list-item.component.scss +2 -1
  26. package/src/elements/cfpb-list-item/index.js +5 -3
  27. package/src/elements/cfpb-pagination/index.js +6 -5
  28. package/src/elements/cfpb-select/index.js +9 -5
  29. package/src/elements/cfpb-tag-filter/index.js +6 -4
  30. package/src/elements/cfpb-tag-group/index.js +5 -3
  31. package/src/elements/cfpb-tag-topic/index.js +5 -3
  32. package/src/elements/cfpb-tagline/cfpb-tagline.component.scss +5 -0
  33. package/src/elements/cfpb-tagline/index.js +5 -3
@@ -1,7 +1,7 @@
1
- import { html, LitElement } from 'lit';
1
+ import { html, LitElement, css, unsafeCSS } from 'lit';
2
2
  import { classMap } from 'lit/directives/class-map.js';
3
3
  import { ref, createRef } from 'lit/directives/ref.js';
4
- import styles from './cfpb-button.component.scss';
4
+ import styles from './cfpb-button.component.scss?inline';
5
5
  import { CfpbIconText } from '../cfpb-icon-text';
6
6
 
7
7
  // The variants are different color themes of the button.
@@ -16,7 +16,9 @@ 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 = styles;
19
+ static styles = css`
20
+ ${unsafeCSS(styles)}
21
+ `;
20
22
 
21
23
  /**
22
24
  * @property {string} type - The button type: button, submit, or reset.
@@ -1,6 +1,7 @@
1
1
  @use 'sass:math';
2
2
  @use '@cfpb/cfpb-design-system/src/elements/abstracts' as *;
3
3
  @use '@cfpb/cfpb-design-system/src/utilities' as *;
4
+ @use '@cfpb/cfpb-design-system/src/components/cfpb-icons/icons-lib' as *;
4
5
 
5
6
  :host {
6
7
  // Theme variables.
@@ -32,7 +33,7 @@
32
33
  }
33
34
 
34
35
  .checked::before {
35
- --cfpb-background-icon-svg: 'approved';
36
+ background-image: $cfpb-background-icon-svg-approved;
36
37
  background-size: auto $cf-icon-height;
37
38
  background-repeat: no-repeat;
38
39
  background-position: center 0;
@@ -47,9 +48,7 @@
47
48
  }
48
49
 
49
50
  .checked.disabled::before {
50
- // RGB values are CFPB gray (#5a5d61).
51
- // For some reason SVG isn't accepting hex values for the fill.
52
- --cfpb-background-icon-svg: 'approved rgb(90,93,97)';
51
+ background-image: $cfpb-background-icon-svg-approved-gray;
53
52
  }
54
53
 
55
54
  .cfpb-checkbox-icon:not(.disabled, .borderless).focus::before,
@@ -1,5 +1,5 @@
1
- import { html, LitElement } from 'lit';
2
- import styles from './cfpb-checkbox-icon.component.scss';
1
+ import { LitElement, html, css, unsafeCSS } from 'lit';
2
+ import styles from './cfpb-checkbox-icon.component.scss?inline';
3
3
 
4
4
  // The validation states are error, warning, or success.
5
5
  const VALID_VALIDATION = ['error', 'warning', 'success'];
@@ -8,7 +8,9 @@ const VALID_VALIDATION = ['error', 'warning', 'success'];
8
8
  * @element cfpb-checkbox-icon
9
9
  */
10
10
  export class CfpbCheckboxIcon extends LitElement {
11
- static styles = styles;
11
+ static styles = css`
12
+ ${unsafeCSS(styles)}
13
+ `;
12
14
 
13
15
  #hover;
14
16
  #focus;
@@ -138,7 +138,7 @@
138
138
  // Padded expandable modifier
139
139
  //
140
140
 
141
- // NOTE: Padded expandle is disabled pending possible deletion.
141
+ // NOTE: Padded expandable is disabled pending possible deletion.
142
142
 
143
143
  /*
144
144
  &--padded {
@@ -1,8 +1,10 @@
1
- import { html, LitElement } from 'lit';
1
+ import { LitElement, html, css, unsafeCSS } from 'lit';
2
2
  import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
3
- import styles from './cfpb-expandable.component.scss';
4
- import expandIcon from '../../components/cfpb-icons/icons/plus-round.svg?raw';
5
- import collapseIcon from '../../components/cfpb-icons/icons/minus-round.svg?raw';
3
+ import styles from './cfpb-expandable.component.scss?inline';
4
+ import {
5
+ plusRoundIcon as expandIcon,
6
+ minusRoundIcon as collapseIcon,
7
+ } from '../../components/cfpb-icons/icons-lib.js';
6
8
  import { MaxHeightTransition } from '../../utilities/transition/max-height-transition';
7
9
  import { FlyoutMenu } from '../../utilities/behavior/flyout-menu';
8
10
 
@@ -12,7 +14,9 @@ import { FlyoutMenu } from '../../utilities/behavior/flyout-menu';
12
14
  * @slot - The main content for the button.
13
15
  */
14
16
  export class CfpbExpandable extends LitElement {
15
- static styles = styles;
17
+ static styles = css`
18
+ ${unsafeCSS(styles)}
19
+ `;
16
20
 
17
21
  #flyoutMenu;
18
22
  #transition;
@@ -1,6 +1,6 @@
1
- import { html, LitElement } from 'lit';
1
+ import { LitElement, html, css, unsafeCSS } from 'lit';
2
2
  import { ref, createRef } from 'lit/directives/ref.js';
3
- import styles from './cfpb-file-upload.component.scss';
3
+ import styles from './cfpb-file-upload.component.scss?inline';
4
4
  import { CfpbButton } from '../cfpb-button';
5
5
 
6
6
  /**
@@ -9,7 +9,9 @@ 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 = styles;
12
+ static styles = css`
13
+ ${unsafeCSS(styles)}
14
+ `;
13
15
 
14
16
  static properties = {
15
17
  isDetailHidden: {
@@ -1,11 +1,13 @@
1
- import { LitElement } from 'lit';
2
- import styles from './cfpb-flag-usa.component.scss';
1
+ import { LitElement, css, unsafeCSS } from 'lit';
2
+ import styles from './cfpb-flag-usa.component.scss?inline';
3
3
 
4
4
  /**
5
5
  * @element cfpb-flag-usa
6
6
  */
7
7
  export class CfpbFlagUsa extends LitElement {
8
- static styles = styles;
8
+ static styles = css`
9
+ ${unsafeCSS(styles)}
10
+ `;
9
11
 
10
12
  static init() {
11
13
  globalThis.customElements.get('cfpb-flag-usa') ??
@@ -1,16 +1,20 @@
1
- import { html, LitElement } from 'lit';
1
+ import { LitElement, html, css, unsafeCSS } from 'lit';
2
2
  import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
3
- import styles from './cfpb-form-alert.component.scss';
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';
3
+ import styles from './cfpb-form-alert.component.scss?inline';
4
+ import {
5
+ errorRoundIcon as errorIcon,
6
+ warningRoundIcon as warningIcon,
7
+ approvedRoundIcon as successIcon,
8
+ } from '../../components/cfpb-icons/icons-lib.js';
7
9
 
8
10
  /**
9
11
  * @element cfpb-form-search
10
12
  * @slot - The label for the form input.
11
13
  */
12
14
  export class CfpbFormAlert extends LitElement {
13
- static styles = styles;
15
+ static styles = css`
16
+ ${unsafeCSS(styles)}
17
+ `;
14
18
 
15
19
  /**
16
20
  * @property {string} validation - Validation style: error, warning, success.
@@ -1,7 +1,7 @@
1
- import { html, LitElement } from 'lit';
1
+ import { LitElement, html, css, unsafeCSS } from 'lit';
2
2
  import { classMap } from 'lit/directives/class-map.js';
3
3
  import { ref, createRef } from 'lit/directives/ref.js';
4
- import styles from './cfpb-form-choice.component.scss';
4
+ import styles from './cfpb-form-choice.component.scss?inline';
5
5
  import { CfpbCheckboxIcon } from '../cfpb-checkbox-icon';
6
6
 
7
7
  // The validation states are error, warning, or success.
@@ -15,7 +15,9 @@ 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 = styles;
18
+ static styles = css`
19
+ ${unsafeCSS(styles)}
20
+ `;
19
21
 
20
22
  #checkboxIcon = createRef();
21
23
 
@@ -1,5 +1,5 @@
1
- import { html, LitElement } from 'lit';
2
- import styles from './cfpb-form-search.component.scss';
1
+ import { LitElement, html, css, unsafeCSS } from 'lit';
2
+ import styles from './cfpb-form-search.component.scss?inline';
3
3
  import { ref, createRef } from 'lit/directives/ref.js';
4
4
  import { CfpbFormSearchInput } from '../cfpb-form-search-input';
5
5
  import { SearchService } from '../cfpb-utilities/search-service.js';
@@ -10,7 +10,9 @@ import { CfpbFormAlert } from '../cfpb-form-alert';
10
10
  * @element cfpb-form-search
11
11
  */
12
12
  export class CfpbFormSearch extends LitElement {
13
- static styles = styles;
13
+ static styles = css`
14
+ ${unsafeCSS(styles)}
15
+ `;
14
16
 
15
17
  static formAssociated = true;
16
18
 
@@ -1,16 +1,20 @@
1
- import { html, LitElement } from 'lit';
1
+ import { LitElement, html, css, unsafeCSS } from 'lit';
2
2
  import { ref, createRef } from 'lit/directives/ref.js';
3
- import styles from './cfpb-form-search-input.component.scss';
3
+ import styles from './cfpb-form-search-input.component.scss?inline';
4
4
  import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
5
5
 
6
- import searchIcon from '../../components/cfpb-icons/icons/search.svg?raw';
7
- import clearIcon from '../../components/cfpb-icons/icons/error.svg?raw';
6
+ import {
7
+ searchIcon,
8
+ errorIcon as clearIcon,
9
+ } from '../../components/cfpb-icons/icons-lib.js';
8
10
 
9
11
  /**
10
12
  * @element cfpb-form-search-input
11
13
  */
12
14
  export class CfpbFormSearchInput extends LitElement {
13
- static styles = styles;
15
+ static styles = css`
16
+ ${unsafeCSS(styles)}
17
+ `;
14
18
 
15
19
  /**
16
20
  * @property {boolean} disabled - Whether the input is disabled or not.
@@ -1,12 +1,14 @@
1
- import { html, LitElement } from 'lit';
2
- import styles from './cfpb-icon-text.component.scss';
1
+ import { LitElement, html, css, unsafeCSS } from 'lit';
2
+ import styles from './cfpb-icon-text.component.scss?inline';
3
3
 
4
4
  /**
5
5
  * @element cfpb-icon-text
6
6
  * @slot - The main content for the text and icon.
7
7
  */
8
8
  export class CfpbIconText extends LitElement {
9
- static styles = styles;
9
+ static styles = css`
10
+ ${unsafeCSS(styles)}
11
+ `;
10
12
 
11
13
  /**
12
14
  * @property {boolean} disabled - Apply disabled styles or not.
@@ -1,5 +1,5 @@
1
- import { html, LitElement } from 'lit';
2
- import styles from './cfpb-label.component.scss';
1
+ import { LitElement, html, css, unsafeCSS } from 'lit';
2
+ import styles from './cfpb-label.component.scss?inline';
3
3
  import { ifDefined } from 'lit/directives/if-defined.js';
4
4
 
5
5
  /**
@@ -9,7 +9,9 @@ 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 = styles;
12
+ static styles = css`
13
+ ${unsafeCSS(styles)}
14
+ `;
13
15
 
14
16
  /**
15
17
  * @property {boolean} block - Whether this has block or inline helper text.
@@ -1,11 +1,13 @@
1
- import { LitElement, html } from 'lit';
1
+ import { LitElement, html, css, unsafeCSS } from 'lit';
2
2
  import { ref, createRef } from 'lit/directives/ref.js';
3
- import styles from './cfpb-list.component.scss';
3
+ import styles from './cfpb-list.component.scss?inline';
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 = styles;
8
+ static styles = css`
9
+ ${unsafeCSS(styles)}
10
+ `;
9
11
 
10
12
  #internalSync = false;
11
13
  #container = createRef();
@@ -1,5 +1,6 @@
1
1
  @use 'sass:math';
2
2
  @use '@cfpb/cfpb-design-system/src/elements/abstracts' as *;
3
+ @use '@cfpb/cfpb-design-system/src/components/cfpb-icons/icons-lib' as *;
3
4
 
4
5
  :host {
5
6
  // Theme variables.
@@ -48,7 +49,7 @@
48
49
 
49
50
  :host([checked]) {
50
51
  .checkbox::before {
51
- --cfpb-background-icon-svg: 'approved';
52
+ background-image: $cfpb-background-icon-svg-approved;
52
53
 
53
54
  background-size: auto $cf-icon-height;
54
55
  background-repeat: no-repeat;
@@ -1,5 +1,5 @@
1
- import { html, LitElement } from 'lit';
2
- import styles from './cfpb-list-item.component.scss';
1
+ import { LitElement, html, css, unsafeCSS } from 'lit';
2
+ import styles from './cfpb-list-item.component.scss?inline';
3
3
  import { ref, createRef } from 'lit/directives/ref.js';
4
4
  import { CfpbCheckboxIcon } from '../cfpb-checkbox-icon';
5
5
 
@@ -8,7 +8,9 @@ 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 = styles;
11
+ static styles = css`
12
+ ${unsafeCSS(styles)}
13
+ `;
12
14
 
13
15
  #checkboxIcon = createRef();
14
16
  #value;
@@ -1,8 +1,7 @@
1
- import { html, LitElement } from 'lit';
1
+ import { LitElement, html, css, unsafeCSS } from 'lit';
2
2
  import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
3
- import styles from './cfpb-pagination.component.scss';
4
- import leftIcon from '../../components/cfpb-icons/icons/left.svg?raw';
5
- import rightIcon from '../../components/cfpb-icons/icons/right.svg?raw';
3
+ import styles from './cfpb-pagination.component.scss?inline';
4
+ import { leftIcon, rightIcon } from '../../components/cfpb-icons/icons-lib.js';
6
5
  import { I18nService, MediaQueryService } from '../cfpb-utilities/';
7
6
 
8
7
  /**
@@ -15,7 +14,9 @@ export class CfpbPagination extends LitElement {
15
14
  #isMobile;
16
15
  #i18n;
17
16
 
18
- static styles = styles;
17
+ static styles = css`
18
+ ${unsafeCSS(styles)}
19
+ `;
19
20
 
20
21
  /**
21
22
  * @property {number} currentPage - The currently selected page.
@@ -1,9 +1,11 @@
1
- import { html, LitElement, nothing } from 'lit';
1
+ import { html, LitElement, css, unsafeCSS, nothing } from 'lit';
2
2
  import { ref, createRef } from 'lit/directives/ref.js';
3
3
  import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
4
- import styles from './cfpb-select.component.scss';
5
- import expandIcon from '../../components/cfpb-icons/icons/down.svg?raw';
6
- import collapseIcon from '../../components/cfpb-icons/icons/up.svg?raw';
4
+ import styles from './cfpb-select.component.scss?inline';
5
+ import {
6
+ downIcon as expandIcon,
7
+ upIcon as collapseIcon,
8
+ } from '../../components/cfpb-icons/icons-lib.js';
7
9
  import { CfpbFormSearchInput } from '../cfpb-form-search-input';
8
10
  import { SearchService } from '../cfpb-utilities/search-service.js';
9
11
  import { MaxHeightTransition } from '../../utilities/transition/max-height-transition';
@@ -20,7 +22,9 @@ import { MultipleSelectEventProxy } from './multiple-select-event-proxy.js';
20
22
  * @slot - The main content for the select.
21
23
  */
22
24
  export class CfpbSelect extends LitElement {
23
- static styles = styles;
25
+ static styles = css`
26
+ ${unsafeCSS(styles)}
27
+ `;
24
28
 
25
29
  #eventProxy;
26
30
  #flyoutMenu;
@@ -1,7 +1,7 @@
1
- import { html, LitElement } from 'lit';
1
+ import { LitElement, html, css, unsafeCSS } from 'lit';
2
2
  import { unsafeHTML } from 'lit/directives/unsafe-html.js';
3
- import styles from './cfpb-tag-filter.component.scss';
4
- import icon from '../../components/cfpb-icons/icons/error.svg?raw';
3
+ import styles from './cfpb-tag-filter.component.scss?inline';
4
+ import { errorIcon as icon } from '../../components/cfpb-icons/icons-lib';
5
5
 
6
6
  /**
7
7
  *
@@ -9,7 +9,9 @@ import icon from '../../components/cfpb-icons/icons/error.svg?raw';
9
9
  * @slot - The content for the filter tag.
10
10
  */
11
11
  export class CfpbTagFilter extends LitElement {
12
- static styles = styles;
12
+ static styles = css`
13
+ ${unsafeCSS(styles)}
14
+ `;
13
15
 
14
16
  /**
15
17
  * @property {string} for - Associate the label with an ID elsewhere.
@@ -1,5 +1,5 @@
1
- import { html, LitElement } from 'lit';
2
- import styles from './cfpb-tag-group.component.scss';
1
+ import { LitElement, html, css, unsafeCSS } from 'lit';
2
+ import styles from './cfpb-tag-group.component.scss?inline';
3
3
  import { parseChildData } from '../cfpb-utilities/parse-child-data';
4
4
 
5
5
  const SUPPORTED_TAG_LIST = ['CFPB-TAG-FILTER', 'CFPB-TAG-TOPIC'];
@@ -17,7 +17,9 @@ const SUPPORTED_TAG_LIST = ['CFPB-TAG-FILTER', 'CFPB-TAG-TOPIC'];
17
17
  * @fires CfpbTagGroup#event:"tag-removed" - A tag was removed to the group.
18
18
  */
19
19
  export class CfpbTagGroup extends LitElement {
20
- static styles = styles;
20
+ static styles = css`
21
+ ${unsafeCSS(styles)}
22
+ `;
21
23
 
22
24
  /**
23
25
  * @property {string} childData - Structure data to create child components.
@@ -1,5 +1,5 @@
1
- import { html, LitElement } from 'lit';
2
- import styles from './cfpb-tag-topic.component.scss';
1
+ import { LitElement, html, css, unsafeCSS } from 'lit';
2
+ import styles from './cfpb-tag-topic.component.scss?inline';
3
3
 
4
4
  /**
5
5
  *
@@ -7,7 +7,9 @@ import styles from './cfpb-tag-topic.component.scss';
7
7
  * @slot - The content for the topic tag.
8
8
  */
9
9
  export class CfpbTagTopic extends LitElement {
10
- static styles = styles;
10
+ static styles = css`
11
+ ${unsafeCSS(styles)}
12
+ `;
11
13
 
12
14
  /**
13
15
  * @property {string} href - href attribute, if this is a topic link.
@@ -25,6 +25,11 @@
25
25
  margin-top: 4px;
26
26
  }
27
27
  }
28
+
29
+ @media print {
30
+ // Force the background USA flag image in the tagline to be visible when printing.
31
+ print-color-adjust: exact;
32
+ }
28
33
  }
29
34
 
30
35
  .u-nowrap {
@@ -1,13 +1,15 @@
1
- import { html, LitElement } from 'lit';
1
+ import { LitElement, html, css, unsafeCSS } from 'lit';
2
2
  import { CfpbFlagUsa } from '../cfpb-flag-usa';
3
- import styles from './cfpb-tagline.component.scss';
3
+ import styles from './cfpb-tagline.component.scss?inline';
4
4
 
5
5
  /**
6
6
  * @element cfpb-icon-text
7
7
  * @slot - The main content for the tagline.
8
8
  */
9
9
  export class CfpbTagline extends LitElement {
10
- static styles = styles;
10
+ static styles = css`
11
+ ${unsafeCSS(styles)}
12
+ `;
11
13
 
12
14
  /**
13
15
  * @property {boolean} isLarge - Whether to use the larger tagline appearance.