@cfpb/cfpb-design-system 3.2.10 → 3.2.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cfpb/cfpb-design-system",
3
- "version": "3.2.10",
3
+ "version": "3.2.11",
4
4
  "description": "CFPB's UI framework",
5
5
  "main": "src/index.js",
6
6
  "author": {
@@ -13,9 +13,18 @@ input.a-btn::-moz-focus-inner {
13
13
  border: 0;
14
14
  }
15
15
 
16
+ @mixin a-btn-divider() {
17
+ content: '';
18
+ border-left: 1px solid $btn-divider;
19
+ order: 2;
20
+ place-self: normal;
21
+ }
22
+
16
23
  @mixin a-btn() {
17
24
  appearance: none;
18
- display: inline-block;
25
+ display: flex;
26
+ gap: math.div(10px, $base-font-size-px) + rem;
27
+
19
28
  box-sizing: border-box;
20
29
  padding: math.div($btn-v-padding, $btn-font-size) + em
21
30
  math.div($btn-h-padding, $btn-font-size) + em;
@@ -156,6 +165,37 @@ input.a-btn::-moz-focus-inner {
156
165
  width: 100%;
157
166
  }
158
167
  }
168
+
169
+ // Handle button with icon logic.
170
+ &:has(svg)::before {
171
+ @include a-btn-divider;
172
+ }
173
+
174
+ &--secondary:has(svg)::before {
175
+ border-color: $btn-secondary-divider;
176
+ }
177
+
178
+ &--warning:has(svg)::before {
179
+ border-color: $btn-warning-divider;
180
+ }
181
+
182
+ &--disabled:has(svg)::before,
183
+ &[disabled]:has(svg)::before {
184
+ border-color: $btn-disabled-divider;
185
+ }
186
+
187
+ // Set either the text or icon as the last item in the button.
188
+ &:has(svg + span) {
189
+ span {
190
+ order: 3;
191
+ }
192
+ }
193
+
194
+ &:has(span + svg) {
195
+ svg {
196
+ order: 3;
197
+ }
198
+ }
159
199
  }
160
200
 
161
201
  .a-btn {
@@ -1,4 +1,3 @@
1
1
  export * as buttonStyles from './button.scss';
2
2
  export * as buttonGroupStyles from './button-group.scss';
3
3
  export * as buttonLinkStyles from './button-link.scss';
4
- export * as buttonWithIconStyles from './button-with-icon.scss';
@@ -7,77 +7,52 @@
7
7
  //
8
8
 
9
9
  .m-pagination {
10
- position: relative;
10
+ display: grid;
11
+ grid-template-columns: auto 1fr auto;
12
+ grid-template-areas:
13
+ 'pag-btn-prev . pag-btn-next'
14
+ 'pag-form pag-form pag-form';
15
+ row-gap: math.div(15px, $base-font-size-px) + rem;
11
16
 
12
17
  &__form {
13
- padding: math.div(5px, $base-font-size-px) + em;
14
- border-radius: math.div(4px, $base-font-size-px) + em;
18
+ grid-area: pag-form;
19
+ display: flex;
20
+ flex-flow: wrap;
21
+ place-content: center;
22
+ gap: math.div(10px, $base-font-size-px) + rem;
23
+
24
+ padding: math.div(5px, $base-font-size-px) + rem;
25
+ border-radius: math.div(4px, $base-font-size-px) + rem;
15
26
  background: $pagination-bg;
16
27
  color: $pagination-text;
17
- text-align: center;
18
28
  }
19
29
 
20
30
  &__current-page {
21
31
  // 45px is a magic number to provide enough room for three digits
22
32
  // and the number spinners for type="number" inputs on desktop
23
- width: math.div(45px, $base-font-size-px) + em;
33
+ width: math.div(45px, $base-font-size-px) + rem;
24
34
 
25
- // 10px + a normal inline single space ~= spec'ed value of 15px
26
- margin-right: math.div(10px, $base-font-size-px) + em;
27
- margin-left: math.div(10px, $base-font-size-px) + em;
28
35
  font-weight: 500;
29
36
  text-align: right;
30
37
  }
31
38
 
32
39
  &__label {
33
- display: inline-block;
34
-
35
- // 10px + a normal inline single space ~= spec'ed value of 15px
36
- margin-right: math.div(10px, $base-font-size-px) + em;
37
- vertical-align: middle;
38
- }
39
-
40
- &__btn-submit {
41
- margin: 0;
42
- vertical-align: middle;
40
+ display: contents;
41
+ white-space: nowrap;
43
42
  }
44
43
 
45
- &__btn-prev,
46
- &__btn-next {
47
- min-width: $pagination-btn-min-width-px;
48
-
49
- // 22px is a magic number to vertically center the type in the button
50
- // TODO: Consider refactoring with flexbox for vertical centering
51
- line-height: 22px;
52
- text-align: center;
53
-
54
- &.a-btn--disabled {
55
- background-color: $pagination-bg;
56
- border-color: transparent;
57
- }
44
+ &__btn-prev {
45
+ grid-area: pag-btn-prev;
58
46
  }
59
-
60
47
  &__btn-next {
61
- position: absolute;
62
- right: 0;
63
- }
64
-
65
- // Mobile only.
66
- @include respond-to-max($bp-xs-max) {
67
- &__btn-prev,
68
- &__btn-next {
69
- margin-bottom: math.div(15px, $base-font-size-px) + em;
70
- }
48
+ grid-area: pag-btn-next;
71
49
  }
72
50
 
73
51
  // Tablet and above.
74
52
  @include respond-to-min($bp-sm-min) {
75
- &__btn-prev,
76
- &__btn-next {
77
- height: 100%;
78
- }
53
+ grid-template-areas: 'pag-btn-prev pag-form pag-btn-next';
54
+
79
55
  &__btn-prev {
80
- position: absolute;
81
56
  border-top-right-radius: 0;
82
57
  border-bottom-right-radius: 0;
83
58
  }
@@ -1,34 +0,0 @@
1
- @use 'sass:math';
2
- @use '@cfpb/cfpb-design-system/src/abstracts' as *;
3
- @use './vars.scss' as *;
4
-
5
- // Icon locations
6
- // TODO: Replace magic numbers with calculations based off of the
7
- // button padding size.
8
-
9
- .a-btn__icon--on-left {
10
- padding-right: math.div(11px, $btn-font-size) + em;
11
- border-right: 1px solid $btn-divider;
12
- margin-right: math.div(7px, $btn-font-size) + em;
13
- }
14
-
15
- .a-btn__icon--on-right {
16
- padding-left: math.div(11px, $btn-font-size) + em;
17
- border-left: 1px solid $btn-divider;
18
- margin-left: math.div(7px, $btn-font-size) + em;
19
- }
20
-
21
- .a-btn__icon {
22
- .a-btn--secondary & {
23
- border-color: $btn-secondary-divider;
24
- }
25
-
26
- .a-btn--warning & {
27
- border-color: $btn-warning-divider;
28
- }
29
-
30
- .a-btn--disabled &,
31
- .a-btn[disabled] & {
32
- border-color: $btn-disabled-divider;
33
- }
34
- }