@carbon/styles 1.90.0-rc.0 → 1.91.0-rc.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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/styles",
3
3
  "description": "Styles for the Carbon Design System",
4
- "version": "1.90.0-rc.0",
4
+ "version": "1.91.0-rc.0",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
@@ -40,13 +40,13 @@
40
40
  }
41
41
  },
42
42
  "dependencies": {
43
- "@carbon/colors": "^11.40.0-rc.0",
44
- "@carbon/feature-flags": "^0.30.0",
45
- "@carbon/grid": "^11.43.0-rc.0",
46
- "@carbon/layout": "^11.41.0-rc.0",
47
- "@carbon/motion": "^11.35.0-rc.0",
48
- "@carbon/themes": "^11.60.0-rc.0",
49
- "@carbon/type": "^11.47.0-rc.0",
43
+ "@carbon/colors": "^11.41.0-rc.0",
44
+ "@carbon/feature-flags": "^0.31.0-rc.0",
45
+ "@carbon/grid": "^11.44.0-rc.0",
46
+ "@carbon/layout": "^11.42.0-rc.0",
47
+ "@carbon/motion": "^11.36.0-rc.0",
48
+ "@carbon/themes": "^11.61.0-rc.0",
49
+ "@carbon/type": "^11.48.0-rc.0",
50
50
  "@ibm/plex": "6.0.0-next.6",
51
51
  "@ibm/plex-mono": "1.1.0",
52
52
  "@ibm/plex-sans": "1.1.0",
@@ -54,7 +54,7 @@
54
54
  "@ibm/plex-sans-devanagari": "1.1.0",
55
55
  "@ibm/plex-sans-hebrew": "0.0.3-alpha.0",
56
56
  "@ibm/plex-sans-thai": "0.0.3-alpha.0",
57
- "@ibm/plex-sans-thai-looped": "0.0.3-alpha.0",
57
+ "@ibm/plex-sans-thai-looped": "1.1.0",
58
58
  "@ibm/plex-serif": "0.0.3-alpha.0",
59
59
  "@ibm/telemetry-js": "^1.5.0"
60
60
  },
@@ -75,5 +75,5 @@
75
75
  "scss/**/*.css",
76
76
  "css/**/*.css"
77
77
  ],
78
- "gitHead": "d70cdbd45cfce813ce7ec6b396fcfa95ad2a81b6"
78
+ "gitHead": "eae1402aa3c86b644feefc43bd3202915404e924"
79
79
  }
@@ -15,6 +15,7 @@
15
15
  'enable-v12-structured-list-visible-icons': false,
16
16
  'enable-dialog-element': false,
17
17
  'enable-v12-toggle-reduced-label-spacing': false,
18
+ 'enable-presence': false,
18
19
  )
19
20
  !default
20
21
  );
@@ -8,6 +8,7 @@
8
8
  @use 'sass:list';
9
9
  @use '../button';
10
10
  @use '../../config' as *;
11
+ @use '../../feature-flags' as *;
11
12
  @use '../../breakpoint' as *;
12
13
  @use '../../motion' as *;
13
14
  @use '../../spacing' as *;
@@ -21,7 +22,7 @@
21
22
  /// Dialog styles
22
23
  /// @access public
23
24
  /// @group dialog
