Previews

No matching results.

x
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<button id="dialog-show-dialog-7b893c16-c9cf-4c1b-a5ea-325cb5e5b302" data-show-dialog-id="dialog-7b893c16-c9cf-4c1b-a5ea-325cb5e5b302" type="button" data-view-component="true" class="Button--secondary Button--medium Button"> <span class="Button-content">
<span class="Button-label">Show Dialog</span>
</span>
</button>
<dialog-helper>
<dialog open="open" id="dialog-7b893c16-c9cf-4c1b-a5ea-325cb5e5b302" aria-modal="true" aria-labelledby="dialog-7b893c16-c9cf-4c1b-a5ea-325cb5e5b302-title" aria-describedby="dialog-7b893c16-c9cf-4c1b-a5ea-325cb5e5b302-description" data-view-component="true" class="Overlay Overlay-whenNarrow Overlay--size-medium Overlay--motion-scaleFade Overlay--full-whenNarrow Overlay--disableScroll">
<div data-view-component="true" class="Overlay-header">
<div class="Overlay-headerContentWrap">
<div class="Overlay-titleWrap">
<h1 class="Overlay-title " id="dialog-7b893c16-c9cf-4c1b-a5ea-325cb5e5b302-title">
Test Dialog
</h1>
</div>
<div class="Overlay-actionWrap">
<button data-close-dialog-id="dialog-7b893c16-c9cf-4c1b-a5ea-325cb5e5b302" aria-label="Close" type="button" data-view-component="true" class="close-button Overlay-closeButton"><svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x">
<path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path>
</svg></button>
</div>
</div>
</div>
<scrollable-region data-labelled-by="dialog-7b893c16-c9cf-4c1b-a5ea-325cb5e5b302-title">
<div data-view-component="true" class="Overlay-body">Content</div>
</scrollable-region>
</dialog></dialog-helper>
1
2
3
4
5
6
7
8
render(Primer::Alpha::Dialog.new(open: true, title: title, subtitle: subtitle, size: size, position: position, position_narrow: position_narrow, visually_hide_title: visually_hide_title)) do |d|
if icon.present? && (icon != :none)
d.with_show_button(icon: icon, "aria-label": icon.to_s, disabled: disable_button)
else
d.with_show_button(disabled: disable_button) { button_text }
end
d.with_body { body_text }
end
Param Description Input

