@itwin/itwinui-css 0.39.1 → 0.40.0

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.
@@ -2,6 +2,8 @@
2
2
  // See LICENSE.md in the project root for license terms and full copyright notice.
3
3
  @import '../style/index';
4
4
  @import '../icon/index';
5
+ @import './disabled';
6
+ @import './button-icon';
5
7
 
6
8
  $iui-button-padding: $iui-xs * 4;
7
9
  $iui-button-padding-small: $iui-xs * 2;
@@ -32,52 +34,45 @@ $iui-button-padding-large: $iui-xs * 6;
32
34
  border-color $iui-speed-fast ease-out;
33
35
  }
34
36
 
35
- > .iui-icon:not(.iui-user-icon) {
36
- width: $iui-icons-default;
37
- height: $iui-icons-default;
38
- @media (prefers-reduced-motion: no-preference) {
39
- transition: fill $iui-speed-fast ease-out;
40
- }
37
+ @include themed {
38
+ color: rgba(t(iui-color-foreground-body-rgb), t(iui-opacity-2));
41
39
  }
42
40
 
43
- &:enabled:hover {
41
+ &:hover {
44
42
  text-decoration: none;
43
+ @include themed {
44
+ color: rgba(t(iui-color-foreground-body-rgb), t(iui-opacity-1));
45
+ }
45
46
  }
46
47
 
47
48
  @include iui-focus;
48
- @include iui-button-sizes;
49
- }
50
49
 
51
- @mixin iui-button-sizes {
52
- padding: 0 $iui-button-padding;
53
- height: $iui-component-height;
50
+ &[disabled],
51
+ &:disabled {
52
+ @include iui-button-disabled;
53
+ }
54
+ }
54
55
 
55
- > .iui-icon + .iui-label,
56
- > .iui-label + .iui-icon,
57
- > .iui-icon + .iui-icon {
58
- margin-left: $iui-s;
56
+ /// Mixin for applying padding and margins to various button sizes.
57
+ /// @arg size - must be one of: small, medium, large
58
+ /// @arg styleType - must be one of: default, borderless
59
+ @mixin iui-button-size($size: medium, $styleType: default) {
60
+ @if $size == medium {
61
+ padding: if($styleType == 'borderless', 0 $iui-s, 0 $iui-button-padding);
62
+ height: $iui-component-height;
63
+ gap: $iui-s;
59
64
  }
60
65
 
61
- &.iui-small {
62
- padding: 0 $iui-button-padding-small;
66
+ @if $size == small {
67
+ padding: if($styleType == 'borderless', 0 $iui-xxs, 0 $iui-button-padding-small);
63
68
  height: $iui-component-height-small;
64
-
65
- > .iui-icon + .iui-label,
66
- > .iui-label + .iui-icon,
67
- > .iui-icon + .iui-icon {
68
- margin-left: $iui-xs;
69
- }
69
+ gap: $iui-xs;
70
70
  }
71
71
 
72
- &.iui-large {
73
- padding: 0 $iui-button-padding-large;
72
+ @if $size == large {
73
+ padding: if($styleType == 'borderless', 0 $iui-sm, 0 $iui-button-padding-large);
74
74
  height: $iui-component-height-large;
75
75
  font-size: $iui-font-size-leading;
76
-
77
- > .iui-icon + .iui-label,
78
- > .iui-label + .iui-icon,
79
- > .iui-icon + .iui-icon {
80
- margin-left: $iui-sm;
81
- }
76
+ gap: $iui-sm;
82
77
  }
83
78
  }
@@ -4,7 +4,11 @@
4
4
 
5
5
  .iui-button {
6
6
  @include iui-button;
7
- @include iui-button-default;
7
+ @include iui-button-size;
8
+
9
+ &.iui-default {
10
+ @include iui-button-default;
11
+ }
8
12
 
9
13
  &.iui-high-visibility {
10
14
  @include iui-button-high-visibility;
@@ -22,8 +26,22 @@
22
26
  @include iui-button-borderless;
23
27
  }
24
28
 
25
- &[disabled] {
26
- @include iui-button-disabled;
29
+ @include iui-button-size(medium);
30
+
31
+ &.iui-small {
32
+ @include iui-button-size(small);
33
+
34
+ &.iui-borderless {
35
+ @include iui-button-size(small, borderless);
36
+ }
37
+ }
38
+
39
+ &.iui-large {
40
+ @include iui-button-size(large);
41
+
42
+ &.iui-borderless {
43
+ @include iui-button-size(large, borderless);
44
+ }
27
45
  }
28
46
  }
29
47
 
@@ -35,3 +53,7 @@
35
53
  @include iui-button-group;
36
54
  @include iui-button-split-menu;
37
55
  }
56
+
57
+ .iui-button-icon {
58
+ @include iui-button-icon;
59
+ }
@@ -2,33 +2,36 @@
2
2
  // See LICENSE.md in the project root for license terms and full copyright notice.
3
3
  @import '../style/index';
4
4
  @import './button';
5
+ @import './button-icon';
6
+ @import './disabled';
5
7
 
6
8
  @mixin iui-button-cta {
7
- @include themed {
8
- background-color: t(iui-color-background-positive);
9
- border-color: t(iui-color-background-positive);
10
- color: t(iui-color-foreground-accessory);
11
- }
9
+ @include iui-button-cta-base;
12
10
 
13
- > .iui-icon {
14
- @include themed {
15
- fill: t(iui-color-foreground-accessory);
16
- }
17
- }
18
-
19
- &:enabled:hover,
20
- &:enabled:active,
21
- &:focus-visible {
11
+ &:hover,
12
+ &:active,
13
+ &:focus {
22
14
  @include themed {
23
15
  background-color: t(iui-color-background-positive-overlay);
24
16
  border-color: t(iui-color-background-positive-overlay);
25
17
  color: t(iui-color-foreground-accessory);
26
18
  }
19
+ }
27
20
 
28
- > .iui-icon {
29
- @include themed {
30
- fill: t(iui-color-foreground-accessory);
31
- }
32
- }
21
+ &:focus:not(:focus-visible) {
22
+ @include iui-button-cta-base;
23
+ }
24
+
25
+ &[disabled],
26
+ &:disabled {
27
+ @include iui-button-disabled;
28
+ }
29
+ }
30
+
31
+ @mixin iui-button-cta-base {
32
+ @include themed {
33
+ background-color: t(iui-color-background-positive);
34
+ border-color: t(iui-color-background-positive);
35
+ color: t(iui-color-foreground-accessory);
33
36
  }
34
37
  }
@@ -2,36 +2,26 @@
2
2
  // See LICENSE.md in the project root for license terms and full copyright notice.
3
3
  @import '../style/index';
4
4
  @import './button';
5
+ @import './button-icon';
5
6
  @import '../notification-marker/index';
7
+ @import './disabled';
6
8
 
7
9
  @mixin iui-button-default {
8
- @include themed {
9
- background-color: t(iui-color-background-1);
10
- border-color: rgba(t(iui-color-foreground-body-rgb), t(iui-opacity-4));
11
- color: rgba(t(iui-color-foreground-body-rgb), t(iui-opacity-2));
12
- }
10
+ @include iui-button-default-base;
13
11
 
14
- > .iui-icon {
15
- @include themed {
16
- fill: t(iui-icons-color-actionable);
17
- }
18
- }
19
-
20
- &:enabled:hover,
21
- &:enabled:active,
22
- &:focus-visible {
12
+ &:hover,
13
+ &:active,
14
+ &:focus {
23
15
  @include themed {
24
16
  background-color: t(iui-color-background-1-overlay);
25
17
  border-color: rgba(t(iui-color-foreground-body-rgb), t(iui-opacity-1));
26
18
  color: rgba(t(iui-color-foreground-body-rgb), t(iui-opacity-1));
27
19
  }
28
20
  @include iui-notification-marker-hover;
21
+ }
29
22
 
30
- > .iui-icon {
31
- @include themed {
32
- fill: t(iui-icons-color-actionable-hover);
33
- }
34
- }
23
+ &:focus:not(:focus-visible) {
24
+ @include iui-button-default-base;
35
25
  }
36
26
 
37
27
  &.iui-dropdown {
@@ -47,29 +37,27 @@
47
37
  }
48
38
  }
49
39
 
50
- &.iui-active:not(.iui-high-visibility):not(.iui-cta) {
51
- &:enabled,
52
- &:enabled:hover,
53
- &:enabled:active {
54
- @include themed {
55
- background: linear-gradient(
56
- rgba(t(iui-color-foreground-primary-rgb), t(iui-opacity-6)),
57
- rgba(t(iui-color-foreground-primary-rgb), t(iui-opacity-6))
58
- ),
59
- linear-gradient(t(iui-color-background-1), t(iui-color-background-1));
60
- }
40
+ &.iui-active {
41
+ @include themed {
42
+ background: linear-gradient(
43
+ rgba(t(iui-color-foreground-primary-rgb), t(iui-opacity-6)),
44
+ rgba(t(iui-color-foreground-primary-rgb), t(iui-opacity-6))
45
+ ),
46
+ linear-gradient(t(iui-color-background-1), t(iui-color-background-1));
47
+ color: t(iui-color-foreground-primary);
48
+ }
49
+ }
61
50
 
62
- > .iui-label {
63
- @include themed {
64
- color: t(iui-color-foreground-primary);
65
- }
66
- }
51
+ &[disabled],
52
+ &:disabled {
53
+ @include iui-button-disabled;
54
+ }
55
+ }
67
56
 
68
- > .iui-icon {
69
- @include themed {
70
- fill: t(iui-icons-color-primary);
71
- }
72
- }
73
- }
57
+ @mixin iui-button-default-base {
58
+ @include themed {
59
+ background-color: t(iui-color-background-1);
60
+ border-color: rgba(t(iui-color-foreground-body-rgb), t(iui-opacity-4));
61
+ color: rgba(t(iui-color-foreground-body-rgb), t(iui-opacity-2));
74
62
  }
75
63
  }
@@ -1,24 +1,13 @@
1
1
  // Copyright (c) Bentley Systems, Incorporated. All rights reserved.
2
2
  // See LICENSE.md in the project root for license terms and full copyright notice.
3
3
  @import '../style/index';
4
- @import './button';
4
+ @import './button-icon';
5
5
 
6
6
  @mixin iui-button-disabled {
7
7
  cursor: not-allowed;
8
8
  @include themed {
9
- background-color: t(iui-color-background-disabled);
9
+ background: t(iui-color-background-disabled);
10
10
  border-color: t(iui-color-background-disabled);
11
- }
12
-
13
- > .iui-label {
14
- @include themed {
15
- color: rgba(t(iui-color-foreground-body-rgb), t(iui-opacity-5));
16
- }
17
- }
18
-
19
- > .iui-icon {
20
- @include themed {
21
- fill: t(iui-icons-color-actionable-disabled);
22
- }
11
+ color: rgba(t(iui-color-foreground-body-rgb), t(iui-opacity-5));
23
12
  }
24
13
  }
@@ -2,33 +2,36 @@
2
2
  // See LICENSE.md in the project root for license terms and full copyright notice.
3
3
  @import '../style/index';
4
4
  @import './button';
5
+ @import './disabled';
6
+ @import './button-icon';
5
7
 
6
8
  @mixin iui-button-high-visibility {
7
- @include themed {
8
- background-color: t(iui-color-background-primary);
9
- border-color: t(iui-color-background-primary);
10
- color: t(iui-color-foreground-accessory);
11
- }
9
+ @include iui-button-high-visibility-base;
12
10
 
13
- > .iui-icon {
14
- @include themed {
15
- fill: t(iui-color-foreground-accessory);
16
- }
17
- }
18
-
19
- &:enabled:hover,
20
- &:enabled:active,
21
- &:focus-visible {
11
+ &:hover,
12
+ &:active,
13
+ &:focus {
22
14
  @include themed {
23
15
  background-color: t(iui-color-background-primary-overlay);
24
16
  border-color: t(iui-color-background-primary-overlay);
25
17
  color: t(iui-color-foreground-accessory);
26
18
  }
19
+ }
27
20
 
28
- > .iui-icon {
29
- @include themed {
30
- fill: t(iui-color-foreground-accessory);
31
- }
32
- }
21
+ &:focus:not(:focus-visible) {
22
+ @include iui-button-high-visibility-base;
23
+ }
24
+
25
+ &[disabled],
26
+ &:disabled {
27
+ @include iui-button-disabled;
28
+ }
29
+ }
30
+
31
+ @mixin iui-button-high-visibility-base {
32
+ @include themed {
33
+ background-color: t(iui-color-background-primary);
34
+ border-color: t(iui-color-background-primary);
35
+ color: t(iui-color-foreground-accessory);
33
36
  }
34
37
  }
@@ -9,3 +9,4 @@
9
9
  @import './split-menu';
10
10
  @import './borderless';
11
11
  @import './disabled';
12
+ @import './button-icon';
@@ -44,4 +44,9 @@
44
44
  background-color: transparent;
45
45
  }
46
46
  }
47
+
48
+ &[disabled],
49
+ &:disabled {
50
+ @include iui-button-disabled;
51
+ }
47
52
  }
@@ -26,6 +26,10 @@
26
26
  }
27
27
  }
28
28
 
29
+ .iui-button {
30
+ gap: 0;
31
+ }
32
+
29
33
  > .iui-codeblock-content {
30
34
  margin: 0;
31
35
  overflow-x: auto;
@@ -3,9 +3,11 @@
3
3
  @import '../style/index';
4
4
  @import '../user-icon/index';
5
5
  @import '../icon/index';
6
+ @import '../button/index';
6
7
 
7
8
  @mixin iui-page-header {
8
9
  @include iui-reset;
10
+
9
11
  display: flex;
10
12
  justify-content: space-between;
11
13
  width: 100%;
@@ -123,7 +125,7 @@
123
125
  @include iui-display-none;
124
126
  }
125
127
 
126
- .iui-header-button-icon + .iui-label {
128
+ .iui-header-button-icon + .iui-button-label {
127
129
  margin-left: 0;
128
130
  }
129
131
  }
@@ -154,7 +156,8 @@
154
156
  @include iui-header-button-icon;
155
157
  }
156
158
 
157
- .iui-header-button.iui-header-button { // boost specificity
159
+ // boost specificity
160
+ .iui-header-button.iui-header-button {
158
161
  @include iui-header-button;
159
162
  }
160
163
 
@@ -172,7 +175,7 @@
172
175
  @at-root {
173
176
  a#{&}, // rendered as anchor element
174
177
  button#{&}, // rendered as button element
175
- &[role='button'] { // rendered as div with role=button
178
+ &[role='button'] {
176
179
  @include iui-header-button-focus;
177
180
  cursor: pointer;
178
181
 
@@ -230,13 +233,18 @@
230
233
  }
231
234
 
232
235
  @mixin iui-header-button {
236
+ @include iui-button-size(large, borderless);
237
+
238
+ gap: 0;
233
239
  max-width: 25vw;
240
+ height: 100%;
241
+ border-radius: 0;
234
242
  overflow: hidden;
235
243
  padding-right: $iui-s;
236
244
 
237
245
  @include iui-header-button-focus;
238
246
 
239
- > .iui-label {
247
+ > .iui-button-label {
240
248
  text-align: left;
241
249
  font-size: $iui-font-size;
242
250
  overflow: hidden;
@@ -257,10 +265,14 @@
257
265
  }
258
266
  }
259
267
 
260
- > .iui-icon {
268
+ > .iui-button-icon {
261
269
  flex-shrink: 0;
262
270
  }
263
271
 
272
+ > * + * {
273
+ margin-left: $iui-sm;
274
+ }
275
+
264
276
  .iui-header-button-icon {
265
277
  padding: $iui-xs;
266
278
  @include iui-header-button-icon($iui-icons-default, $iui-border-radius);
@@ -289,11 +301,11 @@
289
301
  height: $iui-icons-small;
290
302
  padding: $iui-xxs;
291
303
  }
304
+ }
292
305
 
293
- .iui-label {
294
- .iui-description {
295
- @include iui-display-none;
296
- }
306
+ .iui-button-label {
307
+ .iui-description {
308
+ @include iui-display-none;
297
309
  }
298
310
  }
299
311
  }
@@ -376,7 +388,7 @@
376
388
  }
377
389
 
378
390
  // Blue text
379
- .iui-label {
391
+ .iui-button-label {
380
392
  @include themed {
381
393
  color: t(iui-color-foreground-primary);
382
394
  }
@@ -47,9 +47,7 @@
47
47
  width: $iui-sm;
48
48
  height: $iui-sm;
49
49
 
50
- > path,
51
- > circle,
52
- > g {
50
+ > * {
53
51
  opacity: 0;
54
52
  @media (prefers-reduced-motion: no-preference) {
55
53
  transition: opacity $iui-speed-fast ease;
@@ -31,7 +31,7 @@
31
31
  // Adds hover to everything that is not disabled
32
32
  &:hover > input:enabled ~ .iui-checkbox-checkmark {
33
33
  @include themed {
34
- background-color: t(iui-color-background-1-overlay);
34
+ background-color: rgba(t(iui-color-foreground-body-rgb), t(iui-opacity-6));
35
35
  }
36
36
  }
37
37
 
@@ -54,9 +54,12 @@
54
54
  opacity: 0;
55
55
  }
56
56
 
57
- input ~ .iui-checkbox-checkmark > svg > .iui-uncheck {
57
+ input ~ .iui-checkbox-checkmark .iui-uncheck {
58
58
  opacity: 1;
59
59
  transition: opacity $iui-speed-fast ease;
60
+ @include themed {
61
+ fill: t(iui-icons-color-actionable);
62
+ }
60
63
  }
61
64
  }
62
65
  }
@@ -71,12 +71,13 @@
71
71
  > .iui-sidenav-content {
72
72
  max-width: $iui-3xl * 3;
73
73
 
74
- > .iui-sidenav-button.iui-expand > .iui-icon {
74
+ > .iui-sidenav-button.iui-expand > .iui-button-icon {
75
75
  transform: scaleX(-1);
76
76
  }
77
77
  }
78
78
 
79
79
  .iui-sidenav-button {
80
+ gap: $iui-icons-large;
80
81
  border-radius: 0;
81
82
  border-left: none;
82
83
  border-right: none;
@@ -91,44 +92,52 @@
91
92
  }
92
93
  }
93
94
 
95
+ > .iui-button-label {
96
+ white-space: nowrap;
97
+ overflow: hidden;
98
+ text-overflow: ellipsis;
99
+ }
100
+
94
101
  &,
95
- &:enabled:hover,
102
+ &:hover,
96
103
  &[disabled],
97
- &:focus-visible {
104
+ &:focus {
98
105
  @include themed {
99
106
  border-color: t(iui-color-background-5);
100
107
  }
101
108
  }
102
109
 
103
- > .iui-icon:not(.iui-user-icon) {
110
+ // Overriding border from default button
111
+ &:focus:not(:focus-visible) {
112
+ @include themed {
113
+ border-color: t(iui-color-background-5);
114
+ }
115
+ }
116
+
117
+ > .iui-button-icon:not(.iui-user-icon) {
104
118
  width: $iui-icons-large;
105
119
  height: $iui-icons-large;
106
120
  flex-shrink: 0;
107
-
108
- + .iui-label {
109
- margin-left: $iui-icons-large;
110
- white-space: nowrap;
111
- overflow: hidden;
112
- text-overflow: ellipsis;
113
- }
114
121
  }
115
122
 
116
- &.iui-submenu-open .iui-icon {
123
+ &.iui-submenu-open .iui-button-icon {
117
124
  @include themed {
118
125
  fill: t(iui-color-foreground-primary);
119
126
  }
120
127
  }
121
128
 
122
129
  &.iui-active {
123
- &:focus,
124
- &:focus-visible {
130
+ @include themed {
131
+ box-shadow: inset $iui-xxs 0 0 0 t(iui-icons-color-primary);
132
+ }
133
+
134
+ &:focus {
125
135
  @include themed {
126
136
  box-shadow: inset 0 0 $iui-xs rgba(t(iui-color-foreground-primary-rgb), t(iui-opacity-3)),
127
137
  inset $iui-xxs 0 0 0 t(iui-icons-color-primary);
128
138
  }
129
139
  }
130
140
 
131
- &,
132
141
  &:focus:not(:focus-visible) {
133
142
  @include themed {
134
143
  box-shadow: inset $iui-xxs 0 0 0 t(iui-icons-color-primary);
@@ -136,7 +145,8 @@
136
145
  }
137
146
  }
138
147
 
139
- &[disabled] {
148
+ &[disabled],
149
+ &:disabled {
140
150
  @include themed {
141
151
  background-color: t(iui-color-background-2);
142
152
  }
@@ -153,11 +163,6 @@
153
163
  box-shadow: none;
154
164
  }
155
165
 
156
- &:focus-visible {
157
- outline: 0;
158
- box-shadow: inset 0 0 $iui-xs rgba(t(iui-color-foreground-primary-rgb), t(iui-opacity-3));
159
- }
160
-
161
166
  &.iui-expand {
162
167
  height: $iui-line-height;
163
168
  justify-content: center;
@@ -166,7 +171,7 @@
166
171
  border-bottom: 1px solid t(iui-color-background-5);
167
172
  }
168
173
 
169
- > .iui-icon {
174
+ > .iui-button-icon {
170
175
  @include iui-icons-small;
171
176
  @media (prefers-reduced-motion: no-preference) {
172
177
  transition: transform $iui-speed ease-out;
@@ -164,7 +164,7 @@
164
164
  visibility: visible;
165
165
  }
166
166
 
167
- .iui-row-expander > .iui-icon {
167
+ .iui-row-expander > .iui-button-icon {
168
168
  @media (prefers-reduced-motion: no-preference) {
169
169
  transition: transform $iui-speed-fast ease-out;
170
170
  }
@@ -178,7 +178,7 @@
178
178
  border-bottom-color: transparent;
179
179
  }
180
180
 
181
- .iui-row-expander > .iui-icon {
181
+ .iui-row-expander > .iui-button-icon {
182
182
  transform: rotate(90deg);
183
183
  }
184
184