@cfpb/cfpb-design-system 3.4.4 → 3.4.6

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 (31) hide show
  1. package/CHANGELOG.md +22 -1
  2. package/dist/components/cfpb-buttons/index.css +1 -1
  3. package/dist/components/cfpb-buttons/index.css.map +2 -2
  4. package/dist/components/cfpb-buttons/index.js +1 -1
  5. package/dist/components/cfpb-buttons/index.js.map +1 -1
  6. package/dist/components/cfpb-expandables/index.css +1 -1
  7. package/dist/components/cfpb-expandables/index.css.map +2 -2
  8. package/dist/components/cfpb-expandables/index.js +1 -1
  9. package/dist/components/cfpb-expandables/index.js.map +1 -1
  10. package/dist/components/cfpb-forms/index.css +1 -1
  11. package/dist/components/cfpb-forms/index.css.map +2 -2
  12. package/dist/components/cfpb-forms/index.js +1 -1
  13. package/dist/components/cfpb-forms/index.js.map +1 -1
  14. package/dist/components/cfpb-notifications/index.css.map +2 -2
  15. package/dist/components/cfpb-notifications/index.js +1 -1
  16. package/dist/components/cfpb-notifications/index.js.map +1 -1
  17. package/dist/components/cfpb-typography/index.css.map +2 -2
  18. package/dist/components/cfpb-typography/index.js +1 -1
  19. package/dist/components/cfpb-typography/index.js.map +1 -1
  20. package/dist/index.css +1 -1
  21. package/dist/index.css.map +2 -2
  22. package/dist/index.js +1 -1
  23. package/dist/index.js.map +1 -1
  24. package/dist/utilities/index.css +1 -1
  25. package/dist/utilities/index.css.map +2 -2
  26. package/dist/utilities/index.js +1 -1
  27. package/dist/utilities/index.js.map +1 -1
  28. package/package.json +1 -1
  29. package/src/components/cfpb-buttons/button-link.scss +71 -81
  30. package/src/components/cfpb-buttons/button.scss +16 -14
  31. package/src/utilities/utilities.scss +15 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cfpb/cfpb-design-system",
3
- "version": "3.4.4",
3
+ "version": "3.4.6",
4
4
  "description": "CFPB's UI framework",
5
5
  "main": "src/index.js",
