|
1 | 1 | .s-btn-group { |
2 | | - display: flex; |
3 | | - flex-wrap: wrap; |
4 | | - margin-bottom: 1px; // Compensate for buttons having a margin bottom of -1px to account for row wrapping |
5 | | - |
6 | | - .s-btn { |
7 | | - margin-bottom: -1px; // When wrapping we need to account for the border |
8 | | - white-space: nowrap; // When the buttons wrap, they get super tall and mess up the whole layout |
| 2 | + // CONTEXTUAL STYLES |
| 3 | + #stacks-internals #screen-sm({ |
| 4 | + .s-btn { |
| 5 | + &.s-btn__dropdown { |
| 6 | + padding-right: 1.2em; |
9 | 7 |
|
10 | | - // If it isn't the last button, we should slide the button over to account for border thickness |
11 | | - &:not(:last-child) { |
12 | | - margin-right: -1px; |
13 | | - } |
| 8 | + &:after { |
| 9 | + right: 0.4em; |
| 10 | + } |
| 11 | + } |
14 | 12 |
|
15 | | - // We don't want border-radii on interior buttons |
16 | | - &:not(:first-child):not(:last-child) { |
17 | | - border-radius: 0; |
| 13 | + padding-left: 0.4em; |
| 14 | + padding-right: 0.4em; |
18 | 15 | } |
| 16 | + }, @force-selector: true); |
19 | 17 |
|
20 | | - // Kill the right border radius on the first button |
21 | | - &:first-child:not(:only-child) { |
22 | | - border-top-right-radius: 0; |
23 | | - border-bottom-right-radius: 0; |
24 | | - } |
| 18 | + // VARIANTS |
| 19 | + &:not(&--radio) .s-btn:not(:first-child):not(:last-child), |
| 20 | + &&--radio .s-btn:not(:first-of-type):not(:last-of-type) { |
| 21 | + border-radius: 0; |
| 22 | + } |
25 | 23 |
|
26 | | - // Kill the left border radius on the last button |
27 | | - &:last-child:not(:only-child) { |
28 | | - border-top-left-radius: 0; |
29 | | - border-bottom-left-radius: 0; |
30 | | - } |
| 24 | + &:not(&--radio) .s-btn:first-child:not(:only-child), |
| 25 | + &&--radio .s-btn:first-of-type:not(:last-of-type) { |
| 26 | + border-top-right-radius: 0; |
| 27 | + border-bottom-right-radius: 0; |
| 28 | + } |
31 | 29 |
|
32 | | - // When the button is active or selected, it should pop above its siblings |
33 | | - &.is-selected { |
34 | | - z-index: var(--zi-selected); |
35 | | - } |
| 30 | + &:not(&--radio) .s-btn:last-child:not(:only-child), |
| 31 | + &&--radio .s-btn:last-of-type:not(:first-of-type) { |
| 32 | + border-top-left-radius: 0; |
| 33 | + border-bottom-left-radius: 0; |
| 34 | + } |
36 | 35 |
|
37 | | - .highcontrast-mode({ |
38 | | - &.is-selected { |
39 | | - background-color: var(--black-400); |
40 | | - color: var(--white); |
| 36 | + &:not(&--radio) .s-btn:not(:last-child), |
| 37 | + &&--radio .s-btn:not(:last-of-type) { |
| 38 | + margin-right: calc(var(--su-static1) * -1); |
| 39 | + } |
41 | 40 |
|
42 | | - .s-btn--number { |
43 | | - color: var(--black); |
44 | | - } |
| 41 | + // CHILD ELEMENTS |
| 42 | + form { |
| 43 | + &:not(:first-child):not(:last-child) { |
| 44 | + .s-btn { |
| 45 | + border-radius: 0; |
45 | 46 | } |
46 | | - }); |
47 | | - |
48 | | - &:active { |
49 | | - z-index: var(--zi-active); |
50 | 47 | } |
51 | | - |
52 | | - #stacks-internals #screen-sm({ |
53 | | - padding-left: 0.4em; |
54 | | - padding-right: 0.4em; |
55 | | - }, @force-selector: true); |
56 | | - } |
57 | | - |
58 | | - #stacks-internals #screen-sm({ |
59 | | - .s-btn.s-btn__dropdown { |
60 | | - padding-right: 1.2em; |
61 | | - |
62 | | - &:after { |
63 | | - right: 0.4em; |
| 48 | + &:last-child:not(:only-child) { |
| 49 | + .s-btn:not(:last-child) { |
| 50 | + border-radius: 0; |
| 51 | + } |
| 52 | + } |
| 53 | + &:first-child:not(:only-child) { |
| 54 | + .s-btn:not(:first-child) { |
| 55 | + border-radius: 0; |
64 | 56 | } |
65 | 57 | } |
66 | | - }, @force-selector: true); |
67 | 58 |
|
68 | | - .s-btn-group--container { |
69 | 59 | display: flex; |
| 60 | + margin-right: calc(var(--su-static1) * -1); // -1px |
| 61 | + } |
70 | 62 |
|
71 | | - .s-btn { |
72 | | - margin-right: -1px; // We should slide buttons over to account for border thickness |
| 63 | + .s-btn { |
| 64 | + &:active { |
| 65 | + z-index: var(--zi-active); |
73 | 66 | } |
74 | | - |
75 | | - &:not(:first-child):not(:last-child) .s-btn { |
76 | | - border-radius: 0; |
| 67 | + &.is-selected, |
| 68 | + &--radio:checked + .s-btn { |
| 69 | + z-index: var(--zi-selected); // When the button is active or selected, it should pop above its siblings |
77 | 70 | } |
78 | 71 |
|
79 | | - &:first-child .s-btn { |
80 | | - border-top-right-radius: 0; |
81 | | - border-bottom-right-radius: 0; |
82 | | - margin-left: 0; |
83 | | - } |
84 | | - |
85 | | - &:last-child .s-btn { |
86 | | - border-top-left-radius: 0; |
87 | | - border-bottom-left-radius: 0; |
88 | | - } |
| 72 | + margin-bottom: calc(var(--su-static1) * -1); // When wrapping we need to account for the border |
| 73 | + white-space: nowrap; // When the buttons wrap, they get super tall and mess up the whole layout |
89 | 74 | } |
| 75 | + |
| 76 | + // STATIC COMPONENT STYLES |
| 77 | + display: flex; |
| 78 | + flex-wrap: wrap; |
| 79 | + margin-bottom: var(--su-static1); // Compensate for buttons having a margin bottom of -1px to account for row wrapping |
90 | 80 | } |
0 commit comments