@@ -24,6 +24,7 @@ governing permissions and limitations under the License.
24
24
--spectrum-standard-dialog-description-font-size : var (--spectrum-standard-dialog-body-font-size );
25
25
--spectrum-standard-dialog-description-font-style : var (--spectrum-body-sans-serif-font-style );
26
26
--spectrum-standard-dialog-description-font-family : var (--spectrum-body-sans-serif-font-family );
27
+ --spectrum-standard-dialog-header-content-font-size : var (--spectrum-standard-dialog-body-font-size );
27
28
28
29
--spectrum-standard-dialog-heading-line-height : var (--spectrum-title-line-height );
29
30
--spectrum-standard-dialog-description-line-height : var (--spectrum-line-height-200 );
@@ -71,12 +72,12 @@ governing permissions and limitations under the License.
71
72
}
72
73
}
73
74
74
- .spectrum-Dialog--small {
75
+ .spectrum-Dialog--sizeS {
75
76
--spectrum-standard-dialog-max-width : var (--spectrum-standard-dialog-maximum-width-small );
76
77
inline-size : var (--mod-standard-dialog-max-width-small , var (--spectrum-standard-dialog-max-width ));
77
78
}
78
79
79
- .spectrum-Dialog--large {
80
+ .spectrum-Dialog--sizeL {
80
81
--spectrum-standard-dialog-max-width : var (--spectrum-standard-dialog-maximum-width-large );
81
82
inline-size : var (--mod-standard-dialog-max-width-large , var (--spectrum-standard-dialog-max-width ));
82
83
}
@@ -98,6 +99,7 @@ governing permissions and limitations under the License.
98
99
auto
99
100
1fr
100
101
auto
102
+ var (--mod-standard-dialog-spacing-grid-padding , var (--spectrum-standard-dialog-spacing-grid-padding ))
101
103
minmax (0 , auto)
102
104
var (--mod-standard-dialog-spacing-grid-padding , var (--spectrum-standard-dialog-spacing-grid-padding ));
103
105
grid-template-rows :
@@ -108,22 +110,20 @@ governing permissions and limitations under the License.
108
110
auto
109
111
var (--mod-standard-dialog-spacing-grid-padding , var (--spectrum-standard-dialog-spacing-grid-padding ));
110
112
grid-template-areas :
111
- "hero hero hero hero hero hero"
112
- ". . . . . ."
113
- ". heading header header header ."
114
- ". content content content content ."
115
- ". footer footer buttonGroup buttonGroup ."
116
- ". . . . . ." ;
113
+ "hero hero hero hero hero hero hero"
114
+ ". . . . . . ."
115
+ ". heading header header header header ."
116
+ ". content content content content content ."
117
+ ". footer footer footer buttonGroup buttonGroup ."
118
+ ". . . . . . ." ;
117
119
inline-size : 100% ;
118
120
}
119
121
120
122
/* the dialog's heading/title */
121
123
.spectrum-Dialog-heading {
122
124
grid-area : heading;
123
125
124
- margin-block-start : 0 ;
125
-
126
- margin-inline-end : var (--mod-standard-dialog-spacing-title-to-header-content , var (--spectrum-standard-dialog-spacing-title-to-header-content ));
126
+ margin-block : 0 ;
127
127
font-size : var (--mod-standard-dialog-heading-font-size , var (--spectrum-standard-dialog-heading-font-size ));
128
128
font-weight : var (--mod-standard-dialog-heading-font-weight , var (--spectrum-standard-dialog-heading-font-weight ));
129
129
font-style : var (--spectrum-standard-dialog-heading-font-style );
@@ -132,18 +132,17 @@ governing permissions and limitations under the License.
132
132
color : var (--mod-standard-dialog-heading-text-color , var (--spectrum-standard-dialog-heading-text-color ));
133
133
outline : none; /* Hide focus outline */
134
134
135
- /* prevent the heading from moving out of the header element if additional content is long */
136
- min-inline-size : 50 % ;
135
+ /* prevent the heading/title from moving out of the header element if additional content is long */
136
+ min-inline-size : 40 % ;
137
137
138
- & .spectrum-Dialog-heading--noHeader {
139
- grid-area : heading-start / heading-start / header-end / header-end;
140
- padding-inline-end : 0 ;
138
+ & : has (~ .spectrum-Dialog-heading--noHeader ) {
139
+ margin-inline-end : 0 ;
141
140
}
141
+ }
142
142
143
- /* Remove the default margin on the Typography elements in the heading */
144
- .spectrum-Heading {
145
- margin-block : 0 ;
146
- }
143
+ .spectrum-Dialog-heading--noHeader {
144
+ grid-area : header;
145
+ padding-inline-end : 0 ;
147
146
}
148
147
149
148
/* the container for the heading and any additional header content */
@@ -152,6 +151,7 @@ governing permissions and limitations under the License.
152
151
display : flex;
153
152
max-inline-size : 100% ;
154
153
margin-block-end : var (--spectrum-standard-dialog-spacing-title-to-description );
154
+ gap : var (--mod-standard-dialog-spacing-title-to-header-content , var (--spectrum-standard-dialog-spacing-title-to-header-content ));
155
155
156
156
/* Without this, buttons will be stretched */
157
157
align-items : flex-start;
@@ -161,24 +161,18 @@ governing permissions and limitations under the License.
161
161
162
162
outline : none; /* Hide focus outline around header */
163
163
164
- > .spectrum-Body {
165
- /* additional header content should grow/shrink with the text, but only until it takes up half of the footer */
166
- inline-size : fit-content;
167
- max-inline-size : 50% ;
168
-
169
- /* Remove the default margin on the Typography in the header */
170
- margin-block : 0 ;
164
+ /* additional header content should grow/shrink with the text, but only until it takes up half of the header */
165
+ > .spectrum-Dialog-header-content {
166
+ max-inline-size : fit-content;
167
+ flex : 1 1 100% ;
168
+ font-size : var (--spectrum-standard-dialog-header-content-font-size );
169
+ text-wrap : pretty;
171
170
}
172
171
}
173
172
174
173
.spectrum-Dialog-content {
175
174
grid-area : content;
176
175
box-sizing : border-box;
177
-
178
- /*
179
- v2 is currently worse, inputs that get focus rings get a slight clipping unless overflow: visible replaces this line
180
- we should think of a better way to handle this, see padding/margin below for fix
181
- */
182
176
overflow-y : auto;
183
177
-webkit-overflow-scrolling : touch;
184
178
@@ -189,39 +183,31 @@ governing permissions and limitations under the License.
189
183
font-style : var (--spectrum-standard-dialog-description-font-style );
190
184
line-height : var (--mod-standard-dialog-description-line-height , var (--spectrum-standard-dialog-description-line-height ));
191
185
color : var (--mod-standard-dialog-description-text-color , var (--spectrum-standard-dialog-description-text-color ));
192
-
193
- /* Remove the default margin on the Typography elements in the dialog's body content */
194
- .spectrum-Body {
195
- margin-block : 0 ;
196
- }
197
186
}
198
187
199
188
.spectrum-Dialog-footer {
200
- grid-area : footer;
189
+ grid-area : footer / footer / buttonGroup / buttonGroup ;
201
190
max-inline-size : 100% ;
191
+ display : flex;
192
+ align-items : flex-end;
193
+
194
+ /* this recreates padding between the footer content and button group. It should be safe as button group is always end aligned */
195
+ gap : var (--mod-standard-dialog-spacing-footer-to-button-group , var (--spectrum-standard-dialog-spacing-footer-to-button-group ));
202
196
203
197
/* this padding isn't built into the grid because it disappears with this footer */
204
198
padding-block-start : var (--mod-standard-dialog-spacing-description-to-footer , var (--spectrum-standard-dialog-spacing-description-to-footer ));
205
199
206
- display : flex;
207
- justify-content : space-between;
208
- align-items : flex-end;
209
-
210
200
outline : none; /* Hide focus outline */
211
201
212
- /* Both selectors are required to override the button + button rule */
213
- > * ,
214
- > . spectrum-Button + . spectrum-Button {
215
- margin-block-end : 0 ;
202
+ . spectrum-Dialog-footer-content {
203
+ /* this attempts to give as much space as possible for the button group, particularly to avoid stacking on mobile. Some sizes still may have to stack. */
204
+ max-inline-size : calc ( 50 % - var ( --mod-standard-dialog-spacing-footer-to-button-group , var ( -- spectrum-standard-dialog-spacing-footer-to-button-group )));
205
+ flex : 1 1 100 % ;
216
206
}
217
207
218
- .spectrum-Body {
219
- /* To keep the footer text from wrapping prematurely */
220
- inline-size : fit-content;
221
- max-inline-size : 50% ;
222
-
223
- /* Remove the default margin on the Typography in the footer content */
224
- margin-block-end : 0 ;
208
+ & : has (.spectrum-Dialog-footer-content ),
209
+ & : has (.spectrum-Dialog-buttonGroup ) {
210
+ justify-content : space-between;
225
211
}
226
212
}
227
213
@@ -232,17 +218,14 @@ governing permissions and limitations under the License.
232
218
/* to override ButtonGroup's justify-content: normal and/or not having footer content */
233
219
justify-content : flex-end;
234
220
}
235
-
236
- /* this padding should be safe as button group is always end aligned */
237
- padding-inline-start : var (--mod-standard-dialog-spacing-footer-to-button-group , var (--spectrum-standard-dialog-spacing-footer-to-button-group ));
238
221
}
239
222
240
223
.spectrum-Dialog-buttonGroup--noFooter {
241
224
padding-block-start : var (--mod-standard-dialog-spacing-description-to-footer , var (--spectrum-standard-dialog-spacing-description-to-footer ));
242
225
}
243
226
244
227
/* Dismissible Dialog (with close button) */
245
- .spectrum-Dialog--dismissable .spectrum-Dialog-grid {
228
+ .spectrum-Dialog--dismissible .spectrum-Dialog-grid {
246
229
grid-template-columns :
247
230
var (--mod-standard-dialog-spacing-grid-padding , var (--spectrum-standard-dialog-spacing-grid-padding ))
248
231
auto
@@ -258,19 +241,20 @@ governing permissions and limitations under the License.
258
241
auto
259
242
var (--mod-standard-dialog-spacing-grid-padding , var (--spectrum-standard-dialog-spacing-grid-padding ));
260
243
grid-template-areas :
261
- "hero hero hero hero hero hero"
262
- ". . . . closeButton closeButton"
263
- ". heading header header closeButton closeButton"
264
- ". content content content content ."
265
- ". footer footer footer footer ."
266
- ". . . . . ." ;
244
+ "hero hero hero hero hero hero"
245
+ ". . . . closeButton closeButton"
246
+ ". heading header header closeButton closeButton"
247
+ ". content content content content ."
248
+ ". footer footer footer footer ."
249
+ ". . . . . ." ;
267
250
268
251
.spectrum-Dialog-footer {
269
252
grid-area : footer;
253
+ }
270
254
271
- > . spectrum-Body {
272
- max-inline-size : 100 % ;
273
- }
255
+ /* remove the margin on the title/heading if there's not extra header content */
256
+ . spectrum-Dialog-heading : has ( + . spectrum-Dialog-heading--noHeader ) {
257
+ margin-inline-end : 0 ;
274
258
}
275
259
}
276
260
@@ -293,7 +277,6 @@ governing permissions and limitations under the License.
293
277
.spectrum-Dialog--fullscreenTakeover {
294
278
inline-size : 100% ;
295
279
block-size : 100% ;
296
-
297
280
border-radius : 0 ;
298
281
}
299
282
@@ -302,7 +285,7 @@ governing permissions and limitations under the License.
302
285
max-block-size : none;
303
286
max-inline-size : none;
304
287
305
- & . spectrum-Dialog .spectrum-Dialog-grid {
288
+ .spectrum-Dialog-grid {
306
289
display : grid;
307
290
grid-template-columns :
308
291
var (--mod-standard-dialog-spacing-grid-padding , var (--spectrum-standard-dialog-spacing-grid-padding ))
@@ -326,7 +309,6 @@ governing permissions and limitations under the License.
326
309
grid-area : heading;
327
310
}
328
311
329
- /* @todo: can fullscreen/fullscreenTakeover dialogs be dismissible/have a close button? */
330
312
.spectrum-Dialog-closeButton {
331
313
display : none;
332
314
}
@@ -341,7 +323,6 @@ governing permissions and limitations under the License.
341
323
342
324
.spectrum-Dialog-buttonGroup {
343
325
grid-area : buttonGroup;
344
- align-self : auto;
345
326
}
346
327
}
347
328
@@ -372,7 +353,7 @@ governing permissions and limitations under the License.
372
353
". . . . . ." ;
373
354
}
374
355
375
- .spectrum-Dialog--dismissable .spectrum-Dialog-grid {
356
+ .spectrum-Dialog--dismissible .spectrum-Dialog-grid {
376
357
grid-template-columns :
377
358
var (--mod-standard-dialog-spacing-grid-padding , var (--spectrum-standard-dialog-spacing-grid-padding ))
378
359
auto
@@ -404,10 +385,7 @@ governing permissions and limitations under the License.
404
385
flex-direction : column;
405
386
align-items : flex-start;
406
387
justify-content : flex-start;
407
-
408
- > .spectrum-Body {
409
- max-inline-size : unset;
410
- }
388
+ gap : 0 ;
411
389
}
412
390
413
391
.spectrum-Dialog--fullscreen ,
@@ -423,16 +401,26 @@ governing permissions and limitations under the License.
423
401
auto
424
402
auto
425
403
1fr
404
+ var (--mod-standard-dialog-spacing-grid-padding , var (--spectrum-standard-dialog-spacing-grid-padding ))
426
405
auto
427
406
var (--mod-standard-dialog-spacing-grid-padding , var (--spectrum-standard-dialog-spacing-grid-padding ));
428
407
grid-template-areas :
429
408
". . ."
430
409
". heading ."
431
410
". header ."
432
411
". content ."
412
+ ". . ."
433
413
". buttonGroup ."
434
414
". . ." ;
435
415
}
416
+
417
+ .spectrum-Dialog-header {
418
+ margin-inline-end : 0 ;
419
+ }
420
+
421
+ .spectrum-Dialog-heading {
422
+ margin-inline-end : 0 ;
423
+ }
436
424
}
437
425
438
426
.spectrum-Dialog-heading {
0 commit comments