Debian Codegraph @

pkg/lib/patternfly/patternfly-6-overrides.scss

raw
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 /*** PF6 overrides ***/
3 // Pull in variables (for breakpoints)
4 @use "../global-variables" as *;
5
6 $phone: 767px;
7
8 // PF Select is deprecated - no issue reported upstream - this needs to be removed from our codebase
9 // Make select have the expected width
10 // REVIEW @Venefilyn: Check if still relevant
11 .pf-v6-c-select[data-popper-reference-hidden="false"] {
12 inline-size: auto;
13 }
14
15 /* New issue based on the regression based on workaround causing this issue: https://github.com/cockpit-project/cockpit/issues/21671
16 */
17 /* Old upstream: https://github.com/patternfly/patternfly/issues/4387 */
18 /* Old Cockpit-Podman: https://github.com/cockpit-project/cockpit-podman/issues/755 */
19 .pf-v6-c-form-control > select {
20 /* Right side needs to compensate for the icon and space around it,
21 for all browsers */
22 --pf-v6-c-form-control--PaddingInlineEnd: calc(
23 var(--pf-t--global--font--size--body--default) + var(--pf-t--global--spacer--lg)
24 );
25
26 @-moz-document url-prefix() { // stylelint-disable-line at-rule-no-vendor-prefix
27 /* "Unset" Firefox special handling in PatternFly; using consistent
28 spacing with others; this can be removed after PatternFly removes it */
29 --pf-v6-c-form-control--PaddingInlineStart: var(--pf-v6-c-form-control--inset--base);
30 }
31 }
32
33 // Fix the double-spacing issue in the non-deprecated split buttons
34 // https://github.com/patternfly/patternfly/issues/6632
35 // REVIEW @Venefilyn: not fixed upstream
36 .pf-m-split-button .pf-v6-c-menu-toggle__controls {
37 margin: 0;
38 }
39
40 // Fix menus cropping contents
41 // https://github.com/patternfly/patternfly/issues/6565
42 // NOTE @Venefilyn: Might need to migrate to some other component
43 .pf-v6-c-menu__item-text {
44 overflow: visible;
45 }
46
47 // The default gap between the rows in horizontal lists is too large
48 .pf-v6-c-description-list.pf-m-horizontal-on-sm,
49 .pf-v6-c-description-list.pf-m-horizontal {
50 --pf-v6-c-description-list--RowGap: var(--pf-t--global--spacer--300); // 1rem
51 }
52
53 .pf-v6-c-modal-box.pf-m-align-top {
54
55 // We utilize custom footers in dialogs
56 // Make sure that the buttons always appear in the next line from the inline alerts
57 .pf-v6-c-modal-box__footer {
58 flex-wrap: wrap;
59 row-gap: var(--pf-t--global--spacer--sm);
60
61 > div:not(.pf-v6-c-button):not(.dialog-wait-ct) {
62 flex: 0 0 100%;
63 }
64 }
65 }
66
67 // don't hide long dialog titles
68 .pf-v6-c-modal-box__title-text {
69 white-space: normal;
70 }
71
72 // Modals should accommodate content width, as languages can make elements (especially buttons) too long
73 // https://github.com/patternfly/patternfly/issues/7440
74 .pf-v6-c-modal-box {
75 min-inline-size: min-content;
76 }
77
78
79 .pf-v6-c-card {
80 // FIXME: Using an expandable content within a card would cause the card to be scrollable while nothing
81 // would be in view. Makes it look like there is something to scroll to when there isn't anything.
82 // PF deliberately makes expandable `[hidden]` content have `display: revert` which would make them have
83 // `display: block` or whatever is default from the browser. They do this to make animations work.
84 // Until fixed upstream we revert their `display: revert` rule.
85 // https://github.com/patternfly/patternfly/issues/7746
86 .pf-v6-c-expandable-section__content:where([hidden]) {
87 display: none;
88 }
89
90 // https://github.com/patternfly/patternfly/issues/3959
91 // TODO @Venefilyn: Change so we use .pf-m-no-offset, then remove this
92 // --pf-v6-c-card__header-toggle--MarginTop: 0;
93
94 .pf-v6-c-card__header:not(.ct-card-expandable-header),
95 .pf-v6-c-card__header:not(.ct-card-expandable-header) .pf-v6-c-card__header-main {
96 // upstream fix (pending): https://github.com/patternfly/patternfly/pull/3714
97 display: flex;
98 flex-wrap: wrap;
99 row-gap: var(--pf-t--global--spacer--sm);
100 justify-content: space-between;
101 }
102
103 .pf-v6-c-card__header:not(.ct-card-expandable-header) {
104 > .pf-v6-c-card__actions {
105 flex-wrap: wrap;
106 row-gap: var(--pf-t--global--spacer--sm);
107
108 // PF4 CardActions act up when using buttons while the title is large of font
109 // https://github.com/patternfly/patternfly/issues/3713
110 // https://github.com/patternfly/patternfly/issues/4362
111 margin: unset;
112 padding-inline: var(--pf-v6-c-card__actions--PaddingLeft) unset;
113 }
114 }
115 }
116
117 // Add some spacing to nested form groups - PF4 does not support these yet
118 // https://github.com/patternfly/patternfly-design/issues/1012
119 .pf-v6-c-form__group-control {
120 .pf-v6-c-form__group,
121 .pf-v6-c-form__section {
122 padding-block-start: var(--pf-t--global--spacer--md);
123 }
124 }
125
126 // Alerts use elements that have fonts set in other frameworks (including PF3);
127 // generally, this is an H4 that often has a font size and sometimes family set.
128 // Therefore, it should inherit from the alert font set at the pf-v6-c-alert level.
129 // https://github.com/patternfly/patternfly/issues/4206
130 .pf-v6-c-alert__title {
131 font-size: inherit;
132 font-family: inherit;
133 }
134
135 .pf-v6-c-toolbar {
136 // Make summary content use the same vertical space as the filter toggle,
137 // when possible.
138 // https://github.com/patternfly/patternfly-design/issues/1055
139 &.ct-compact {
140 @media screen and (max-width: $pf-v6-global--breakpoint--lg - 1) {
141 display: flex;
142 flex-wrap: wrap;
143
144 > .pf-v6-c-toolbar__content:first-child {
145 flex: auto;
146 }
147
148 .pf-v6-c-toolbar__content-section {
149 inline-size: auto;
150 }
151 }
152 }
153 }
154
155 // When there is an Alert above the Form add some spacing
156 .pf-v6-c-modal-box .pf-v6-c-alert + .pf-v6-c-form {
157 padding-block-start: var(--pf-t--global--font--size--sm);
158 }
159
160 // HACK: Not possible to specify text, so needs some hacks, see https://github.com/patternfly/patternfly-react/issues/6140
161 .pf-v6-c-toolbar__toggle {
162 .pf-v6-c-button.pf-m-plain {
163 color: var(--pf-v6-c-button--m-link--Color);
164
165 .pf-v6-c-button__icon {
166 margin-inline-end: var(--pf-t--global--spacer--sm);
167 }
168 }
169 }
170
171 // Flex should use gap, not a margin hack
172 // https://github.com/patternfly/patternfly/issues/4523
173 // Override default spacing from lg -> md
174 .pf-v6-l-flex {
175 gap: var(--pf-v6-l-flex--spacer-base);
176
177 &:not([class*="pf-m-space-items-"]) {
178 gap: var(--pf-v6-l-flex--spacer--md);
179
180 > * {
181 --pf-v6-l-flex--spacer--column: 0;
182 }
183 }
184
185 // Negate the margin hack used by immediate flex children
186 // (except for nested flex, as we want to mind the gap)
187 > :not(.pf-v6-l-flex) {
188 --pf-v6-l-flex--spacer-base: 0;
189 }
190
191 // Undo all spacer modification adjustments
192 &[class*="pf-m-space-items-"] {
193 > * {
194 --pf-v6-l-flex--spacer--column: 0;
195 }
196 }
197
198 // Re-add spacer modification adjustments on the flex layout widget
199 // (using class attribute matching for handling breakpoint -on- also)
200 @each $size in (none, xs, sm, md, lg, xl, 2xl, 3xl, 4xl) {
201 &[class*="pf-m-space-items-#{$size}"] {
202 --pf-v6-l-flex--spacer-base: var(--pf-v6-l-flex--spacer--#{$size});
203 }
204 }
205 }
206
207 // PF Modals has a brighter background than normal pages in dark mode.
208 // Tables are made to match the background but since modals change background
209 // this is something we need to change ourselves
210 // https://github.com/patternfly/patternfly/issues/5278
211 .pf-v6-c-modal-box .pf-v6-c-table {
212 background-color: inherit;
213 }
214
215 // Breadcrumb links should have the correct pointing hand cursor.
216 //
217 // PatternFly requires a "to" attribute for an actual link, but we use some
218 // funky onClick JS for navigating and override it with a className.
219 //
220 // Therefore, instead of having a proper <a href="..."> being rendered, we need
221 // to override the link. This is a problem with a (correct) assumption in PF
222 // and our (incorrect) way of not using links (but using JavaScript) for
223 // linking.
224 //
225 // Nevertheless, Cockpit needs to be adapted for this to work as expected.
226 .pf-v6-c-breadcrumb__link {
227 cursor: pointer;
228 }
229
230 // Dark mode fixes for several PF components
231 .pf-v6-theme-dark {
232
233 // FIXME: https://github.com/patternfly/patternfly/issues/5278
234 .pf-v6-c-modal-box .pf-v6-c-table {
235 background-color: inherit;
236 }
237
238 // FIXME: Force FormSelect's to get a readable background.
239 // https://github.com/patternfly/patternfly/issues/7593
240 // https://issues.redhat.com/browse/RHEL-97180
241 .pf-v6-c-form-control select:not(:disabled) {
242 background-color: var(--pf-t--global--background--color--floating--default);
243 }
244 }
245
246 @media screen and (max-width: $pf-v6-global--breakpoint--md) {
247 // Reduce side padding in mobile mode,
248 // intended mainly for PF PageSection elements (pf-v6-c-page__main-section).
249 // It's similar to adding padding={{ default: 'noPadding', sm: 'padding' }},
250 // except this only affects the sides, not the top and bottom.
251 .pf-v6-c-page__main>section.pf-v6-c-page__main-section:not(.pf-m-padding) {
252 padding-inline: var(--pf-t--global--spacer--xs);
253 }
254 }
255
256 // Override as PF Page doesn't allow empty masthead and sidebar
257 @media (min-width: 75rem) {
258 // Please use .pf-m-no-sidebar instead as it is the new class name in PF for this
259 .pf-v6-c-page.no-masthead-sidebar { /* custom class to scope this style to a specific page component instance */
260 --pf-v6-c-page__main-container--GridArea: var(--pf-v6-c-page--masthead--main-container--GridArea);
261 }
262 }
263
264 /* FIXME: Temporary rework plain cards to make it look like how PF6 is designed, removing the extra padding */
265 .pf-v6-c-card.pf-m-plain {
266 // Plain PF Cards just remove the border color and background, but we should also make sure that the radius is
267 // removed so that tables etc. don't get weird borders on the first and last cell.
268 // This mostly happens when we're not using card body
269 border-radius: 0;
270
271 .pf-v6-c-card__header, > .pf-v6-c-card__title {
272 padding-inline: 0;
273 }
274
275 .pf-v6-c-card__body.contains-list {
276 padding: 0;
277 }
278 }
279
280 // FIXME: Temporary rework table cards in mobile/small view to have row dividers between each row.
281 .pf-v6-c-card.ct-small-table-card {
282 border-block-start: var(--pf-t--global--border--width--100) solid var(--pf-t--global--border--color--default);
283 border-radius: var(--pf-t--global--border--radius--0);
284 }
285
286 // NOTEs @Venefilyn: Expandable table has an alignment issue with the expand button and the text
287 // Tracked upstream here https://github.com/patternfly/patternfly/issues/7423
288 .pf-v6-c-table.pf-m-compact .pf-v6-c-table__toggle:has(.pf-v6-c-button:not(.pf-m-small)) {
289 --pf-v6-c-table--m-compact__action--PaddingBlockStart: 0
290 }
291
292 // HACK: Patternfly has a weird issue with modals and skip to content
293 // button not being hidden as it should on rtl mode. Instead, it will make the
294 // page extremely wide and cause modals to be very offset. Changing from
295 // `absolute` to `fixed` makes sure that it all works as it should.
296 //
297 // Only applicable to Firefox, works fine in Chrome. Might also be fine outside
298 // of Firefox Responsive Design Mode. Verified to be an issue in PF v6.2.0
299 //
300 // https://github.com/patternfly/patternfly/issues/7463
301 .pf-v6-c-skip-to-content {
302 position: fixed;
303 }
304
305 // FIXME @Venefilyn: Due to a Patternfly bug when it comes to showing the
306 // scrollbars of subnavs, we have to workaround it by just making it wrap
307 // instead of scroll. (ugly but functional).
308 // Issue found in PF 6.2.0
309 // https://github.com/patternfly/patternfly-react/issues/11751
310 .services-header .pf-m-subnav {
311 --pf-v6-c-nav--m-horizontal--m-subnav--BorderRadius: var(--pf-t--global--border--radius--200);
312
313 .pf-v6-c-nav__list {
314 flex-wrap: wrap;
315 }
316 }
317
318 // NOTE: PF6 workaround, when table is in the small screen layout PF sets too big font-weight
319 // https://github.com/patternfly/patternfly/issues/7526
320 .pf-v6-c-table .pf-v6-c-table__tbody :where(.pf-v6-c-table__th, .pf-v6-c-table__td)[data-label]::before {
321 font-weight: var(--pf-t--global--font--weight--body--bold);
322 }
323
324 // NOTE: Though Patternfly includes the icon content important severity color
325 // it is primarily used for severity icons that are not exposed in PF React but
326 // instead part of a different PF Component Group
327 // https://www.patternfly.org/patterns/status-and-severity/#severity-icons
328 // https://www.patternfly.org/component-groups/status-and-state-indicators/severity
329 .pf-v6-c-icon.pf-m-important {
330 --pf-v6-c-icon__content--Color: var(--pf-t--global--icon--color--severity--important--default);
331 }
332
333 // HACK: Patternfly 6.6.0 migrated from the deprecated word-break to overflow-wrap
334 // incorrectly and did a text-replace from `word-break: break-word` to
335 // `overflow-wrap: break-word`. According to MDN the behaviour is different and
336 // should instead be `overflow-wrap: anywhere`.
337 // Reverts https://github.com/patternfly/patternfly/commit/fff5587739106601d9c1e4b27f090c16603ce3a1
338 // Bug report https://github.com/patternfly/patternfly/issues/8484
339 // MDN note https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/word-break#break-word
340 .pf-v6-c-alert__title,
341 .pf-v6-c-clipboard-copy__text,
342 .pf-v6-c-menu__item-description,
343 .pf-v6-c-modal-box__body,
344 .pf-v6-c-notification-drawer__group-toggle-title,
345 .pf-v6-c-notification-drawer__list-item-description,
346 .pf-v6-c-notification-drawer__list-item-header-title,
347 .pf-v6-c-progress__description,
348 .pf-v6-c-progress__status,
349 .pf-v6-c-title,
350 .pf-v6-c-tooltip__content,
351 .pf-v6-c-wizard__main,
352 .pf-v6-c-wizard__nav-link,
353 .pf-v6-c-wizard__toggle-list-item {
354 overflow-wrap: anywhere;
355 }