6
6
  "author": {
@@ -1,3 +1,4 @@
1
+ @use 'sass:math';
1
2
  @use './vars.scss' as *;
2
3
  @use '@cfpb/cfpb-design-system/src/abstracts' as *;
3
4
 
@@ -5,109 +6,98 @@
5
6
  // Button link
6
7
  //
7
8
 
8
- // TODO: Refactor the rule combos for simplicity
9
-
10
- .a-btn--link {
11
- padding: 0;
12
-
13
- // Padding added so the focus rectangle falls below the underline.
14
- padding-bottom: 1.5px;
15
- border-radius: 0;
16
- text-decoration-line: underline;
17
- text-decoration-thickness: 1px;
18
- text-decoration-style: dotted;
19
- text-underline-offset: 4.5px;
20
-
21
- &,
22
- &:link,
23
- &:visited {
24
- text-decoration-color: $link-underline;
25
- background-color: transparent;
26
- color: $link-text;
27
- }
28
-
29
- &:hover,
30
- &.hover {
31
- text-decoration-color: $link-underline-hover;
32
- text-decoration-style: solid;
33
- background-color: transparent;
34
- color: $link-text-hover;
35
- }
36
-
37
- &:focus,
38
- &.focus {
39
- text-decoration-style: solid;
40
- background-color: transparent;
41
- outline: 1px dotted $link-underline;
42
- }
43
-
44
- &:active,
45
- &.active {
46
- text-decoration-color: $link-underline-active;
47
- text-decoration-style: solid;
48
- background-color: transparent;
49
- color: $link-text-active;
50
- }
51
-
52
- //
53
- // Secondary button link
54
- //
55
-
56
- &.a-btn--secondary {
9
+ /*
10
+ Link text and underline.
11
+ $v: Link link and visited color.
12
+ $h: Link hover color.
13
+ $f: Link focus color.
14
+ $a: Link active color.
15
+ */
16
+ @mixin u-btn-link-states($selector, $v, $h, $f, $a) {
17
+ #{$selector} {
57
18
  &,
58
19
  &:link,
59
20
  &:visited {
60
- text-decoration-color: $btn-secondary-bg;
21
+ text-decoration-color: $v;
61
22
  background-color: transparent;
62
- color: $btn-secondary-bg;
23
+ color: $v;
63
24
  }
64
25
 
65
26
  &:hover,
66
27
  &.hover {
67
- text-decoration-color: $btn-secondary-bg-hover;
68
- color: $btn-secondary-bg-hover;
28
+ text-decoration-color: $h;
29
+ text-decoration-style: solid;
30
+ background-color: transparent;
31
+ color: $h;
69
32
  }
70
33
 
71
34
  &:focus,
72
35
  &.focus {
73
- outline-color: $btn-secondary-bg;
36
+ text-decoration-style: solid;
37
+ background-color: transparent;
38
+ outline: 1px dotted $f;
74
39
  }
75
40
 
76
41
  &:active,
77
42
  &.active {
78
- text-decoration-color: $btn-secondary-bg-active;
79
- color: $btn-secondary-bg-active;
43
+ text-decoration-color: $a;
44
+ text-decoration-style: solid;
45
+ background-color: transparent;
46
+ color: $a;
80
47
  }
81
48
  }
49
+ }
82
50
 
83
- //
84
- // Destructive action button link
85
- //
86
-
87
- &.a-btn--warning {
88
- &,
89
- &:link,
90
- &:visited {
91
- text-decoration-color: $btn-warning-bg;
92
- background-color: transparent;
93
- color: $btn-warning-bg;
94
- }
51
+ .a-btn--link {
52
+ padding: 0;
95
53
 
96
- &:hover,
97
- &.hover {
98
- text-decoration-color: $btn-warning-bg-hover;
99
- color: $btn-warning-bg-hover;
100
- }
54
+ // Padding added so the focus rectangle falls below the underline.
55
+ padding-bottom: 1.5px;
56
+ border-radius: 0;
57
+ text-decoration-line: underline;
58
+ text-decoration-thickness: 1px;
59
+ text-decoration-style: dotted;
60
+ text-underline-offset: 4.5px;
101
61
 
102
- &:focus,
103
- &.focus {
104
- outline-color: $btn-warning-bg;
105
- }
62
+ &:has(svg) {
63
+ // Button links should be closer to their icon.
64
+ gap: math.div(5px, $base-font-size-px) + rem;
106
65
 
107
- &:active,
108
- &.active {
109
- text-decoration-color: $btn-warning-bg-active;
110
- color: $btn-warning-bg-active;
66
+ // Button links shouldn't have a divider.
67
+ &::before {
68
+ display: none;
111
69
  }
112
70
  }
113
71
  }
72
+
73
+ @include u-btn-link-states(
74
+ '.a-btn--link',
75
+ $link-text,
76
+ $link-text-hover,
77
+ $link-text,
78
+ $link-text-active
79
+ );
80
+
81
+ //
82
+ // Secondary button link
83
+ //
84
+
85
+ @include u-btn-link-states(
86
+ '.a-btn--link.a-btn--secondary',
87
+ $btn-secondary-bg,
88
+ $btn-secondary-bg-hover,
89
+ $btn-secondary-bg,
90
+ $btn-secondary-bg-active
91
+ );
92
+
93
+ //
94
+ // Destructive action button link
95
+ //
96
+
97
+ @include u-btn-link-states(
98
+ '.a-btn--link.a-btn--warning',
99
+ $btn-warning-bg,
100
+ $btn-warning-bg-hover,
101
+ $btn-warning-bg,
102
+ $btn-warning-bg-active
103
+ );
@@ -13,7 +13,7 @@ input.a-btn::-moz-focus-inner {
13
13
  border: 0;
14
14
  }
15
15
 
16
- @mixin a-btn-divider() {
16
+ @mixin u-btn-divider() {
17
17
  content: '';
18
18
  border-left: 1px solid $btn-divider;
19
19
  order: 2;
@@ -38,6 +38,8 @@ input.a-btn::-moz-focus-inner {
38
38
  text-align: center;
39
39
  text-decoration: none;
40
40
  transition: background-color 0.1s;
41
+ width: fit-content;
42
+ justify-content: center;
41
43
 
42
44
  &,
43
45
  &:link,
@@ -166,19 +168,6 @@ input.a-btn::-moz-focus-inner {
166
168
  }
167
169
  }
168
170
 
169
- // Handle button with icon logic.
170
- &:not(.a-btn--hide-icon):has(svg)::before {
171
- @include a-btn-divider;
172
- }
173
-
174
- // Hide the icon if the a-btn--hide-icon modifier is set.
175
- // Useful for showing and hiding a loading icon, for example.
176
- &--hide-icon {
177
- svg {
178
- display: none;
179
- }
180
- }
181
-
182
171
  &--secondary:has(svg)::before {
183
172
  border-color: $btn-secondary-divider;
184
173
  }
@@ -204,6 +193,19 @@ input.a-btn::-moz-focus-inner {
204
193
  order: 3;
205
194
  }
206
195
  }
196
+
197
+ // Handle button with icon divider logic.
198
+ &:not(.a-btn--hide-icon):has(svg)::before {
199
+ @include u-btn-divider;
200
+ }
201
+
202
+ // Hide the icon if the a-btn--hide-icon modifier is set.
203
+ // Useful for showing and hiding a loading icon, for example.
204
+ &--hide-icon {
205
+ svg {
206
+ display: none;
207
+ }
208
+ }
207
209
  }
208
210
 
209
211
  .a-btn {
@@ -158,6 +158,21 @@
158
158
  // Link mixins
159
159
  //
160
160
 
161
+ /*
162
+ Link text and underline, unless otherwise specified.
163
+ $c: Link color.
164
+ $v: Link visited color.
165
+ $h: Link hover color.
166
+ $f: Link focus color.
167
+ $a: Link active color.
168
+
169
+ // Separate out a different underline color.
170
+ $bc: Link underline color.
171
+ $bv: Link underline visited color.
172
+ $bh: Link underline hover color.
173
+ $bf: Link underline focus color.
174
+ $ba: Link underline active color.
175
+ */
161
176
  /* stylelint-disable selector-class-pattern */
162
177
  @mixin u-link-colors(
163
178
  $c: '',