@cfpb/cfpb-design-system 4.3.2 → 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.
- package/CHANGELOG.md +84 -3
- package/dist/index.css +1 -3
- package/dist/index.js +3812 -53
- package/package.json +5 -2
- package/src/components/cfpb-buttons/button-link.scss +0 -1
- package/src/components/cfpb-forms/multiselect-model.js +2 -5
- package/src/components/cfpb-forms/multiselect.js +1 -1
- package/src/components/cfpb-layout/email-signup.scss +4 -1
- package/src/components/cfpb-layout/featured-content-module.scss +10 -5
- package/src/components/cfpb-tables/table.scss +4 -1
- package/src/elements/abstracts/custom-props.css +1 -1
- package/src/elements/abstracts/sizing-vars.scss +25 -24
- package/src/elements/cfpb-button/cfpb-button.scss +2 -1
- package/src/elements/cfpb-button/index.js +2 -4
- package/src/elements/cfpb-checkbox-icon/index.js +2 -4
- package/src/elements/cfpb-expandable/cfpb-expandable.component.scss +6 -0
- package/src/elements/cfpb-expandable/index.js +4 -6
- package/src/elements/cfpb-file-upload/cfpb-file-upload.component.scss +0 -4
- package/src/elements/cfpb-file-upload/index.js +2 -4
- package/src/elements/cfpb-flag-usa/cfpb-flag-usa.component.scss +12 -0
- package/src/elements/cfpb-flag-usa/index.js +14 -0
- package/src/elements/cfpb-form-alert/index.js +5 -7
- package/src/elements/cfpb-form-choice/index.js +2 -4
- package/src/elements/cfpb-form-search/cfpb-form-search.component.scss +10 -0
- package/src/elements/cfpb-form-search/index.js +12 -11
- package/src/elements/cfpb-form-search-input/cfpb-form-search-input.component.scss +8 -5
- package/src/elements/cfpb-form-search-input/index.js +16 -6
- package/src/elements/cfpb-icon-text/index.js +2 -4
- package/src/elements/cfpb-label/index.js +2 -4
- package/src/elements/cfpb-list/index.js +5 -6
- package/src/elements/cfpb-list/index.spec.js +7 -5
- package/src/elements/cfpb-list-item/index.js +4 -6
- package/src/elements/cfpb-pagination/index.js +4 -6
- package/src/elements/cfpb-select/cfpb-select.component.scss +34 -57
- package/src/elements/cfpb-select/index.js +26 -18
- package/src/elements/cfpb-select/multiple-select-event-proxy.js +23 -17
- package/src/elements/cfpb-select/single-select-event-proxy.js +8 -5
- package/src/elements/cfpb-tag-filter/index.js +10 -5
- package/src/elements/cfpb-tag-group/index.js +28 -19
- package/src/elements/cfpb-tag-topic/index.js +9 -4
- package/src/elements/cfpb-tagline/cfpb-tagline.component.scss +33 -0
- package/src/elements/cfpb-tagline/index.js +51 -0
- package/src/elements/cfpb-utilities/media-query-service.js +1 -1
- package/src/elements/cfpb-utilities/parse-child-data.js +4 -1
- package/src/elements/index.js +1 -0
- package/src/index.scss +1 -2
- package/src/tokens/abstracts/custom-props.json +2334 -1639
- package/src/tokens/abstracts/vars.json +1679 -1315
- package/src/tokens/cfpb-button/vars.json +602 -409
- package/src/utilities/atomic-helpers.js +2 -2
- package/src/utilities/behavior/behavior.js +9 -2
- package/src/utilities/behavior/flyout-menu.js +5 -7
- package/src/utilities/event-observer.js +7 -3
- package/src/utilities/transition/alpha-transition.js +1 -1
- package/src/utilities/transition/base-transition.js +1 -1
- package/src/utilities/transition/max-height-transition.js +2 -2
- package/src/utilities/transition/move-transition.js +1 -1
- package/src/utilities/type-checkers.js +9 -9
- package/src/utilities/type-checkers.spec.js +2 -3
- package/dist/abstracts/index.js +0 -2
- package/dist/abstracts/index.js.map +0 -7
- package/dist/base/index.css +0 -3
- package/dist/base/index.css.map +0 -7
- package/dist/base/index.js +0 -2
- package/dist/base/index.js.map +0 -7
- package/dist/components/cfpb-buttons/index.css +0 -2
- package/dist/components/cfpb-buttons/index.css.map +0 -7
- package/dist/components/cfpb-buttons/index.js +0 -2
- package/dist/components/cfpb-buttons/index.js.map +0 -7
- package/dist/components/cfpb-expandables/index.css +0 -2
- package/dist/components/cfpb-expandables/index.css.map +0 -7
- package/dist/components/cfpb-expandables/index.js +0 -2
- package/dist/components/cfpb-expandables/index.js.map +0 -7
- package/dist/components/cfpb-forms/index.css +0 -2
- package/dist/components/cfpb-forms/index.css.map +0 -7
- package/dist/components/cfpb-forms/index.js +0 -2
- package/dist/components/cfpb-forms/index.js.map +0 -7
- package/dist/components/cfpb-icons/index.css +0 -2
- package/dist/components/cfpb-icons/index.css.map +0 -7
- package/dist/components/cfpb-icons/index.js +0 -2
- package/dist/components/cfpb-icons/index.js.map +0 -7
- package/dist/components/cfpb-layout/index.css +0 -2
- package/dist/components/cfpb-layout/index.css.map +0 -7
- package/dist/components/cfpb-layout/index.js +0 -2
- package/dist/components/cfpb-layout/index.js.map +0 -7
- package/dist/components/cfpb-notifications/index.css +0 -2
- package/dist/components/cfpb-notifications/index.css.map +0 -7
- package/dist/components/cfpb-notifications/index.js +0 -2
- package/dist/components/cfpb-notifications/index.js.map +0 -7
- package/dist/components/cfpb-pagination/index.css +0 -2
- package/dist/components/cfpb-pagination/index.css.map +0 -7
- package/dist/components/cfpb-pagination/index.js +0 -2
- package/dist/components/cfpb-pagination/index.js.map +0 -7
- package/dist/components/cfpb-tables/index.css +0 -2
- package/dist/components/cfpb-tables/index.css.map +0 -7
- package/dist/components/cfpb-tables/index.js +0 -2
- package/dist/components/cfpb-tables/index.js.map +0 -7
- package/dist/components/cfpb-tooltips/index.css +0 -2
- package/dist/components/cfpb-tooltips/index.css.map +0 -7
- package/dist/components/cfpb-tooltips/index.js +0 -2
- package/dist/components/cfpb-tooltips/index.js.map +0 -7
- package/dist/components/cfpb-typography/index.css +0 -2
- package/dist/components/cfpb-typography/index.css.map +0 -7
- package/dist/components/cfpb-typography/index.js +0 -2
- package/dist/components/cfpb-typography/index.js.map +0 -7
- package/dist/elements/abstracts/index.js +0 -2
- package/dist/elements/abstracts/index.js.map +0 -7
- package/dist/elements/base/index.css +0 -3
- package/dist/elements/base/index.css.map +0 -7
- package/dist/elements/base/index.js +0 -2
- package/dist/elements/base/index.js.map +0 -7
- package/dist/elements/cfpb-button/index.js +0 -47
- package/dist/elements/cfpb-button/index.js.map +0 -7
- package/dist/elements/cfpb-checkbox-icon/index.js +0 -29
- package/dist/elements/cfpb-checkbox-icon/index.js.map +0 -7
- package/dist/elements/cfpb-expandable/index.css +0 -2
- package/dist/elements/cfpb-expandable/index.css.map +0 -7
- package/dist/elements/cfpb-expandable/index.js +0 -33
- package/dist/elements/cfpb-expandable/index.js.map +0 -7
- package/dist/elements/cfpb-file-upload/index.js +0 -47
- package/dist/elements/cfpb-file-upload/index.js.map +0 -7
- package/dist/elements/cfpb-form-alert/index.js +0 -32
- package/dist/elements/cfpb-form-alert/index.js.map +0 -7
- package/dist/elements/cfpb-form-choice/index.js +0 -46
- package/dist/elements/cfpb-form-choice/index.js.map +0 -7
- package/dist/elements/cfpb-form-search/index.js +0 -41
- package/dist/elements/cfpb-form-search/index.js.map +0 -7
- package/dist/elements/cfpb-form-search-input/index.js +0 -41
- package/dist/elements/cfpb-form-search-input/index.js.map +0 -7
- package/dist/elements/cfpb-icon-text/index.js +0 -29
- package/dist/elements/cfpb-icon-text/index.js.map +0 -7
- package/dist/elements/cfpb-label/index.js +0 -36
- package/dist/elements/cfpb-label/index.js.map +0 -7
- package/dist/elements/cfpb-list/index.js +0 -39
- package/dist/elements/cfpb-list/index.js.map +0 -7
- package/dist/elements/cfpb-list-item/index.js +0 -39
- package/dist/elements/cfpb-list-item/index.js.map +0 -7
- package/dist/elements/cfpb-multiselect/index.js +0 -48
- package/dist/elements/cfpb-multiselect/index.js.map +0 -7
- package/dist/elements/cfpb-pagination/index.js +0 -32
- package/dist/elements/cfpb-pagination/index.js.map +0 -7
- package/dist/elements/cfpb-select/index.css +0 -2
- package/dist/elements/cfpb-select/index.css.map +0 -7
- package/dist/elements/cfpb-select/index.js +0 -42
- package/dist/elements/cfpb-select/index.js.map +0 -7
- package/dist/elements/cfpb-select-list/index.js +0 -39
- package/dist/elements/cfpb-select-list/index.js.map +0 -7
- package/dist/elements/cfpb-tag-filter/index.js +0 -31
- package/dist/elements/cfpb-tag-filter/index.js.map +0 -7
- package/dist/elements/cfpb-tag-group/index.js +0 -29
- package/dist/elements/cfpb-tag-group/index.js.map +0 -7
- package/dist/elements/cfpb-tag-topic/index.js +0 -30
- package/dist/elements/cfpb-tag-topic/index.js.map +0 -7
- package/dist/elements/cfpb-utilities/index.js +0 -2
- package/dist/elements/cfpb-utilities/index.js.map +0 -7
- package/dist/elements/index.css +0 -2
- package/dist/elements/index.css.map +0 -7
- package/dist/elements/index.js +0 -53
- package/dist/elements/index.js.map +0 -7
- package/dist/index.css.map +0 -7
- package/dist/index.js.map +0 -7
- package/dist/utilities/index.css +0 -2
- package/dist/utilities/index.css.map +0 -7
- package/dist/utilities/index.js +0 -2
- 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": "
|
|
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",
|
|
@@ -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
|
|
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
|
|
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';
|
|
@@ -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
|
-
) +
|
|
25
|
+
) +
|
|
26
|
+
em;
|
|
26
27
|
padding-left: math.div(
|
|
27
28
|
math.div($grid-gutter-width, 2),
|
|
28
29
|
$base-font-size-px
|
|
29
|
-
) +
|
|
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
|
-
) +
|
|
37
|
+
) +
|
|
38
|
+
em;
|
|
36
39
|
padding-bottom: math.div(
|
|
37
40
|
math.div($grid-gutter-width, 2),
|
|
38
41
|
$base-font-size-px
|
|
39
|
-
) +
|
|
42
|
+
) +
|
|
43
|
+
em;
|
|
40
44
|
padding-left: math.div(
|
|
41
45
|
math.div($grid-gutter-width, 2),
|
|
42
46
|
$base-font-size-px
|
|
43
|
-
) +
|
|
47
|
+
) +
|
|
48
|
+
em;
|
|
44
49
|
}
|
|
45
50
|
&__img {
|
|
46
51
|
margin-right: auto;
|
|
@@ -80,7 +80,10 @@
|
|
|
80
80
|
margin-top: 0;
|
|
81
81
|
margin-bottom: math.div(5px, $base-font-size-px) + em;
|
|
82
82
|
content: attr(data-label);
|
|
83
|
-
|
|
83
|
+
|
|
84
|
+
// Yeilds 1.83333333
|
|
85
|
+
// TODO: Research alternative to this magic number
|
|
86
|
+
line-height: math.div(11, 6);
|
|
84
87
|
|
|
85
88
|
// h5 size.
|
|
86
89
|
font-size: math.div($size-v, $base-font-size-px) + em;
|
|
@@ -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
|
-
|
|
43
|
-
|
|
41
|
+
// Typography normalization
|
|
42
|
+
--font-adjust-base: 0.517;
|
|
43
|
+
--font-adjust-step: 0.0054;
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
-
|
|
65
|
-
|
|
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'
|
|
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
|
|
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 =
|
|
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
|
|
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 =
|
|
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
|
|
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 =
|
|
16
|
-
${unsafeCSS(styles)}
|
|
17
|
-
`;
|
|
15
|
+
static styles = styles;
|
|
18
16
|
|
|
19
17
|
#flyoutMenu;
|
|
20
18
|
#transition;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { html, LitElement
|
|
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 =
|
|
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
|
|
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 =
|
|
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
|
|
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 =
|
|
19
|
-
${unsafeCSS(styles)}
|
|
20
|
-
`;
|
|
18
|
+
static styles = styles;
|
|
21
19
|
|
|
22
20
|
#checkboxIcon = createRef();
|
|
23
21
|
|
|
@@ -45,6 +45,16 @@
|
|
|
45
45
|
border: 1px solid var(--pacific);
|
|
46
46
|
border-top: 0;
|
|
47
47
|
width: calc(100% - 2px);
|
|
48
|
+
|
|
49
|
+
&::after {
|
|
50
|
+
position: absolute;
|
|
51
|
+
content: '';
|
|
52
|
+
display: block;
|
|
53
|
+
width: 100%;
|
|
54
|
+
height: 1px;
|
|
55
|
+
bottom: -1px;
|
|
56
|
+
border-bottom: 1px solid var(--pacific);
|
|
57
|
+
}
|
|
48
58
|
}
|
|
49
59
|
|
|
50
60
|
.popup.show {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { html, LitElement
|
|
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 =
|
|
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,12 +135,8 @@ export class CfpbFormSearch extends LitElement {
|
|
|
131
135
|
evt.preventDefault();
|
|
132
136
|
if (this.disabled) return;
|
|
133
137
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
if (this.value !== '') {
|
|
137
|
-
this.#internals.setFormValue(this.value);
|
|
138
|
-
this.#internals.form?.requestSubmit();
|
|
139
|
-
}
|
|
138
|
+
this.#internals.setFormValue(this.value);
|
|
139
|
+
this.#internals.form?.requestSubmit();
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
render() {
|
|
@@ -148,7 +148,7 @@ export class CfpbFormSearch extends LitElement {
|
|
|
148
148
|
<div class="container">
|
|
149
149
|
<cfpb-form-search-input
|
|
150
150
|
?name=${this.name}
|
|
151
|
-
|
|
151
|
+
.value=${this.value}
|
|
152
152
|
?placeholder=${this.placeholder}
|
|
153
153
|
title=${this.title}
|
|
154
154
|
?maxlength=${this.maxlength}
|
|
@@ -156,6 +156,7 @@ export class CfpbFormSearch extends LitElement {
|
|
|
156
156
|
?validation=${this.validation}
|
|
157
157
|
@clear=${this.#onClear}
|
|
158
158
|
@input=${this.#onInput}
|
|
159
|
+
@enter-down=${this.#onEnterDown}
|
|
159
160
|
@blur=${this.#onBlur}
|
|
160
161
|
></cfpb-form-search-input>
|
|
161
162
|
|
|
@@ -14,11 +14,14 @@
|
|
|
14
14
|
// Private vars
|
|
15
15
|
--input-border: var(--input-border-default);
|
|
16
16
|
|
|
17
|
+
display: flex;
|
|
18
|
+
|
|
17
19
|
.o-search-input {
|
|
18
20
|
position: relative;
|
|
19
21
|
display: flex;
|
|
20
22
|
width: initial;
|
|
21
23
|
flex: 0 1 100%;
|
|
24
|
+
align-items: center;
|
|
22
25
|
|
|
23
26
|
// Add a min-width for the default width of the text input + clear button,
|
|
24
27
|
// so that when the clear button appears it doesn't bump the input width.
|
|
@@ -33,12 +36,7 @@
|
|
|
33
36
|
label {
|
|
34
37
|
position: absolute;
|
|
35
38
|
left: 10px;
|
|
36
|
-
align-self: center;
|
|
37
39
|
cursor: pointer;
|
|
38
|
-
line-height: math.div(
|
|
39
|
-
14.4px,
|
|
40
|
-
$base-font-size-px
|
|
41
|
-
); // 9px vertically centers icon.
|
|
42
40
|
}
|
|
43
41
|
|
|
44
42
|
// This line-height settings is taken from base.scss.
|
|
@@ -175,6 +173,11 @@
|
|
|
175
173
|
.o-search-input {
|
|
176
174
|
border-color: transparent;
|
|
177
175
|
|
|
176
|
+
input {
|
|
177
|
+
padding-top: math.div(5px, $base-font-size-px) + em;
|
|
178
|
+
padding-bottom: math.div(5px, $base-font-size-px) + em;
|
|
179
|
+
}
|
|
180
|
+
|
|
178
181
|
&:hover,
|
|
179
182
|
&:focus-within {
|
|
180
183
|
border-color: transparent;
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import { html, LitElement
|
|
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 =
|
|
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
|
|
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 =
|
|
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
|
|
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 =
|
|
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
|
|
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 =
|
|
9
|
-
${unsafeCSS(styles)}
|
|
10
|
-
`;
|
|
8
|
+
static styles = styles;
|
|
11
9
|
|
|
12
10
|
#internalSync = false;
|
|
13
11
|
#container = createRef();
|
|
@@ -139,7 +137,7 @@ export class CfpbList extends LitElement {
|
|
|
139
137
|
|
|
140
138
|
// Remove prior listener if present.
|
|
141
139
|
const prev = this.#clickListeners.get(item);
|
|
142
|
-
if (prev) item.removeEventListener('click
|
|
140
|
+
if (prev) item.removeEventListener('item-click', prev);
|
|
143
141
|
|
|
144
142
|
// Listener that toggles the item before handling.
|
|
145
143
|
const listener = (evt) => {
|
|
@@ -148,7 +146,7 @@ export class CfpbList extends LitElement {
|
|
|
148
146
|
this.#handleToggle(item, item.checked, index);
|
|
149
147
|
};
|
|
150
148
|
|
|
151
|
-
item.addEventListener('click
|
|
149
|
+
item.addEventListener('item-click', listener);
|
|
152
150
|
this.#clickListeners.set(item, listener);
|
|
153
151
|
|
|
154
152
|
// Track focus index.
|
|
@@ -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
|
}
|