24
- @mixin dialog {
25
+ @mixin dialog($enable-presence: false) {
25
26
  .#{$prefix}--dialog {
26
27
  position: fixed;
27
28
  padding: 0;
@@ -32,20 +33,6 @@
32
33
  inline-size: 48rem;
33
34
  inset: 0;
34
35
  max-block-size: 100%;
35
- opacity: 0;
36
- transform: translateY(calc(-1 * #{$spacing-06}));
37
- /** opening and closing is used in as allow-discrete is not currently supported wide enough
38
- * https://caniuse.com/mdn-css_properties_display_is_transitionable
39
- */
40
- transition:
41
- opacity $duration-moderate-02 motion(exit, expressive),
42
- transform $duration-moderate-02 motion(exit, expressive),
43
- overlay $duration-moderate-02 motion(exit, expressive) allow-discrete,
44
- display $duration-moderate-02 motion(exit, expressive) allow-discrete;
45
-
46
- @media (prefers-reduced-motion) {
47
- transition: none;
48
- }
49
36
 
50
37
  @include breakpoint(md) {
51
38
  max-inline-size: 84%;
@@ -57,21 +44,86 @@
57
44
  max-inline-size: 48%;
58
45
  }
59
46
 
60
- &[open] {
61
- opacity: 1;
62
- transform: translateY(0);
63
-
47
+ @if not(enabled('enable-presence') or $enable-presence) {
48
+ opacity: 0;
49
+ transform: translateY(calc(-1 * #{$spacing-06}));
50
+ /** opening and closing is used in as allow-discrete is not currently supported wide enough
51
+ * https://caniuse.com/mdn-css_properties_display_is_transitionable
52
+ */
64
53
  transition:
65
- opacity $duration-moderate-02 motion(entrance, expressive),
66
- transform $duration-moderate-02 motion(entrance, expressive),
67
- overlay $duration-moderate-02 motion(entrance, expressive)
68
- allow-discrete,
69
- display $duration-moderate-02 motion(entrance, expressive)
70
- allow-discrete;
54
+ opacity $duration-moderate-02 motion(exit, expressive),
55
+ transform $duration-moderate-02 motion(exit, expressive),
56
+ overlay $duration-moderate-02 motion(exit, expressive) allow-discrete,
57
+ display $duration-moderate-02 motion(exit, expressive) allow-discrete;
71
58
 
72
59
  @media (prefers-reduced-motion) {
73
60
  transition: none;
74
61
  }
62
+
63
+ &[open] {
64
+ opacity: 1;
65
+ transform: translateY(0);
66
+
67
+ transition:
68
+ opacity $duration-moderate-02 motion(entrance, expressive),
69
+ transform $duration-moderate-02 motion(entrance, expressive),
70
+ overlay
71
+ $duration-moderate-02
72
+ motion(entrance, expressive)
73
+ allow-discrete,
74
+ display
75
+ $duration-moderate-02
76
+ motion(entrance, expressive)
77
+ allow-discrete;
78
+
79
+ @media (prefers-reduced-motion) {
80
+ transition: none;
81
+ }
82
+ }
83
+ } @else {
84
+ animation: #{$prefix}--presence-dialog__enter
85
+ $duration-moderate-02
86
+ motion(entrance, expressive)
87
+ forwards;
88
+
89
+ @media (prefers-reduced-motion) {
90
+ animation: none;
91
+ }
92
+
93
+ &[data-exiting] {
94
+ animation: #{$prefix}--presence-dialog__exit
95
+ $duration-moderate-02
96
+ motion(exit, expressive)
97
+ forwards;
98
+
99
+ @media (prefers-reduced-motion) {
100
+ animation: none;
101
+ }
102
+ }
103
+
104
+ @keyframes #{$prefix}--presence-dialog__enter {
105
+ from {
106
+ opacity: 0;
107
+ transform: translateY(calc(-1 * #{$spacing-06}));
108
+ }
109
+
110
+ to {
111
+ opacity: 1;
112
+ transform: translateY(0);
113
+ }
114
+ }
115
+
116
+ @keyframes #{$prefix}--presence-dialog__exit {
117
+ from {
118
+ opacity: 1;
119
+ transform: translateY(0);
120
+ }
121
+
122
+ to {
123
+ opacity: 0;
124
+ transform: translateY(calc(-1 * #{$spacing-06}));
125
+ }
126
+ }
75
127
  }
76
128
 
77
129
  /** starting style also not supported widely
@@ -99,30 +151,79 @@
99
151
  padding-inline: $spacing-05 $spacing-09;
100
152
  }
101
153
 
102
- /* Transition the :backdrop when the dialog modal is promoted to the top layer */
103
154
  .#{$prefix}--dialog::backdrop {
104
155
  background-color: $overlay;
105
156
  opacity: 0;
106
- /* opening and closing is used in as allow-discrete is not currently supported wide enough
107
- * https://caniuse.com/mdn-css_properties_display_is_transitionable
108
- */
109
- transition:
110
- background-color $duration-moderate-02 motion(entrance, expressive),
111
- opacity $duration-moderate-02 motion(entrance, expressive);
112
-
113
- @media (prefers-reduced-motion) {
114
- transition: none;
115
- }
116
157
  }
117
158
 
118
- .#{$prefix}--dialog[open]::backdrop {
119
- opacity: 1;
120
- transition:
121
- background-color $duration-moderate-02 motion(exit, expressive),
122
- opacity $duration-moderate-02 motion(exit, expressive);
159
+ @if not(enabled('enable-presence') or $enable-presence) {
160
+ /* Transition the :backdrop when the dialog modal is promoted to the top layer */
161
+ .#{$prefix}--dialog::backdrop {
162
+ /* opening and closing is used in as allow-discrete is not currently supported wide enough
163
+ * https://caniuse.com/mdn-css_properties_display_is_transitionable
164
+ */
165
+ transition:
166
+ background-color $duration-moderate-02 motion(entrance, expressive),
167
+ opacity $duration-moderate-02 motion(entrance, expressive);
123
168
 
124
- @media (prefers-reduced-motion) {
125
- transition: none;
169
+ @media (prefers-reduced-motion) {
170
+ transition: none;
171
+ }
172
+ }
173
+
174
+ .#{$prefix}--dialog[open]::backdrop {
175
+ opacity: 1;
176
+ transition:
177
+ background-color $duration-moderate-02 motion(exit, expressive),
178
+ opacity $duration-moderate-02 motion(exit, expressive);
179
+
180
+ @media (prefers-reduced-motion) {
181
+ transition: none;
182
+ }
183
+ }
184
+ } @else {
185
+ .#{$prefix}--dialog {
186
+ &::backdrop {
187
+ animation: #{$prefix}--presence-dialog-backdrop__enter
188
+ $duration-moderate-02
189
+ motion(entrance, expressive)
190
+ forwards;
191
+
192
+ @media (prefers-reduced-motion) {
193
+ animation: none;
194
+ }
195
+ }
196
+
197
+ &[data-exiting]::backdrop {
198
+ animation: #{$prefix}--presence-dialog-backdrop__exit
199
+ $duration-moderate-02
200
+ motion(exit, expressive)
201
+ forwards;
202
+
203
+ @media (prefers-reduced-motion) {
204
+ animation: none;
205
+ }
206
+ }
207
+ }
208
+
209
+ @keyframes #{$prefix}--presence-dialog-backdrop__enter {
210
+ from {
211
+ opacity: 0;
212
+ }
213
+
214
+ to {
215
+ opacity: 1;
216
+ }
217
+ }
218
+
219
+ @keyframes #{$prefix}--presence-dialog-backdrop__exit {
220
+ from {
221
+ opacity: 1;
222
+ }
223
+
224
+ to {
225
+ opacity: 0;
226
+ }
126
227
  }
127
228
  }
128
229
 
@@ -130,7 +231,7 @@
130
231
  * https://caniuse.com/mdn-css_at-rules_starting-style
131
232
  */
132
233
  /* This starting-style rule cannot be nested inside the above selector
133
- because the nesting selector cannot represent pseudo-elements. */
234
+ because the nesting selector cannot represent pseudo-elements. */
134
235
 
135
236
  @starting-style {
136
237
  .#{$prefix}--dialog[open]::backdrop {
@@ -26,7 +26,8 @@
26
26
  /// @group modal
27
27
  @mixin modal(
28
28
  $enable-experimental-focus-wrap-without-sentinels: false,
29
- $enable-dialog-element: false
29
+ $enable-dialog-element: false,
30
+ $enable-presence: false
30
31
  ) {
31
32
  .#{$prefix}--modal {
32
33
  // For modals using the native dialog element, the modal visibility is handled
@@ -49,41 +50,39 @@
49
50
  inline-size: 100vw;
50
51
  inset-block-start: 0;
51
52
  inset-inline-start: 0;
52
- opacity: 0;
53
- transition:
54
- opacity $duration-moderate-02 motion(exit, expressive),
55
- visibility 0ms linear $duration-moderate-02;
56
- visibility: hidden;
57
- }
58
53
 
59
- // For modals using the native dialog element, the modal visibility is handled
60
- // by the Dialog styles.
61
- @if not(
62
- enabled('enable-experimental-focus-wrap-without-sentinels') or
63
- $enable-experimental-focus-wrap-without-sentinels or
64
- enabled('enable-dialog-element') or
65
- $enable-dialog-element
66
- )
67
- {
68
- &.is-visible {
69
- opacity: 1;
70
- transition:
71
- opacity $duration-moderate-02 motion(entrance, expressive),
72
- visibility 0ms linear;
73
- visibility: inherit;
74
-
75
- @media screen and (prefers-reduced-motion: reduce) {
76
- transition: none;
77
- }
54
+ &.#{$prefix}--modal--enable-presence {
55
+ @include modal-animations($has-presence: true);
56
+ }
57
+
58
+ &:not(.#{$prefix}--modal--enable-presence) {
59
+ @include modal-animations(
60
+ $has-presence: enabled('enable-presence') or $enable-presence
61
+ );
78
62
  }
79
63
  }
80
64
 
81
65
  @include update_fields_on_layer;
82
66
  }
83
67
 
84
- .#{$prefix}--modal.is-visible .#{$prefix}--modal-container {
85
- transform: translate3d(0, 0, 0);
86
- transition: transform $duration-moderate-02 motion(entrance, expressive);
68
+ // For modals using the native dialog element, the modal visibility is handled
69
+ // by the Dialog styles.
70
+ @if not(
71
+ enabled('enable-experimental-focus-wrap-without-sentinels') or
72
+ $enable-experimental-focus-wrap-without-sentinels or
73
+ enabled('enable-dialog-element') or
74
+ $enable-dialog-element
75
+ )
76
+ {
77
+ .#{$prefix}--modal--enable-presence {
78
+ @include modal-container-animations($has-presence: true);
79
+ }
80
+
81
+ :not(.#{$prefix}--modal--enable-presence) {
82
+ @include modal-container-animations(
83
+ $has-presence: enabled('enable-presence') or $enable-presence
84
+ );
85
+ }
87
86
  }
88
87
 
89
88
  // -----------------------------
@@ -102,12 +101,10 @@
102
101
  // make modal edge visible on high contrast themes (#3880)
103
102
  outline: 3px solid transparent;
104
103
  outline-offset: -3px;
105
- transform: translate3d(0, -24px, 0);
106
104
  transform-origin: top center;
107
- transition: transform $duration-moderate-02 motion(exit, expressive);
108
105
 
109
106
  @include breakpoint(md) {
110
- position: static;
107
+ position: relative;
111
108
  block-size: auto;
112
109
  inline-size: 84%;
113
110
  max-block-size: 90%;
@@ -493,3 +490,121 @@
493
490
  @include high-contrast-mode('focus');
494
491
  }
495
492
  }
493
+
494
+ @mixin modal-animations($has-presence: false) {
495
+ @if not($has-presence) {
496
+ opacity: 0;
497
+ transition:
498
+ opacity $duration-moderate-02 motion(exit, expressive),
499
+ visibility 0ms linear $duration-moderate-02;
500
+ visibility: hidden;
501
+
502
+ &.is-visible {
503
+ opacity: 1;
504
+ transition:
505
+ opacity $duration-moderate-02 motion(entrance, expressive),
506
+ visibility 0ms linear;
507
+ visibility: inherit;
508
+
509
+ @media screen and (prefers-reduced-motion: reduce) {
510
+ transition: none;
511
+ }
512
+ }
513
+ } @else {
514
+ animation: #{$prefix}--presence-modal__enter
515
+ $duration-moderate-02
516
+ motion(entrance, expressive)
517
+ forwards;
518
+
519
+ @media screen and (prefers-reduced-motion: reduce) {
520
+ animation: none;
521
+ }
522
+
523
+ &[data-exiting] {
524
+ animation: #{$prefix}--presence-modal__exit
525
+ $duration-moderate-02
526
+ motion(exit, expressive)
527
+ forwards;
528
+
529
+ @media screen and (prefers-reduced-motion: reduce) {
530
+ animation: none;
531
+ }
532
+ }
533
+
534
+ @keyframes #{$prefix}--presence-modal__enter {
535
+ from {
536
+ opacity: 0;
537
+ }
538
+
539
+ to {
540
+ opacity: 1;
541
+ }
542
+ }
543
+
544
+ @keyframes #{$prefix}--presence-modal__exit {
545
+ from {
546
+ opacity: 1;
547
+ }
548
+
549
+ to {
550
+ opacity: 0;
551
+ }
552
+ }
553
+ }
554
+ }
555
+
556
+ @mixin modal-container-animations($has-presence: false) {
557
+ @if not($has-presence) {
558
+ &.is-visible .#{$prefix}--modal-container {
559
+ transform: translate3d(0, 0, 0);
560
+ transition: transform $duration-moderate-02 motion(entrance, expressive);
561
+ }
562
+
563
+ .#{$prefix}--modal-container {
564
+ transform: translate3d(0, -24px, 0);
565
+ transition: transform $duration-moderate-02 motion(exit, expressive);
566
+ }
567
+ } @else {
568
+ &[data-exiting] .#{$prefix}--modal-container {
569
+ animation: #{$prefix}--presence-modal-container__exit
570
+ $duration-moderate-02
571
+ motion(exit, expressive)
572
+ forwards;
573
+
574
+ @media screen and (prefers-reduced-motion: reduce) {
575
+ animation: none;
576
+ }
577
+ }
578
+
579
+ .#{$prefix}--modal-container {
580
+ animation: #{$prefix}--presence-modal-container__enter
581
+ $duration-moderate-02
582
+ motion(entrance, expressive)
583
+ forwards;
584
+
585
+ @media screen and (prefers-reduced-motion: reduce) {
586
+ animation: none;
587
+ }
588
+ }
589
+
590
+ @keyframes #{$prefix}--presence-modal-container__enter {
591
+ from {
592
+ transform: translate3d(0, -24px, 0);
593
+ }
594
+
595
+ to {
596
+ transform: translate3d(0, 0, 0);
597
+ }
598
+ }
599
+
600
+ @keyframes #{$prefix}--presence-modal-container__exit {
601
+ from {
602
+ transform: translate3d(0, 0, 0);
603
+ }
604
+
605
+ to {
606
+ transform: translate3d(0, -24px, 0);
607
+ }
608
+ }
609
+ }
610
+ }
@@ -176,7 +176,7 @@
176
176
  background-color: transparent;
177
177
 
178
178
  &::before {
179
- background-color: $text-primary;
179
+ background-color: $icon-primary;
180
180
  inset-block-start: convert.to-rem(2px);
181
181
  inset-inline-start: convert.to-rem(2px);
182
182
  }
@@ -22,7 +22,9 @@
22
22
  color: theme.$text-secondary;
23
23
  margin-inline-end: spacing.$spacing-03;
24
24
  }
25
-
25
+ :host([slot='label-text']) .#{$prefix}--toggletip-label {
26
+ @include type.type-style('label-01');
27
+ }
26
28
  .#{$prefix}--toggletip-button {
27
29
  @include button-reset.reset();
28
30