@cfpb/cfpb-design-system 3.4.5 → 3.4.7

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 (32) hide show
  1. package/CHANGELOG.md +24 -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-group.scss +1 -0
  30. package/src/components/cfpb-buttons/button-link.scss +71 -82
  31. package/src/components/cfpb-buttons/button.scss +25 -21
  32. 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.5",
3
+ "version": "3.4.7",
4
4
  "description": "CFPB's UI framework",
5
5
  "main": "src/index.js",
6
6
  "author": {
@@ -6,4 +6,5 @@
6
6
  gap: math.div(10px, $base-font-size-px) + rem;
7
7
  flex-wrap: wrap;
8
8
  align-items: center;
9
+ width: fit-content;
9
10
  }
@@ -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,97 @@
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;
39
+ color: $f;
74
40
  }
75
41
 
76
42
  &:active,
77
43
  &.active {
78
- text-decoration-color: $btn-secondary-bg-active;
79
- color: $btn-secondary-bg-active;
80
- }
81
- }
82
-
83
- //
84
- // Destructive action button link
85
- //
86
-
87
- &.a-btn--warning {
88
- &,
89
- &:link,
90
- &:visited {
91
- text-decoration-color: $btn-warning-bg;
44
+ text-decoration-color: $a;
45
+ text-decoration-style: solid;
92
46
  background-color: transparent;
93
- color: $btn-warning-bg;
47
+ color: $a;
94
48
  }
49
+ }
50
+ }
95
51
 
96
- &:hover,
97
- &.hover {
98
- text-decoration-color: $btn-warning-bg-hover;
99
- color: $btn-warning-bg-hover;
100
- }
52
+ .a-btn--link {
53
+ // Padding added so the focus rectangle falls below the underline.
54
+ padding: 1.5px 0;
55
+ border-radius: 0;
56
+ text-decoration-line: underline;
57
+ text-decoration-thickness: 1px;
58
+ text-decoration-style: dotted;
59
+ text-underline-offset: 4.5px;
101
60
 
102
- &:focus,
103
- &.focus {
104
- outline-color: $btn-warning-bg;
105
- }
61
+ &:has(svg) {
62
+ // Button links should be closer to their icon.
63
+ gap: math.div(5px, $base-font-size-px) + rem;
106
64
 
107
- &:active,
108
- &.active {
109
- text-decoration-color: $btn-warning-bg-active;
110
- color: $btn-warning-bg-active;
65
+ // Button links shouldn't have a divider.
66
+ &::before {
67
+ display: none;
111
68
  }
112
69
  }
113
70
  }
71
+
72
+ @include u-btn-link-states(
73
+ '.a-btn--link',
74
+ $link-text,
75
+ $link-text-hover,
76
+ $link-text,
77
+ $link-text-active
78
+ );
79
+
80
+ //
81
+ // Secondary button link
82
+ //
83
+
84
+ @include u-btn-link-states(
85
+ '.a-btn--link.a-btn--secondary',
86
+ $btn-secondary-bg,
87
+ $btn-secondary-bg-hover,
88
+ $btn-secondary-bg,
89
+ $btn-secondary-bg-active
90
+ );
91
+
92
+ //
93
+ // Destructive action button link
94
+ //
95
+
96
+ @include u-btn-link-states(
97
+ '.a-btn--link.a-btn--warning',
98
+ $btn-warning-bg,
99
+ $btn-warning-bg-hover,
100
+ $btn-warning-bg,
101
+ $btn-warning-bg-active
102
+ );
@@ -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;
@@ -24,7 +24,6 @@ input.a-btn::-moz-focus-inner {
24
24
  appearance: none;
25
25
  display: flex;
26
26
  gap: math.div(10px, $base-font-size-px) + rem;
27
- justify-content: center;
28
27
 
29
28
  box-sizing: border-box;
30
29
  padding: math.div($btn-v-padding, $btn-font-size) + em
@@ -39,6 +38,9 @@ input.a-btn::-moz-focus-inner {
39
38
  text-align: center;
40
39
  text-decoration: none;
41
40
  transition: background-color 0.1s;
41
+ width: fit-content;
42
+ height: fit-content;
43
+ justify-content: center;
42
44
 
43
45
  &,
44
46
  &:link,
@@ -167,42 +169,44 @@ input.a-btn::-moz-focus-inner {
167
169
  }
168
170
  }
169
171
 
170
- // Handle button with icon logic.
171
- &:not(.a-btn--hide-icon):has(svg)::before {
172
- @include a-btn-divider;
172
+ // Set either the text or icon as the last item in the button.
173
+ &:has(svg + span) {
174
+ span {
175
+ order: 3;
176
+ }
173
177
  }
174
178
 
175
- // Hide the icon if the a-btn--hide-icon modifier is set.
176
- // Useful for showing and hiding a loading icon, for example.
177
- &--hide-icon {
179
+ &:has(span + svg) {
178
180
  svg {
179
- display: none;
181
+ order: 3;
180
182
  }
181
183
  }
182
184
 
185
+ // Handle button with icon divider logic.
186
+ &:not(.a-btn--hide-icon):has(svg + span)::before,
187
+ &:not(.a-btn--hide-icon):has(span + svg)::before {
188
+ @include u-btn-divider;
189
+ }
190
+
191
+ // Handle different coloring in divider.
183
192
  &--secondary:has(svg)::before {
184
- border-color: $btn-secondary-divider;
193
+ border-color: $btn-secondary-divider !important;
185
194
  }
186
195
 
187
196
  &--warning:has(svg)::before {
188
- border-color: $btn-warning-divider;
197
+ border-color: $btn-warning-divider !important;
189
198
  }
190
199
 
191
200
  &--disabled:has(svg)::before,
192
201
  &[disabled]:has(svg)::before {
193
- border-color: $btn-disabled-divider;
194
- }
195
-
196
- // Set either the text or icon as the last item in the button.
197
- &:has(svg + span) {
198
- span {
199
- order: 3;
200
- }
202
+ border-color: $btn-disabled-divider !important;
201
203
  }
202
204
 
203
- &:has(span + svg) {
205
+ // Hide the icon if the a-btn--hide-icon modifier is set.
206
+ // Useful for showing and hiding a loading icon, for example.
207
+ &--hide-icon {
204
208
  svg {
205
- order: 3;
209
+ display: none;
206
210
  }
207
211
  }
208
212
  }
@@ -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: '',