File tree Expand file tree Collapse file tree 3 files changed +43
-4
lines changed Expand file tree Collapse file tree 3 files changed +43
-4
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,11 @@ import { attr } from '@microsoft/fast-element';
6
6
import { Button , buttonTemplate as template } from '@microsoft/fast-foundation' ;
7
7
import { buttonStyles as styles } from './button.styles.js' ;
8
8
9
+ /**
10
+ * Scale locally an element.
11
+ */
12
+ export type ElementSize = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' ;
13
+
9
14
/**
10
15
* Types of button appearance.
11
16
* @public
@@ -40,11 +45,19 @@ class JupyterButton extends Button {
40
45
*
41
46
* @public
42
47
* @remarks
48
+ *
49
+ * @deprecated Use {@link size} `xsmall` instead
43
50
* HTML Attribute: minimal
44
51
*/
45
52
@attr ( { attribute : 'minimal' , mode : 'boolean' } )
46
53
public minimal : boolean ;
47
54
55
+ /**
56
+ * Scale the element compared to the general size.
57
+ */
58
+ @attr
59
+ public size ?: ElementSize ;
60
+
48
61
/**
49
62
* Applies 'icon-only' class when there is only an SVG in the default slot
50
63
*
Original file line number Diff line number Diff line change @@ -98,6 +98,12 @@ export const controlCornerRadius = create<number>(
98
98
export const density = create < number > ( 'density' ) . withDefault ( 0 ) ;
99
99
/** @public */
100
100
export const designUnit = create < number > ( 'design-unit' ) . withDefault ( 4 ) ;
101
+ /**
102
+ * Adds to the density on specified element.
103
+ *
104
+ * @private
105
+ */
106
+ export const elementSize = create < number > ( 'element-size' ) . withDefault ( 0 ) ;
101
107
/** @public */
102
108
export const direction = create < Direction > ( 'direction' ) . withDefault (
103
109
Direction . ltr
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import {
21
21
controlCornerRadius ,
22
22
density ,
23
23
designUnit ,
24
+ elementSize ,
24
25
errorFillActive ,
25
26
errorFillFocus ,
26
27
errorFillHover ,
@@ -75,7 +76,8 @@ export const BaseButtonStyles = css`
75
76
display : inline-flex;
76
77
justify-content : center;
77
78
align-items : center;
78
- padding : 0 calc ((10 + (${ designUnit } * 2 * ${ density } )) * 1px );
79
+ padding : 0
80
+ calc ((10 + (${ designUnit } * 2 * (${ density } + ${ elementSize } ))) * 1px );
79
81
white-space : nowrap;
80
82
outline : none;
81
83
text-decoration : none;
@@ -101,14 +103,32 @@ export const BaseButtonStyles = css`
101
103
box-shadow : inset 0px 0px 2px 2px ${ neutralFillStrongActive } ;
102
104
}
103
105
104
- : host ([minimal ]) {
105
- --density : -4 ;
106
+ : host ([minimal ]),
107
+ : host ([size = 'xsmall' ]) {
108
+ --element-size : -4 ;
106
109
}
107
110
108
- : host ([minimal ]) .control {
111
+ : host ([minimal ]) .control ,
112
+ : host ([size = 'xsmall' ]) .control {
109
113
padding : 1px ;
110
114
}
111
115
116
+ : host ([size = 'small' ]) {
117
+ --element-size : -2 ;
118
+ }
119
+
120
+ : host ([size = 'medium' ]) {
121
+ --element-size : 1 ;
122
+ }
123
+
124
+ : host ([size = 'large' ]) {
125
+ --element-size : 2 ;
126
+ }
127
+
128
+ : host ([size = 'xlarge' ]) {
129
+ --element-size : 4 ;
130
+ }
131
+
112
132
/* prettier-ignore */
113
133
.control : ${ focusVisible } {
114
134
outline : calc (${ focusStrokeWidth } * 1px ) solid ${ neutralFillStrongFocus } ;
You can’t perform that action at this time.
0 commit comments