| 1 |
@use '../../sass-utilities' as *; |
| 2 |
|
| 3 |
@include pf-root($modal-box) { |
| 4 |
--#{$modal-box}--BackgroundColor: var(--pf-t--global--background--color--floating--default); |
| 5 |
--#{$modal-box}--BorderColor: var(--pf-t--global--border--color--high-contrast); |
| 6 |
--#{$modal-box}--BorderWidth: var(--pf-t--global--border--width--high-contrast--regular); |
| 7 |
--#{$modal-box}--BorderRadius: var(--pf-t--global--border--radius--large); |
| 8 |
--#{$modal-box}--BoxShadow: var(--pf-t--global--box-shadow--lg); |
| 9 |
--#{$modal-box}--ZIndex: var(--pf-t--global--z-index--xl); // TODO use a z-index token |
| 10 |
--#{$modal-box}--Width: 100%; |
| 11 |
--#{$modal-box}--MaxWidth: calc(100% - var(--pf-t--global--spacer--xl)); // Ensure modal has gutters at full width |
| 12 |
--#{$modal-box}--m-sm--sm--MaxWidth: #{pf-size-prem(560px)}; // MaxWidth is based on optimal line length for reading |
| 13 |
--#{$modal-box}--m-md--Width: #{pf-size-prem(840px)}; |
| 14 |
--#{$modal-box}--m-lg--lg--MaxWidth: #{pf-size-prem(1120px)}; |
| 15 |
--#{$modal-box}--MaxHeight: calc(100% - var(--pf-t--global--spacer--2xl)); // MaxHeight ensures that the modal will not go off the screen and instead the body will scroll |
| 16 |
--#{$modal-box}--m-align-top--spacer: var(--pf-t--global--spacer--sm); |
| 17 |
--#{$modal-box}--m-align-top--xl--spacer: var(--pf-t--global--spacer--xl); |
| 18 |
--#{$modal-box}--m-align-top--InsetBlockStart: var(--#{$modal-box}--m-align-top--spacer); |
| 19 |
--#{$modal-box}--m-align-top--MaxHeight: calc(100% - min(var(--#{$modal-box}--m-align-top--spacer), var(--pf-t--global--spacer--2xl)) - var(--#{$modal-box}--m-align-top--spacer)); |
| 20 |
--#{$modal-box}--m-align-top--MaxWidth: calc(100% - min(var(--#{$modal-box}--m-align-top--spacer) * 2, var(--pf-t--global--spacer--xl))); |
| 21 |
|
| 22 |
// States |
| 23 |
--#{$modal-box}--m-danger__title-icon--Color: var(--pf-t--global--icon--color--status--danger--default); |
| 24 |
--#{$modal-box}--m-warning__title-icon--Color: var(--pf-t--global--icon--color--status--warning--default); |
| 25 |
--#{$modal-box}--m-success__title-icon--Color: var(--pf-t--global--icon--color--status--success--default); |
| 26 |
--#{$modal-box}--m-info__title-icon--Color: var(--pf-t--global--icon--color--status--info--default); |
| 27 |
--#{$modal-box}--m-custom__title-icon--Color: var(--pf-t--global--icon--color--status--custom--default); |
| 28 |
|
| 29 |
@media (min-width: $pf-v6-global--breakpoint--xl) { |
| 30 |
--#{$modal-box}--m-align-top--spacer: var(--#{$modal-box}--m-align-top--xl--spacer); |
| 31 |
} |
| 32 |
|
| 33 |
// Header |
| 34 |
--#{$modal-box}__header--PaddingBlockStart: var(--pf-t--global--spacer--lg); |
| 35 |
--#{$modal-box}__header--PaddingBlockEnd: var(--pf-t--global--spacer--sm); |
| 36 |
--#{$modal-box}__header--PaddingInlineEnd: var(--pf-t--global--spacer--lg); |
| 37 |
--#{$modal-box}__header--PaddingInlineStart: var(--pf-t--global--spacer--lg); |
| 38 |
--#{$modal-box}__header--Gap: var(--pf-t--global--spacer--md); |
| 39 |
|
| 40 |
// Header main |
| 41 |
--#{$modal-box}__header-main--Gap: var(--pf-t--global--spacer--md); |
| 42 |
--#{$modal-box}__header-main--PaddingBlockStart: var(--pf-t--global--spacer--control--vertical--plain); |
| 43 |
|
| 44 |
// Title |
| 45 |
--#{$modal-box}__title--LineHeight: var(--pf-t--global--font--line-height--heading); |
| 46 |
--#{$modal-box}__title--FontFamily: var(--pf-t--global--font--family--heading); |
| 47 |
--#{$modal-box}__title--FontWeight: var(--pf-t--global--font--weight--heading--default); |
| 48 |
--#{$modal-box}__title--FontSize: var(--pf-t--global--font--size--heading--md); |
| 49 |
|
| 50 |
// Title icon |
| 51 |
--#{$modal-box}__title-icon--MarginInlineEnd: var(--pf-t--global--spacer--sm); |
| 52 |
--#{$modal-box}__title-icon--Color: var(--pf-t--global--icon--color--regular); |
| 53 |
|
| 54 |
// Description |
| 55 |
--#{$modal-box}__description--FontSize: var(--pf-t--global--font--size--body--sm); |
| 56 |
--#{$modal-box}__description--Color: var(--pf-t--global--text--color--subtle); |
| 57 |
|
| 58 |
// Body |
| 59 |
--#{$modal-box}__body--MinHeight: calc(var(--pf-t--global--font--size--body--default) * var(--pf-t--global--font--line-height--body)); // Allow for at least 1 line of content in the body |
| 60 |
--#{$modal-box}__body--PaddingBlockStart: var(--pf-t--global--spacer--lg); |
| 61 |
--#{$modal-box}__body--PaddingInlineEnd: var(--pf-t--global--spacer--lg); |
| 62 |
--#{$modal-box}__body--PaddingInlineStart: var(--pf-t--global--spacer--lg); |
| 63 |
--#{$modal-box}__body--last-child--PaddingBlockEnd: var(--pf-t--global--spacer--lg); |
| 64 |
--#{$modal-box}__header--body--PaddingBlockStart: var(--pf-t--global--spacer--sm); |
| 65 |
|
| 66 |
// Close |
| 67 |
--#{$modal-box}__close--InsetBlockStart: var(--#{$modal-box}__header--PaddingBlockStart); |
| 68 |
--#{$modal-box}__close--InsetInlineEnd: var(--#{$modal-box}__header--PaddingInlineEnd); |
| 69 |
--#{$modal-box}__close--sibling--MarginInlineEnd: calc(var(--pf-t--global--spacer--xl) + var(--pf-t--global--spacer--sm)); |
| 70 |
|
| 71 |
// Footer |
| 72 |
--#{$modal-box}__footer--PaddingBlockStart: var(--pf-t--global--spacer--lg); |
| 73 |
--#{$modal-box}__footer--PaddingInlineEnd: var(--pf-t--global--spacer--lg); |
| 74 |
--#{$modal-box}__footer--PaddingBlockEnd: var(--pf-t--global--spacer--lg); |
| 75 |
--#{$modal-box}__footer--PaddingInlineStart: var(--pf-t--global--spacer--lg); |
| 76 |
|
| 77 |
// Footer buttons |
| 78 |
--#{$modal-box}__footer--c-button--MarginInlineEnd: var(--pf-t--global--spacer--gap--action-to-action--default); |
| 79 |
--#{$modal-box}__footer--c-button--sm--MarginInlineEnd: var(--pf-t--global--spacer--gap--action-to-action--default); |
| 80 |
} |
| 81 |
|
| 82 |
.#{$modal-box} { |
| 83 |
position: relative; |
| 84 |
z-index: var(--#{$modal-box}--ZIndex); |
| 85 |
display: flex; |
| 86 |
flex-direction: column; |
| 87 |
width: var(--#{$modal-box}--Width); |
| 88 |
max-width: var(--#{$modal-box}--MaxWidth); |
| 89 |
max-height: var(--#{$modal-box}--MaxHeight); |
| 90 |
overflow: auto; |
| 91 |
background-color: var(--#{$modal-box}--BackgroundColor); |
| 92 |
border: var(--#{$modal-box}--BorderWidth) solid var(--#{$modal-box}--BorderColor); |
| 93 |
border-radius: var(--#{$modal-box}--BorderRadius); |
| 94 |
box-shadow: var(--#{$modal-box}--BoxShadow); |
| 95 |
|
| 96 |
&.pf-m-sm { |
| 97 |
--#{$modal-box}--Width: var(--#{$modal-box}--m-sm--sm--MaxWidth); |
| 98 |
} |
| 99 |
|
| 100 |
&.pf-m-md { |
| 101 |
--#{$modal-box}--Width: var(--#{$modal-box}--m-md--Width); |
| 102 |
} |
| 103 |
|
| 104 |
&.pf-m-lg { |
| 105 |
--#{$modal-box}--Width: var(--#{$modal-box}--m-lg--lg--MaxWidth); |
| 106 |
} |
| 107 |
|
| 108 |
&.pf-m-align-top { |
| 109 |
inset-block-start: var(--#{$modal-box}--m-align-top--InsetBlockStart); |
| 110 |
align-self: flex-start; |
| 111 |
max-width: var(--#{$modal-box}--m-align-top--MaxWidth); |
| 112 |
max-height: var(--#{$modal-box}--m-align-top--MaxHeight); |
| 113 |
} |
| 114 |
|
| 115 |
@at-root .#{$modal-box}__title, |
| 116 |
& { |
| 117 |
&.pf-m-danger { |
| 118 |
--#{$modal-box}__title-icon--Color: var(--#{$modal-box}--m-danger__title-icon--Color); |
| 119 |
} |
| 120 |
} |
| 121 |
|
| 122 |
@at-root .#{$modal-box}__title, |
| 123 |
& { |
| 124 |
&.pf-m-warning { |
| 125 |
--#{$modal-box}__title-icon--Color: var(--#{$modal-box}--m-warning__title-icon--Color); |
| 126 |
} |
| 127 |
} |
| 128 |
|
| 129 |
@at-root .#{$modal-box}__title, |
| 130 |
& { |
| 131 |
&.pf-m-success { |
| 132 |
--#{$modal-box}__title-icon--Color: var(--#{$modal-box}--m-success__title-icon--Color); |
| 133 |
} |
| 134 |
} |
| 135 |
|
| 136 |
@at-root .#{$modal-box}__title, |
| 137 |
& { |
| 138 |
&.pf-m-custom { |
| 139 |
--#{$modal-box}__title-icon--Color: var(--#{$modal-box}--m-custom__title-icon--Color); |
| 140 |
} |
| 141 |
} |
| 142 |
|
| 143 |
@at-root .#{$modal-box}__title, |
| 144 |
& { |
| 145 |
&.pf-m-info { |
| 146 |
--#{$modal-box}__title-icon--Color: var(--#{$modal-box}--m-info__title-icon--Color); |
| 147 |
} |
| 148 |
} |
| 149 |
} |
| 150 |
|
| 151 |
// Close button |
| 152 |
.#{$modal-box}__close { |
| 153 |
position: absolute; |
| 154 |
inset-block-start: var(--#{$modal-box}__close--InsetBlockStart); |
| 155 |
inset-inline-end: var(--#{$modal-box}__close--InsetInlineEnd); |
| 156 |
|
| 157 |
+ * { |
| 158 |
margin-inline-end: var(--#{$modal-box}__close--sibling--MarginInlineEnd); // Create room for the close button |
| 159 |
} |
| 160 |
} |
| 161 |
|
| 162 |
.#{$modal-box}__header { |
| 163 |
display: flex; |
| 164 |
flex-shrink: 0; |
| 165 |
flex-direction: column; |
| 166 |
gap: var(--#{$modal-box}__header--Gap); |
| 167 |
padding-block-start: var(--#{$modal-box}__header--PaddingBlockStart); |
| 168 |
padding-block-end: var(--#{$modal-box}__header--PaddingBlockEnd); |
| 169 |
padding-inline-start: var(--#{$modal-box}__header--PaddingInlineStart); |
| 170 |
padding-inline-end: var(--#{$modal-box}__header--PaddingInlineEnd); |
| 171 |
|
| 172 |
&.pf-m-help { |
| 173 |
display: flex; |
| 174 |
flex-direction: row; |
| 175 |
} |
| 176 |
|
| 177 |
+ .#{$modal-box}__body { |
| 178 |
--#{$modal-box}__body--PaddingBlockStart: var(--#{$modal-box}__header--body--PaddingBlockStart); |
| 179 |
} |
| 180 |
} |
| 181 |
|
| 182 |
.#{$modal-box}__header-main { |
| 183 |
display: flex; |
| 184 |
flex-grow: 1; |
| 185 |
flex-direction: column; |
| 186 |
gap: var(--#{$modal-box}__header-main--Gap); |
| 187 |
min-width: 0; |
| 188 |
padding-block-start: var(--#{$modal-box}__header-main--PaddingBlockStart); |
| 189 |
} |
| 190 |
|
| 191 |
.#{$modal-box}__title, |
| 192 |
.#{$modal-box}__title-text { |
| 193 |
@include pf-v6-text-overflow; |
| 194 |
} |
| 195 |
|
| 196 |
.#{$modal-box}__title { |
| 197 |
flex: 0 0 auto; |
| 198 |
font-family: var(--#{$modal-box}__title--FontFamily); |
| 199 |
font-size: var(--#{$modal-box}__title--FontSize); |
| 200 |
font-weight: var(--#{$modal-box}__title--FontWeight); |
| 201 |
line-height: var(--#{$modal-box}__title--LineHeight); |
| 202 |
|
| 203 |
&.pf-m-icon { |
| 204 |
display: flex; |
| 205 |
} |
| 206 |
} |
| 207 |
|
| 208 |
.#{$modal-box}__title-icon { |
| 209 |
margin-inline-end: var(--#{$modal-box}__title-icon--MarginInlineEnd); |
| 210 |
color: var(--#{$modal-box}__title-icon--Color); |
| 211 |
} |
| 212 |
|
| 213 |
.#{$modal-box}__description { |
| 214 |
padding-block-start: var(--#{$modal-box}__description--PaddingBlockStart); |
| 215 |
font-size: var(--#{$modal-box}__description--FontSize); |
| 216 |
color: var(--#{$modal-box}__description--Color); |
| 217 |
} |
| 218 |
|
| 219 |
// Body |
| 220 |
.#{$modal-box}__body { |
| 221 |
flex: 1 1 auto; |
| 222 |
min-height: var(--#{$modal-box}__body--MinHeight); |
| 223 |
padding-block-start: var(--#{$modal-box}__body--PaddingBlockStart); |
| 224 |
padding-inline-start: var(--#{$modal-box}__body--PaddingInlineStart); |
| 225 |
padding-inline-end: var(--#{$modal-box}__body--PaddingInlineEnd); |
| 226 |
overflow-x: hidden; |
| 227 |
overflow-y: auto; |
| 228 |
overscroll-behavior: contain; |
| 229 |
overflow-wrap: anywhere; |
| 230 |
-webkit-overflow-scrolling: touch; |
| 231 |
|
| 232 |
&:last-child { |
| 233 |
padding-block-end: var(--#{$modal-box}__body--last-child--PaddingBlockEnd); |
| 234 |
} |
| 235 |
} |
| 236 |
|
| 237 |
// Footer |
| 238 |
.#{$modal-box}__footer { |
| 239 |
display: flex; |
| 240 |
flex: 0 0 auto; |
| 241 |
align-items: center; |
| 242 |
padding-block-start: var(--#{$modal-box}__footer--PaddingBlockStart); |
| 243 |
padding-block-end: var(--#{$modal-box}__footer--PaddingBlockEnd); |
| 244 |
padding-inline-start: var(--#{$modal-box}__footer--PaddingInlineStart); |
| 245 |
padding-inline-end: var(--#{$modal-box}__footer--PaddingInlineEnd); |
| 246 |
|
| 247 |
// Base margin left and right equal for buttons when wrapped |
| 248 |
> .#{$button}:not(:last-child) { |
| 249 |
margin-inline-end: var(--#{$modal-box}__footer--c-button--MarginInlineEnd); |
| 250 |
|
| 251 |
@media screen and (min-width: $pf-v6-global--breakpoint--sm) { |
| 252 |
--#{$modal-box}__footer--c-button--MarginInlineEnd: var(--#{$modal-box}__footer--c-button--sm--MarginInlineEnd); // remove in breaking change |
| 253 |
} |
| 254 |
} |
| 255 |
} |