@itwin/itwinui-css 0.46.1 → 0.47.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.
@@ -7,29 +7,36 @@
7
7
  align-items: center;
8
8
  isolation: isolate;
9
9
 
10
- $childSelector: 'input, button'; // target nested inputs and buttons
10
+ $childZindexSelector: '.iui-input-container, .iui-button, .iui-input:where(:not(.iui-input-container .iui-input))';
11
+ $childBorderSelector: '.iui-input, .iui-button:where(:not(.iui-borderless))';
12
+ $disabledSelector: '&:disabled, &.iui-disabled, &[aria-disabled="true"]';
11
13
 
12
14
  > * {
13
15
  display: flex;
14
16
 
15
- #{$childSelector} {
17
+ #{$childZindexSelector} {
16
18
  position: relative;
17
19
 
20
+ // Adds stripe above active button
21
+ --_iui-button-active-stripe-inset: #{$iui-xxs} #{$iui-xxs} calc(100% - #{$iui-xs});
22
+
18
23
  &:hover {
19
24
  z-index: 1;
20
25
  }
21
26
 
22
- &:focus {
27
+ &:focus,
28
+ &:focus-within {
23
29
  z-index: 2;
24
-
25
- &:where(:not(:focus-visible):not(:hover)) {
26
- z-index: revert;
27
- }
28
30
  }
29
31
 
30
- &:disabled {
32
+ #{$disabledSelector} {
31
33
  z-index: -1;
32
34
  }
35
+ }
36
+
37
+ #{$childBorderSelector} {
38
+ // Reset border radius
39
+ border-radius: 0;
33
40
 
34
41
  transition-duration: 0ms; // disable exit animation to avoid border flicker
35
42
 
@@ -37,47 +44,18 @@
37
44
  &:focus {
38
45
  transition-duration: $iui-speed-fast; // re-enable enter animation
39
46
  }
40
-
41
- // Adds stripe above active button
42
- &.iui-active {
43
- &::after {
44
- content: '';
45
- position: absolute;
46
- height: $iui-xxs;
47
- opacity: 1;
48
- top: $iui-xxs;
49
- left: $iui-xxs;
50
- width: calc(100% - #{$iui-xs});
51
- @include themed {
52
- background-color: t(iui-color-foreground-primary);
53
- }
54
- }
55
-
56
- &:disabled {
57
- &::after {
58
- @include themed {
59
- background-color: rgba(t(iui-color-foreground-body-rgb), t(iui-opacity-5));
60
- }
61
- }
62
- }
63
- }
64
-
65
- // Reset border radius only for non-borderless items
66
- &:not(.iui-borderless) {
67
- border-radius: 0;
68
- }
69
47
  }
70
48
 
71
49
  // Add rounded corners to first and last items
72
50
  &:first-child {
73
- #{$childSelector}:not(.iui-borderless) {
51
+ #{$childBorderSelector} {
74
52
  border-top-left-radius: $iui-border-radius;
75
53
  border-bottom-left-radius: $iui-border-radius;
76
54
  }
77
55
  }
78
56
 
79
57
  &:last-child {
80
- #{$childSelector}:not(.iui-borderless) {
58
+ #{$childBorderSelector} {
81
59
  border-top-right-radius: $iui-border-radius;
82
60
  border-bottom-right-radius: $iui-border-radius;
83
61
  }
@@ -89,8 +67,8 @@
89
67
  }
90
68
 
91
69
  // Add slight border between disabled items
