@cfpb/cfpb-design-system 3.4.14 → 3.6.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 +39 -1
- package/dist/components/cfpb-expandables/index.css +1 -1
- package/dist/components/cfpb-expandables/index.css.map +2 -2
- package/dist/components/cfpb-expandables/index.js.map +1 -1
- package/dist/components/cfpb-forms/index.css +1 -1
- package/dist/components/cfpb-forms/index.css.map +2 -2
- package/dist/components/cfpb-forms/index.js.map +1 -1
- package/dist/components/cfpb-layout/index.css +1 -1
- package/dist/components/cfpb-layout/index.css.map +2 -2
- package/dist/components/cfpb-layout/index.js +1 -1
- package/dist/components/cfpb-layout/index.js.map +1 -1
- package/dist/components/cfpb-tooltips/index.css +3 -0
- package/dist/components/cfpb-tooltips/index.css.map +7 -0
- package/dist/components/cfpb-tooltips/index.js +2 -0
- package/dist/components/cfpb-tooltips/index.js.map +7 -0
- package/dist/index.css +1 -1
- package/dist/index.css.map +2 -2
- package/dist/index.js.map +1 -1
- package/dist/utilities/index.css +1 -1
- package/dist/utilities/index.css.map +2 -2
- package/dist/utilities/index.js.map +1 -1
- package/package.json +9 -3
- package/src/components/cfpb-layout/featured-content-module.scss +0 -22
- package/src/components/cfpb-layout/hero.scss +10 -1
- package/src/components/cfpb-tooltips/index.js +79 -0
- package/src/components/cfpb-tooltips/tooltip.scss +36 -0
package/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cfpb/cfpb-design-system",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
4
4
|
"description": "CFPB's UI framework",
|
|
5
|
-
"
|
|
5
|
+
"exports": {
|
|
6
|
+
".": "./src/index.js",
|
|
7
|
+
"./tooltips": "./src/components/cfpb-tooltips/index.js"
|
|
8
|
+
},
|
|
6
9
|
"author": {
|
|
7
10
|
"name": "Consumer Financial Protection Bureau",
|
|
8
11
|
"email": "tech@cfpb.gov",
|
|
@@ -21,5 +24,8 @@
|
|
|
21
24
|
"url": "https://github.com/cfpb/design-system/issues"
|
|
22
25
|
},
|
|
23
26
|
"gitHead": "d9b9862ef0a34a0ca6f4835347ac7f202ed50e3e",
|
|
24
|
-
"type": "module"
|
|
27
|
+
"type": "module",
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"tippy.js": "6.3.7"
|
|
30
|
+
}
|
|
25
31
|
}
|
|
@@ -70,26 +70,4 @@
|
|
|
70
70
|
transform: translateX(-50%);
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
|
|
74
|
-
// Modifiers
|
|
75
|
-
&--left {
|
|
76
|
-
/* Left modifier doesn't have a border/background. If in the future we
|
|
77
|
-
have a left arranged FCM we'll want to make the border/background
|
|
78
|
-
its own modifer */
|
|
79
|
-
border: initial;
|
|
80
|
-
background-color: initial;
|
|
81
|
-
|
|
82
|
-
.o-featured-content-module__visual {
|
|
83
|
-
left: 0;
|
|
84
|
-
right: initial;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
.o-featured-content-module__text {
|
|
88
|
-
// Tablet and above.
|
|
89
|
-
@include respond-to-min($bp-sm-min) {
|
|
90
|
-
padding-left: $fcm-visual-width + $grid-gutter-width;
|
|
91
|
-
padding-right: math.div($grid-gutter-width, $base-font-size-px) + em;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
73
|
}
|
|
@@ -108,6 +108,7 @@ $hero-desktop-height: 285px;
|
|
|
108
108
|
&__image-wrapper {
|
|
109
109
|
margin-top: math.div($grid-gutter-width, $base-font-size-px) + em;
|
|
110
110
|
}
|
|
111
|
+
|
|
111
112
|
&--overlay {
|
|
112
113
|
.m-hero__wrapper {
|
|
113
114
|
// Overwrite the image that is set in the markup because
|
|
@@ -115,6 +116,7 @@ $hero-desktop-height: 285px;
|
|
|
115
116
|
background-image: none !important;
|
|
116
117
|
}
|
|
117
118
|
}
|
|
119
|
+
|
|
118
120
|
&--jumbo {
|
|
119
121
|
.m-hero__wrapper {
|
|
120
122
|
// Keep hero image flush with container on mobile
|
|
@@ -130,6 +132,7 @@ $hero-desktop-height: 285px;
|
|
|
130
132
|
&__heading {
|
|
131
133
|
@include heading-2($is-responsive: false);
|
|
132
134
|
}
|
|
135
|
+
|
|
133
136
|
&__subhead {
|
|
134
137
|
font-size: $size-iv;
|
|
135
138
|
}
|
|
@@ -145,9 +148,11 @@ $hero-desktop-height: 285px;
|
|
|
145
148
|
padding-left: math.div($grid-gutter-width, 2);
|
|
146
149
|
min-height: $hero-desktop-height - ($grid-gutter-width * 2);
|
|
147
150
|
}
|
|
151
|
+
|
|
148
152
|
&__text {
|
|
149
|
-
margin: auto;
|
|
153
|
+
margin: auto 0;
|
|
150
154
|
}
|
|
155
|
+
|
|
151
156
|
&__image-wrapper {
|
|
152
157
|
padding-right: math.div($grid-gutter-width, 2);
|
|
153
158
|
padding-left: math.div(
|
|
@@ -157,6 +162,7 @@ $hero-desktop-height: 285px;
|
|
|
157
162
|
display: flex;
|
|
158
163
|
align-items: center;
|
|
159
164
|
}
|
|
165
|
+
|
|
160
166
|
&--bleeding {
|
|
161
167
|
.m-hero__image-wrapper {
|
|
162
168
|
width: 100%;
|
|
@@ -172,11 +178,13 @@ $hero-desktop-height: 285px;
|
|
|
172
178
|
background-size: cover;
|
|
173
179
|
}
|
|
174
180
|
}
|
|
181
|
+
|
|
175
182
|
&--overlay {
|
|
176
183
|
.m-hero__image {
|
|
177
184
|
display: none;
|
|
178
185
|
}
|
|
179
186
|
}
|
|
187
|
+
|
|
180
188
|
&--jumbo {
|
|
181
189
|
.m-hero__wrapper {
|
|
182
190
|
background-position: 50%;
|
|
@@ -187,6 +195,7 @@ $hero-desktop-height: 285px;
|
|
|
187
195
|
display: none;
|
|
188
196
|
}
|
|
189
197
|
}
|
|
198
|
+
|
|
190
199
|
&--50-50 {
|
|
191
200
|
.m-hero__wrapper {
|
|
192
201
|
grid-template-columns: 1fr 1fr;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/* ==========================================================================
|
|
2
|
+
Tooltip Organism
|
|
3
|
+
========================================================================== */
|
|
4
|
+
|
|
5
|
+
import tippy from 'tippy.js';
|
|
6
|
+
import { instantiateAll } from '@cfpb/cfpb-design-system';
|
|
7
|
+
|
|
8
|
+
import * as TooltipStyles from './tooltip.scss';
|
|
9
|
+
|
|
10
|
+
const BASE_ATTRIBUTE = 'data-tooltip';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Tooltip
|
|
14
|
+
* @class
|
|
15
|
+
* @classdesc Initializes a new Tooltip.
|
|
16
|
+
* @param {HTMLElement} element - The DOM element that should
|
|
17
|
+
* activate the tooltip.
|
|
18
|
+
* @returns {Tooltip} An instance.
|
|
19
|
+
*/
|
|
20
|
+
function Tooltip(element) {
|
|
21
|
+
const tooltipContent = element.getAttribute(BASE_ATTRIBUTE);
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Set up and create the tooltip.
|
|
25
|
+
* @returns {Tooltip} An instance.
|
|
26
|
+
*/
|
|
27
|
+
function init() {
|
|
28
|
+
tippy(element, {
|
|
29
|
+
theme: 'cfpb',
|
|
30
|
+
maxWidth: 450,
|
|
31
|
+
content: function (reference) {
|
|
32
|
+
const template = reference.parentElement.querySelector(
|
|
33
|
+
`#${tooltipContent}`,
|
|
34
|
+
);
|
|
35
|
+
const container = document.createElement('div');
|
|
36
|
+
const node = document.importNode(template.content, true);
|
|
37
|
+
container.appendChild(node);
|
|
38
|
+
return container;
|
|
39
|
+
},
|
|
40
|
+
// See https://atomiks.github.io/tippyjs/v6/plugins/
|
|
41
|
+
plugins: [
|
|
42
|
+
{
|
|
43
|
+
name: 'hideOnEsc',
|
|
44
|
+
defaultValue: true,
|
|
45
|
+
fn({ hide }) {
|
|
46
|
+
/**
|
|
47
|
+
* Hide when the escape key is pressed.
|
|
48
|
+
* @param {KeyboardEvent} event - Key down event.
|
|
49
|
+
*/
|
|
50
|
+
function onKeyDown(event) {
|
|
51
|
+
if (event.key === 'Escape') {
|
|
52
|
+
hide();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
onShow() {
|
|
57
|
+
document.body.addEventListener('keydown', onKeyDown);
|
|
58
|
+
},
|
|
59
|
+
onHide() {
|
|
60
|
+
document.body.removeEventListener('keydown', onKeyDown);
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Attach public events.
|
|
70
|
+
this.init = init;
|
|
71
|
+
|
|
72
|
+
return this;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
Tooltip.BASE_ATTRIBUTE = BASE_ATTRIBUTE;
|
|
76
|
+
Tooltip.init = (scope) =>
|
|
77
|
+
instantiateAll(`[${Tooltip.BASE_ATTRIBUTE}]`, Tooltip, scope);
|
|
78
|
+
|
|
79
|
+
export { Tooltip, TooltipStyles };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
@use 'sass:math';
|
|
2
|
+
@use '@cfpb/cfpb-design-system/src/abstracts' as *;
|
|
3
|
+
@use 'tippy.js/dist/tippy.css';
|
|
4
|
+
@use 'tippy.js/dist/border.css';
|
|
5
|
+
|
|
6
|
+
// Custom theme, see https://atomiks.github.io/tippyjs/v6/themes/
|
|
7
|
+
.tippy-box[data-theme='cfpb'] {
|
|
8
|
+
background-color: var(--gray-5);
|
|
9
|
+
border: 1px solid var(--gray-40);
|
|
10
|
+
border-radius: 0;
|
|
11
|
+
color: var(--black);
|
|
12
|
+
padding: math.div(15px, $base-font-size-px) + rem;
|
|
13
|
+
|
|
14
|
+
.tippy-arrow {
|
|
15
|
+
color: var(--gray-5);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.tippy-heading {
|
|
19
|
+
font-weight: 500;
|
|
20
|
+
font-size: math.div(18px, $base-font-size-px) + rem;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.tippy-body {
|
|
24
|
+
font-size: math.div(16px, $base-font-size-px) + rem;
|
|
25
|
+
margin-top: math.div(15px, $base-font-size-px) + rem;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
[data-tooltip] {
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
|
|
32
|
+
// Hide tooltip trigger elements when JS isn't supported
|
|
33
|
+
.no-js & {
|
|
34
|
+
display: none;
|
|
35
|
+
}
|
|
36
|
+
}
|