app/components/primer/alpha/dialog.css

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
/* stylelint-disable selector-max-specificity */
/* stylelint-disable selector-max-compound-selectors */
/* stylelint-disable max-nesting-depth */
/* stylelint-disable primer/responsive-widths */
/* stylelint-disable primer/spacing */
/* stylelint-disable selector-no-qualifying-type */
/* stylelint-disable selector-max-type */
/* Overlay */
/* The --dialog-scrollgutter property is used only on the body element to
* simulate scrollbar-gutter:stable. This property is not and should not
* be used elsewhere in the DOM. There is a performance penalty to
* setting inherited properties which can cause a large style recalc to
* occur, so it benefits us to prevent inheritance for this property.
* See https://web.dev/blog/at-property-performance
*/
@property --dialog-scrollgutter {
initial-value: 0;
inherits: false;
syntax: "<length>";
}
body:has(:modal) {
padding-right: var(--dialog-scrollgutter) !important;
}
body:has(dialog:modal.Overlay--disableScroll) {
overflow: hidden !important;
}
dialog.Overlay:not([open]) {
display: none;
}
.Overlay--hidden {
display: none !important;
}
.Overlay--visibilityHidden {
height: 0;
overflow: hidden;
visibility: hidden;
opacity: 0;
}
/* This is for @oddbird/popover-polyfill;
* A FOUC occurs in browsers which do not support :popover-open.
* We can try to hide the popover if :popover-open is not supported.
*/
@supports not selector(:popover-open) {
[popover]:not(.\:popover-open) {
display: none;
}
}
.Overlay {
position: static;
display: flex;
width: min(var(--overlay-width), 100vw - 2rem);
min-width: 192px;
max-height: min(calc(100vh - 2rem), var(--overlay-height));
padding: 0;
margin: auto;
color: var(--fgColor-default);
white-space: normal;
flex-direction: column;
background-color: var(--overlay-bgColor);
border: 0;
border-radius: var(--borderRadius-large);
box-shadow: var(--shadow-floating-small);
opacity: 1;
inset: 0;
}
.Overlay.Overlay--size-auto {
min-width: 192px;
max-width: calc(100vw - 2rem);
max-height: calc(100vh - 2rem);
}
.Overlay.Overlay--size-full {
width: 100vw;
height: 100vh;
}
.Overlay.Overlay--size-xsmall {
--overlay-width: 192px;
max-height: calc(100vh - 2rem);
}
.Overlay.Overlay--size-small {
--overlay-height: 256px;
--overlay-width: 320px;
}
.Overlay.Overlay--size-small-portrait {
--overlay-height: 432px;
--overlay-width: 320px;
}
.Overlay.Overlay--size-medium {
--overlay-height: 320px;
--overlay-width: 480px;
}
.Overlay.Overlay--size-medium-portrait {
--overlay-height: 600px;
--overlay-width: 480px;
}
.Overlay.Overlay--size-large {
--overlay-height: 432px;
--overlay-width: 640px;
}
.Overlay.Overlay--size-xlarge {
--overlay-height: 600px;
--overlay-width: 960px;
}
.Overlay.Overlay--height-auto {
height: auto;
}
.Overlay.Overlay--placement-left,.Overlay.Overlay--placement-right {
position: fixed;
height: 100%;
max-height: unset;
}
@media screen and (prefers-reduced-motion: no-preference) {
.Overlay.Overlay--motion-scaleFade,.Overlay.Overlay--placement-left,.Overlay.Overlay--placement-right {
animation: 200ms cubic-bezier(0.33, 1, 0.68, 1) 0s 1 normal none running Overlay--motion-scaleFade;
}
}
.Overlay.Overlay--placement-left {
inset: 0 auto 0 0;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
animation-name: Overlay--motion-slideInRight;
}
.Overlay.Overlay--placement-right {
inset: 0 0 0 auto;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
animation-name: Overlay--motion-slideInLeft;
}
/* start deprecate in favor of Alpha::Dialog */
.Overlay.Overlay--height-xsmall {
height: min(192px, 100vh - 2rem);
}
.Overlay.Overlay--height-small {
height: min(256px, 100vh - 2rem);
}
.Overlay.Overlay--height-medium {
height: min(320px, 100vh - 2rem);
}
.Overlay.Overlay--height-large {
height: min(432px, 100vh - 2rem);
}
.Overlay.Overlay--height-xlarge {
height: min(600px, 100vh - 2rem);
}
.Overlay.Overlay--width-auto {
width: auto;
}
.Overlay.Overlay--width-small {
width: min(256px, 100vw - 2rem);
}
.Overlay.Overlay--width-medium {
width: min(320px, 100vw - 2rem);
}
.Overlay.Overlay--width-large {
width: min(480px, 100vw - 2rem);
}
.Overlay.Overlay--width-xlarge {
width: min(640px, 100vw - 2rem);
}
.Overlay.Overlay--width-xxlarge {
width: min(960px, 100vw - 2rem);
}
/* end deprecate */
.Overlay:modal {
position: fixed;
}
@keyframes Overlay--motion-scaleFade {
0% {
opacity: 0;
transform: scale(0.5);
}
100% {
opacity: 1;
transform: scale(1);
}
}
/* for <form> element that wraps entire contents of overlay */
.Overlay-form {
display: flex;
overflow: auto;
flex-direction: column;
flex-grow: 1;
}
.Overlay-header {
z-index: 1;
display: flex;
color: var(--fgColor-default);
flex-direction: column;
}
.Overlay-header.Overlay-header--divided {
padding-bottom: var(--stack-padding-condensed);
/* stylelint-disable-next-line primer/box-shadow */
box-shadow: inset 0 calc(var(--borderWidth-thin) * -1) var(--borderColor-default);
}
.Overlay-header.Overlay-header--divided + .Overlay-body {
padding-top: var(--stack-padding-normal);
}
:is(.Overlay-header.Overlay-header--large .Overlay-headerContentWrap) .Overlay-titleWrap {
gap: var(--stack-gap-condensed);
}
:is(:is(.Overlay-header.Overlay-header--large .Overlay-headerContentWrap) .Overlay-titleWrap) .Overlay-title {
font-size: var(--text-title-size-medium);
}
:is(:is(.Overlay-header.Overlay-header--large .Overlay-headerContentWrap) .Overlay-titleWrap) .Overlay-description {
font-size: var(--text-body-size-medium);
}
.Overlay-header .Overlay-headerContentWrap {
display: flex;
align-items: flex-start;
gap: var(--stack-gap-condensed);
padding: var(--stack-gap-condensed) var(--stack-gap-condensed) 0 var(--stack-gap-condensed);
}
:is(.Overlay-header .Overlay-headerContentWrap) .Overlay-actionWrap {
display: flex;
flex-direction: row;
gap: var(--stack-gap-condensed);
}
:is(.Overlay-header .Overlay-headerContentWrap) .Overlay-titleWrap {
display: flex;
padding: calc(var(--stack-gap-condensed) * 0.75) 0 calc(var(--stack-gap-condensed) * 0.75)
var(--stack-gap-condensed);
flex-direction: column;
flex-grow: 1;
gap: var(--control-small-gap);
}
:is(:is(.Overlay-header .Overlay-headerContentWrap) .Overlay-titleWrap) .Overlay-title {
margin: 0;
font-size: var(--text-body-size-medium);
font-weight: var(--base-text-weight-semibold);
}
:is(:is(.Overlay-header .Overlay-headerContentWrap) .Overlay-titleWrap) .Overlay-description {
margin: 0;
font-size: var(--text-body-size-small);
font-weight: var(--base-text-weight-normal);
color: var(--fgColor-muted);
}
.Overlay-headerFilter {
padding: var(--stack-gap-condensed) var(--stack-gap-condensed) 0 var(--stack-gap-condensed);
}
/* generic body content slot */
.Overlay-body {
padding: var(--stack-padding-normal);
padding-top: 0;
overflow-y: auto;
scrollbar-width: thin;
font-size: var(--text-body-size-medium);
flex-grow: 1;
}
.Overlay-body.Overlay-body--paddingCondensed {
padding: var(--stack-padding-condensed);
padding-top: 0;
}
.Overlay-body.Overlay-body--paddingNone {
padding: 0;
}
/* generic footer slot */
.Overlay-footer {
z-index: 1;
display: flex;
padding: 0 var(--stack-padding-normal) var(--stack-padding-normal) var(--stack-padding-normal);
flex-direction: row;
flex-shrink: 0;
flex-wrap: wrap;
}
.Overlay-footer.Overlay-footer--divided {
padding-top: var(--stack-padding-normal);
/* stylelint-disable-next-line primer/box-shadow */
box-shadow: inset 0 var(--borderWidth-thin) var(--borderColor-default);
}
.Overlay-footer.Overlay-footer--alignStart {
justify-content: flex-start;
gap: var(--stack-gap-condensed);
}
.Overlay-footer.Overlay-footer--alignCenter {
justify-content: center;
gap: var(--stack-gap-condensed);
}
.Overlay-footer.Overlay-footer--alignEnd {
justify-content: flex-end;
gap: var(--stack-gap-condensed);
}
/* TODO: replace with refactored IconButton */
.Overlay-closeButton {
position: relative;
display: grid;
width: var(--base-size-32);
height: var(--base-size-32);
padding: 0;
color: var(--fgColor-muted);
cursor: pointer;
-webkit-user-select: none;
user-select: none;
background-color: transparent;
border: var(--borderWidth-thin) solid transparent;
border-radius: var(--borderRadius-medium);
transition: 0.2s cubic-bezier(0.3, 0, 0.5, 1);
transition-property: color, background-color, border-color;
place-content: center;
align-self: flex-start;
flex-shrink: 0;
}
.Overlay-closeButton:hover,.Overlay-closeButton:focus {
background-color: var(--button-default-bgColor-hover);
/* stylelint-disable-next-line primer/colors */
border: var(--borderWidth-thin) solid var(--control-bgColor-hover);
}
/* Override .close-button's `border: 0` that triggers a border-color transition on hover */
.Overlay-closeButton.close-button {
border: var(--borderWidth-thin) solid transparent;
}
/* variants must be mixins so we can extend within a media query (@extend is not supported inside media queries) */
/* border-radius repeats within placement options to ensure the original radius is reset when two classes co-exist */
/* full width */
.Overlay--full {
width: 100%;
max-width: 100vw;
height: 100%;
max-height: 100vh;
border-radius: unset !important;
flex-grow: 1;
}
/* responsive variants */
/* --viewportRange-narrowLandscape */
@media (max-width: 767px) {
.Overlay.Overlay--placement-left-whenNarrow, .Overlay--placement-right-whenNarrow {
position: fixed;
height: 100%;
max-height: 100vh;
}
.Overlay.Overlay--placement-left-whenNarrow {
inset: 0 auto 0 0;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
animation-name: Overlay--motion-slideInLeft;
}
.Overlay.Overlay--placement-right-whenNarrow {
inset: 0 0 0 auto;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
animation-name: Overlay--motion-slideInLeft;
}
.Overlay.Overlay--placement-bottom-whenNarrow {
width: 100%;
max-width: 100vw;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
animation-name: Overlay--motion-slideUp;
inset: auto 0 0;
}
.Overlay--full-whenNarrow {
width: 100%;
max-width: 100vw;
height: 100%;
max-height: 100vh;
border-radius: unset !important;
flex-grow: 1;
}
}
@keyframes Overlay--motion-slideDown {
from {
transform: translateY(-100%);
}
}
@keyframes Overlay--motion-slideUp {
from {
transform: translateY(100%);
}
}
@keyframes Overlay--motion-slideInRight {
from {
transform: translateX(-100%);
}
}
@keyframes Overlay--motion-slideInLeft {
from {
transform: translateX(100%);
}
}