92
- &:not(:first-child) {
93
- .iui-default:disabled {
70
+ &:not(:first-child) :where(.iui-button.iui-default) {
71
+ #{$disabledSelector} {
94
72
  @include themed {
95
73
  border-left-color: t(iui-color-background-4);
96
74
  }
@@ -10,6 +10,8 @@ $iui-button-padding-small: $iui-xs * 2;
10
10
  $iui-button-padding-large: $iui-xs * 6;
11
11
 
12
12
  @mixin iui-button {
13
+ --_iui-button-active-stripe-inset: initial;
14
+
13
15
  @include iui-reset;
14
16
  font-family: inherit;
15
17
  display: inline-flex;
@@ -50,6 +52,23 @@ $iui-button-padding-large: $iui-xs * 6;
50
52
  &:disabled {
51
53
  @include iui-button-disabled;
52
54
  }
55
+
56
+ &.iui-active {
57
+ // Shows active stripe only if --_iui-button-active-stripe-inset is set (from outside)
58
+ &::after {
59
+ content: '';
60
+ position: absolute;
61
+ inset: var(--_iui-button-active-stripe-inset);
62
+ background-color: var(--iui-color-foreground-primary);
63
+ }
64
+
65
+ &[disabled],
66
+ &:disabled {
67
+ &::after {
68
+ background-color: rgba(var(--iui-color-foreground-body-rgb), var(--iui-opacity-5));
69
+ }
70
+ }
71
+ }
53
72
  }
54
73
 
55
74
  /// Mixin for applying padding and margins to various button sizes.
@@ -50,7 +50,6 @@
50
50
  }
51
51
 
52
52
  .iui-button-split-menu {
53
- @include iui-button-group;
54
53
  @include iui-button-split-menu;
55
54
  }
56
55
 
@@ -43,6 +43,7 @@
43
43
  color: t(iui-color-foreground-primary);
44
44
  }
45
45
 
46
+ // Used for combining overlay background color with base background
46
47
  &::before {
47
48
  content: '';
48
49
  position: absolute;
package/scss/classes.scss CHANGED
@@ -41,3 +41,4 @@
41
41
  @import './tree/classes';
42
42
  @import './user-icon/classes';
43
43
  @import './wizard/classes';
44
+ @import './skip-to-content/classes';
@@ -12,6 +12,8 @@ $iui-active-box-shadow: 0 0 0 $iui-xxs rgba(t(iui-color-foreground-primary-rgb),
12
12
  $iui-hover-box-shadow: 0 0 1px $iui-xxs + 1 rgba(t(iui-color-foreground-body-rgb), t(iui-opacity-5));
13
13
 
14
14
  @mixin iui-color-picker {
15
+ --iui-color-picker-selected-color: initial;
16
+
15
17
  @include iui-dropdown;
16
18
  box-sizing: border-box;
17
19
  border-radius: $iui-border-radius;
@@ -37,11 +39,13 @@ $iui-hover-box-shadow: 0 0 1px $iui-xxs + 1 rgba(t(iui-color-foreground-body-rgb
37
39
  }
38
40
 
39
41
  @mixin iui-color-swatch {
42
+ --iui-color-swatch-background: initial;
43
+
40
44
  height: $iui-l;
41
45
  width: $iui-l;
42
46
  cursor: pointer;
43
47
  border-radius: $iui-color-swatch-border-radius;
44
- background-color: var(--swatch-color);
48
+ background-color: var(--iui-color-swatch-background);
45
49
  margin-bottom: $iui-xs;
46
50
  margin-right: $iui-xs;
47
51
 
@@ -159,13 +163,15 @@ $iui-hover-box-shadow: 0 0 1px $iui-xxs + 1 rgba(t(iui-color-foreground-body-rgb
159
163
  }
160
164
 
161
165
  @mixin iui-color-field {
166
+ --iui-color-field-hue: initial;
167
+
162
168
  position: relative;
163
169
  cursor: crosshair;
164
170
  width: 100%;
165
171
  height: $iui-baseline * 19;
166
172
  @include themed {
167
173
  background-image: linear-gradient(0deg, rgb(0, 0, 0), transparent),
168
- linear-gradient(90deg, rgb(255, 255, 255), var(--hue));
174
+ linear-gradient(90deg, rgb(255, 255, 255), var(--iui-color-field-hue));
169
175
  }
170
176
 
171
177
  &:not(:last-child) {
@@ -225,7 +231,7 @@ $iui-hover-box-shadow: 0 0 1px $iui-xxs + 1 rgba(t(iui-color-foreground-body-rgb
225
231
  content: '';
226
232
  width: 100%;
227
233
  height: 100%;
228
- background-image: linear-gradient(to right, transparent 0%, var(--selected-color) 100%);
234
+ background-image: linear-gradient(to right, transparent 0%, var(--iui-color-picker-selected-color) 100%);
229
235
  }
230
236
  }
231
237
 
@@ -235,9 +241,10 @@ $iui-hover-box-shadow: 0 0 1px $iui-xxs + 1 rgba(t(iui-color-foreground-body-rgb
235
241
  }
236
242
 
237
243
  @mixin iui-color-dot {
244
+ --iui-color-dot-inset: initial;
245
+
238
246
  position: absolute;
239
- top: var(--top, 0%);
240
- left: var(--left, 0%);
247
+ inset: var(--iui-color-dot-inset);
241
248
  width: $iui-m;
242
249
  height: $iui-m;
243
250
  border-radius: 50%;
@@ -246,7 +253,7 @@ $iui-hover-box-shadow: 0 0 1px $iui-xxs + 1 rgba(t(iui-color-foreground-body-rgb
246
253
  @include themed {
247
254
  box-shadow: rgba(t(iui-color-foreground-accessory-rgb), t(iui-opacity-1)) 0 0 0 $iui-xxs - 1,
248
255
  inset 0 0 0 $iui-xxs - 1 rgba(t(iui-color-foreground-accessory-rgb), t(iui-opacity-6));
249
- background-color: var(--selected-color);
256
+ background-color: var(--iui-color-picker-selected-color);
250
257
  }
251
258
 
252
259
  &:hover {
@@ -167,4 +167,27 @@
167
167
  margin-left: $iui-s;
168
168
  }
169
169
  }
170
+
171
+ &.iui-borderless {
172
+ &,
173
+ .iui-header,
174
+ .iui-expandable-content {
175
+ background-color: transparent;
176
+ border: initial;
177
+ }
178
+
179
+ .iui-header {
180
+ border-radius: $iui-border-radius;
181
+
182
+ &:hover {
183
+ @include themed {
184
+ background-color: rgba(t(iui-color-foreground-body-rgb), t(iui-opacity-6));
185
+ }
186
+ }
187
+ }
188
+
189
+ .iui-expandable-content > div {
190
+ padding: 0;
191
+ }
192
+ }
170
193
  }
package/scss/index.scss CHANGED
@@ -39,3 +39,4 @@
39
39
  @import './tree/index';
40
40
  @import './user-icon/index';
41
41
  @import './wizard/index';
42
+ @import './skip-to-content/index';
@@ -259,6 +259,8 @@
259
259
  margin-right: 0;
260
260
  border-top-left-radius: 0;
261
261
  border-bottom-left-radius: 0;
262
+ border-top-right-radius: inherit;
263
+ border-bottom-right-radius: inherit;
262
264
  }
263
265
 
264
266
  &.iui-actionable {
@@ -84,6 +84,9 @@
84
84
  overflow: hidden;
85
85
  justify-content: flex-start;
86
86
 
87
+ // Adds stripe to the left of active button
88
+ --_iui-button-active-stripe-inset: 0 calc(100% - #{$iui-xxs}) 0 0;
89
+
87
90
  &:not(.iui-expand) {
88
91
  height: $iui-baseline * 5;
89
92
  // iPhone notch support
@@ -118,12 +121,6 @@
118
121
  }
119
122
  }
120
123
 
121
- &.iui-active {
122
- @include themed {
123
- box-shadow: inset $iui-xxs 0 0 0 t(iui-icons-color-primary);
124
- }
125
- }
126
-
127
124
  &[disabled],
128
125
  &:disabled {
129
126
  @include themed {
@@ -0,0 +1,7 @@
1
+ // Copyright (c) Bentley Systems, Incorporated. All rights reserved.
2
+ // See LICENSE.md in the project root for license terms and full copyright notice.
3
+ @import './index';
4
+
5
+ .iui-skip-to-content-link {
6
+ @include iui-skip-to-content-link;
7
+ }
@@ -0,0 +1,3 @@
1
+ // Copyright (c) Bentley Systems, Incorporated. All rights reserved.
2
+ // See LICENSE.md in the project root for license terms and full copyright notice.
3
+ @import './skip-to-content';
@@ -0,0 +1,36 @@
1
+ // Copyright (c) Bentley Systems, Incorporated. All rights reserved.
2
+ // See LICENSE.md in the project root for license terms and full copyright notice.
3
+ @import '../style/index';
4
+
5
+ @mixin iui-skip-to-content-link {
6
+ @include iui-blur($opacity: 3);
7
+ @include iui-focus($offset: 2px, $thickness: 2px);
8
+ @include themed {
9
+ color: t(iui-color-foreground-accessory);
10
+ }
11
+ border-radius: $iui-border-radius-round;
12
+ text-decoration: none;
13
+ user-select: none;
14
+ padding: ($iui-baseline * 0.75) $iui-m;
15
+ position: fixed;
16
+ text-align: center;
17
+ left: 50%;
18
+ top: $iui-baseline * 2;
19
+ transform: translateX(-50%) translateY(-170%);
20
+ transition: background-color $iui-speed-fast ease-in-out;
21
+ @media (prefers-reduced-motion: no-preference) {
22
+ transition: background-color $iui-speed-fast ease-in-out, transform $iui-speed-slow ease-in-out, box-shadow $iui-speed-fast ease-in-out;
23
+ }
24
+
25
+ &:hover {
26
+ @include iui-blur($opacity: 2);
27
+ }
28
+
29
+ &:focus {
30
+ transform: translateX(-50%) translateY(0);
31
+ box-shadow: $iui-elevation-16;
32
+ @media (prefers-reduced-motion: no-preference) {
33
+ transition: transform $iui-speed-fast ease-in-out;
34
+ }
35
+ }
36
+ }
@@ -114,10 +114,8 @@
114
114
 
115
115
  // With blur
116
116
  @supports (backdrop-filter: $iui-blur-filter) {
117
- @include themed() {
118
- background-color: rgba(0, 0, 0, t(iui-opacity-#{$opacity}));
119
- backdrop-filter: $iui-blur-filter;
120
- }
117
+ background-color: rgba(0, 0, 0, var(--iui-opacity-#{$opacity}));
118
+ backdrop-filter: $iui-blur-filter;
121
119
  }
122
120
  }
123
121
 
@@ -130,6 +128,33 @@
130
128
  padding: 0;
131
129
  }
132
130
 
131
+ /// Visually hides an element but keeps it accessible to screen readers.
132
+ /// Because it applies some potentially invasive styles, use this mixin on a wrapper element for best results.
133
+ /// If it contains a focusable element, make sure to revert/exclude these styles.
134
+ @mixin visually-hidden {
135
+ clip-path: inset(50%);
136
+ overflow: hidden;
137
+ position: absolute;
138
+ white-space: nowrap;
139
+ height: 1px;
140
+ width: 1px;
141
+ padding: 0;
142
+ margin: -1px;
143
+ border-width: 0;
144
+ }
145
+
146
+ /// Reverts visually-hidden styles, making it visible again.
147
+ @mixin visually-hidden-revert {
148
+ clip-path: revert;
149
+ overflow: visible;
150
+ position: static;
151
+ white-space: normal;
152
+ height: auto;
153
+ width: auto;
154
+ padding: 0;
155
+ margin: 0;
156
+ }
157
+
133
158
  /// Classes for react-transition-group
134
159
  /// Used for expand/collapse transitions. Needs height/width to be set in JS.
135
160
  @mixin iui-transition-group {
@@ -5,6 +5,7 @@
5
5
  @import '../icon/variables';
6
6
 
7
7
  $iui-border-radius: 3px;
8
+ $iui-border-radius-round: 9999px;
8
9
  $iui-blur-filter: blur(5px);
9
10
 
10
11
  $iui-component-offset: 3px;
@@ -63,17 +63,9 @@
63
63
  }
64
64
 
65
65
  @mixin iui-paginator-pages-group {
66
- @include iui-button-group;
66
+ display: inline-flex;
67
+ align-items: center;
67
68
  margin: 0 $iui-s;
68
-
69
- > * + * {
70
- margin-left: 0; // unset negative margin from button-group
71
- }
72
-
73
- button.iui-active::after {
74
- top: auto;
75
- bottom: $iui-xxs;
76
- }
77
69
  }
78
70
 
79
71
  @mixin iui-paginator-page-button {
@@ -81,6 +73,9 @@
81
73
  @include iui-button-borderless;
82
74
  width: $iui-component-height;
83
75
 
76
+ // Adds stripe above active button
77
+ --_iui-button-active-stripe-inset: calc(100% - #{$iui-xs}) #{$iui-xxs} #{$iui-xxs};
78
+
84
79
  &-small {
85
80
  @include iui-button-size(small);
86
81
  width: $iui-component-height-small;
@@ -33,3 +33,7 @@
33
33
  .iui-tile-content {
34
34
  @include iui-tile-content;
35
35
  }
36
+
37
+ .iui-tile-more-options {
38
+ @include iui-tile-more-options;
39
+ }
@@ -11,6 +11,7 @@
11
11
  width: $iui-3xl * 3;
12
12
  box-shadow: $iui-elevation-2;
13
13
  backface-visibility: hidden;
14
+ @include iui-focus($offset: $iui-xxs, $thickness: $iui-xxs);
14
15
  @include themed() {
15
16
  background-color: t(iui-color-background-1);
16
17
  color: t(iui-text-color);
@@ -18,12 +19,13 @@
18
19
 
19
20
  &:hover,
20
21
  &:focus-within {
21
- .iui-tile-metadata:not(:last-child) {
22
- width: calc(100% - #{$iui-xl});
22
+ .iui-tile-more-options {
23
+ @include visually-hidden-revert;
24
+ position: absolute;
23
25
  }
24
26
 
25
- .iui-tile-more-options {
26
- visibility: visible;
27
+ .iui-tile-metadata:not(:last-child) {
28
+ width: calc(100% - #{$iui-xl});
27
29
  }
28
30
 
29
31
  .iui-tile-thumbnail-picture {
@@ -39,6 +41,7 @@
39
41
  }
40
42
 
41
43
  &.iui-selected {
44
+ @include iui-focus($offset: 0, $thickness: $iui-xs);
42
45
  @include themed() {
43
46
  outline: solid 2px t(iui-color-foreground-primary);
44
47
  background: linear-gradient(
@@ -150,18 +153,6 @@
150
153
  text-overflow: ellipsis;
151
154
  }
152
155
  }
153
-
154
- .iui-tile-more-options {
155
- @include iui-button-size(small, borderless);
156
- position: absolute;
157
- bottom: $iui-baseline * 0.5;
158
- right: $iui-s;
159
- visibility: hidden;
160
-
161
- &.iui-visible {
162
- visibility: visible;
163
- }
164
- }
165
156
  }
166
157
 
167
158
  @mixin iui-tile-thumbnail {
@@ -312,3 +303,13 @@
312
303
  }
313
304
  }
314
305
  }
306
+
307
+ @mixin iui-tile-more-options {
308
+ position: absolute;
309
+ bottom: $iui-baseline * 0.5;
310
+ right: $iui-s;
311
+
312
+ &:not(.iui-visible) {
313
+ @include visually-hidden;
314
+ }
315
+ }
@@ -10,6 +10,10 @@
10
10
  @include iui-sub-tree;
11
11
  }
12
12
 
13
+ .iui-tree-item {
14
+ @include iui-tree-item;
15
+ }
16
+
13
17
  .iui-tree-node {
14
18
  @include iui-tree-node;
15
19
  }
@@ -17,6 +17,22 @@ $iui-expander-button-width: ($iui-icons-default) + ($iui-expander-inline-padding
17
17
  list-style: none;
18
18
  }
19
19
 
20
+ @mixin iui-tree-item {
21
+ @include focus-visible {
22
+ outline: none;
23
+
24
+ > .iui-tree-node {
25
+ outline: 1px solid var(--iui-color-foreground-primary);
26
+ outline-offset: -1px;
27
+
28
+ &.iui-active {
29
+ outline: 2px solid var(--iui-color-foreground-primary);
30
+ outline-offset: -2px;
31
+ }
32
+ }
33
+ }
34
+ }
35
+
20
36
  @mixin iui-tree-node {
21
37
  display: flex;
22
38
  cursor: pointer;
@@ -83,8 +99,6 @@ $iui-expander-button-width: ($iui-icons-default) + ($iui-expander-inline-padding
83
99
  }
84
100
  }
85
101
 
86
- @include iui-focus;
87
-
88
102
  &:hover {
89
103
  @include themed {
90
104
  background-color: rgba(t(iui-color-foreground-primary-rgb), t(iui-opacity-6));
@@ -104,8 +118,6 @@ $iui-expander-button-width: ($iui-icons-default) + ($iui-expander-inline-padding
104
118
  outline: $iui-active-outline;
105
119
  outline-offset: -1px;
106
120
  }
107
-
108
- @include iui-focus($offset: -2px, $thickness: $iui-xxs);
109
121
  }
110
122
 
111
123
  &.iui-disabled {