File tree Expand file tree Collapse file tree 11 files changed +57
-38
lines changed Expand file tree Collapse file tree 11 files changed +57
-38
lines changed Original file line number Diff line number Diff line change @@ -8,8 +8,8 @@ import { resolveContextOrProp } from '../_helpers/resolveContextOrProp';
8
8
import { transferProps } from '../_helpers/transferProps' ;
9
9
import { ButtonGroupContext } from '../ButtonGroup' ;
10
10
import { InputGroupContext } from '../InputGroup/InputGroupContext' ;
11
+ import getRootPriorityClassName from '../_helpers/getRootPriorityClassName' ;
11
12
import getRootLabelVisibilityClassName from './helpers/getRootLabelVisibilityClassName' ;
12
- import getRootPriorityClassName from './helpers/getRootPriorityClassName' ;
13
13
import styles from './Button.scss' ;
14
14
15
15
export const Button = React . forwardRef ( ( props , ref ) => {
Original file line number Diff line number Diff line change
1
+ // 1. ButtonGroup gap is implemented using the `margin` property so the buttons can overlap and reduce duplicate
2
+ // borders.
3
+
1
4
@use " sass:map" ;
2
5
@use " ../../styles/tools/breakpoint" ;
3
6
@use " settings" ;
81
84
z-index : map .get (settings .$group-z-indexes , button );
82
85
83
86
& :not (:first-child ) {
84
- margin-left : var (--rui-local-gap );
85
- border-top-left-radius : 0 ;
86
- border-bottom-left-radius : 0 ;
87
+ border-start-start-radius : var (--rui-local-inner-border-radius );
88
+ border-end-start-radius : var (--rui-local-inner-border-radius );
87
89
}
88
90
89
91
& :not (:last-child ) {
90
- border-top-right -radius : 0 ;
91
- border-bottom-right -radius : 0 ;
92
+ border-start-end -radius : var ( --rui-local-inner-border-radius ) ;
93
+ border-end-end -radius : var ( --rui-local-inner-border-radius ) ;
92
94
}
95
+ }
93
96
94
- & :focus ,
95
- & :not (:disabled ):hover {
96
- z-index : map .get (settings .$group-z-indexes , button-hover );
97
- }
97
+ .isRootInButtonGroup :not (:first-child ) {
98
+ margin-inline-start : var (--rui-local-gap ); // 1.
99
+ }
100
+
101
+ .isRootInButtonGroup :focus ,
102
+ .isRootInButtonGroup :not (:disabled ):hover {
103
+ z-index : map .get (settings .$group-z-indexes , button-hover );
98
104
}
99
105
100
106
.isRootInButtonGroup .startCorner ,
Original file line number Diff line number Diff line change 146
146
border-left : var (--rui-local-separator-width ) solid var (--rui-local-separator-color );
147
147
transform : translateX (calc (-0.5 * var (--rui-local-gap ) - 50% ));
148
148
}
149
-
150
- .isRootPriorityFilled.isRootInButtonGroup :not (:first-child ) {
151
- --rui-local-gap : #{theme .$group-filled-gap } ;
152
- --rui-local-separator-width : #{theme .$group-filled-separator-width } ;
153
- --rui-local-separator-color : #{theme .$group-filled-separator-color } ;
154
- }
155
-
156
- .isRootPriorityFlat.isRootInButtonGroup :not (:first-child ) {
157
- --rui-local-gap : #{theme .$group-flat-gap } ;
158
- --rui-local-separator-width : #{theme .$group-flat-separator-width } ;
159
- --rui-local-separator-color : #{theme .$group-flat-separator-color } ;
160
- }
161
-
162
- .isRootPriorityOutline.isRootInButtonGroup :not (:first-child ) {
163
- --rui-local-gap : #{theme .$group-outline-gap } ;
164
- }
Original file line number Diff line number Diff line change @@ -12,16 +12,6 @@ $disabled-cursor: var(--rui-Button--disabled__cursor);
12
12
$feedback-opacity : var (--rui-Button--feedback__opacity );
13
13
$feedback-cursor : var (--rui-Button--feedback__cursor );
14
14
15
- $group-filled-gap : var (--rui-ButtonGroup--filled__gap );
16
- $group-filled-separator-width : var (--rui-ButtonGroup--filled__separator__width );
17
- $group-filled-separator-color : var (--rui-ButtonGroup--filled__separator__color );
18
-
19
- $group-flat-gap : var (--rui-ButtonGroup--flat__gap );
20
- $group-flat-separator-width : var (--rui-ButtonGroup--flat__separator__width );
21
- $group-flat-separator-color : var (--rui-ButtonGroup--flat__separator__color );
22
-
23
- $group-outline-gap : var (--rui-ButtonGroup--outline__gap );
24
-
25
15
$sizes : (
26
16
small : (
27
17
height : var (--rui-Button--small__height ),
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import PropTypes from 'prop-types';
2
2
import React from 'react' ;
3
3
import { withGlobalProps } from '../../provider' ;
4
4
import { classNames } from '../../utils/classNames' ;
5
+ import getRootPriorityClassName from '../_helpers/getRootPriorityClassName' ;
5
6
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty' ;
6
7
import { transferProps } from '../_helpers/transferProps' ;
7
8
import styles from './ButtonGroup.scss' ;
@@ -25,6 +26,7 @@ export const ButtonGroup = ({
25
26
className = { classNames (
26
27
styles . root ,
27
28
block && styles . isRootBlock ,
29
+ getRootPriorityClassName ( priority , styles ) ,
28
30
) }
29
31
role = "group"
30
32
>
Original file line number Diff line number Diff line change
1
+ // 1. ButtonGroup gap is implemented using the `margin` property on buttons so the buttons can overlap and reduce
2
+ // duplicate borders.
3
+
4
+ @use " theme" ;
5
+
1
6
.root {
2
- display : inline-flex ;
7
+ --rui-local-inner-border-radius : #{theme .$inner-border-radius } ;
8
+
9
+ display : inline-flex ; // 1.
10
+ }
11
+
12
+ .isRootPriorityFilled {
13
+ --rui-local-gap : #{theme .$filled-gap } ;
14
+ --rui-local-separator-width : #{theme .$filled-separator-width } ;
15
+ --rui-local-separator-color : #{theme .$filled-separator-color } ;
16
+ }
17
+
18
+ .isRootPriorityFlat {
19
+ --rui-local-gap : #{theme .$flat-gap } ;
20
+ --rui-local-separator-width : #{theme .$flat-separator-width } ;
21
+ --rui-local-separator-color : #{theme .$flat-separator-color } ;
22
+ }
23
+
24
+ .isRootPriorityOutline {
25
+ --rui-local-gap : #{theme .$outline-gap } ;
3
26
}
4
27
5
28
.isRootBlock {
Original file line number Diff line number Diff line change @@ -266,6 +266,7 @@ its accessibility.
266
266
267
267
| Custom Property | Description |
268
268
| --------------------------------------------------------------------| ------------------------------------------------|
269
+ | ` --rui-ButtonGroup__inner-border-radius ` | Inner border radius of buttons |
269
270
| ` --rui-ButtonGroup--filled__gap ` | Gap between ` filled ` buttons |
270
271
| ` --rui-ButtonGroup--filled__separator__width ` | Separator width for ` filled ` buttons |
271
272
| ` --rui-ButtonGroup--filled__separator__color ` | Separator color for ` filled ` buttons |
Original file line number Diff line number Diff line change
1
+ $inner-border-radius : var (--rui-ButtonGroup__inner-border-radius );
2
+
3
+ $filled-gap : var (--rui-ButtonGroup--filled__gap );
4
+ $filled-separator-width : var (--rui-ButtonGroup--filled__separator__width );
5
+ $filled-separator-color : var (--rui-ButtonGroup--filled__separator__color );
6
+
7
+ $flat-gap : var (--rui-ButtonGroup--flat__gap );
8
+ $flat-separator-width : var (--rui-ButtonGroup--flat__separator__width );
9
+ $flat-separator-color : var (--rui-ButtonGroup--flat__separator__color );
10
+
11
+ $outline-gap : var (--rui-ButtonGroup--outline__gap );
Original file line number Diff line number Diff line change @@ -444,7 +444,7 @@ This is a demo of all components supported by FormLayout.
444
444
/>
445
445
<InputGroup label = " Promo code" >
446
446
<TextField label = " Promo code" />
447
- <Button label = " Submit " />
447
+ <Button label = " Apply " color = " secondary " priority = " outline " />
448
448
</InputGroup >
449
449
</FormLayout >
450
450
</div >
File renamed without changes.
You can’t perform that action at this time.
0 commit comments