Skip to content

Commit 9582a5e

Browse files
committed
fix(tabs): saturated context for earth variant
1 parent cb58fbf commit 9582a5e

File tree

5 files changed

+61
-6
lines changed

5 files changed

+61
-6
lines changed

elements/pfe-tabs/pfe-tab-panel.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@
126126
}
127127

128128
:host([on="saturated"][variant="earth"]) {
129-
background-color: pfe-local(BackgroundColor, $region: panel, $fallback: pfe-var(surface--lightest));
130-
@include pfe-set-broadcast-context(light);
129+
background-color: pfe-local(BackgroundColor, $region: panel, $fallback: pfe-var(surface--accent));
130+
@include pfe-set-broadcast-context(saturated);
131131
}
132132

133133
:host([on="saturated"]:not([variant="earth"])) {

elements/pfe-tabs/pfe-tab-panel.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
import type { ColorTheme } from '@patternfly/pfe-core';
2+
13
import { LitElement, html } from 'lit';
24
import { customElement, property } from 'lit/decorators.js';
35

4-
import { pfelement, initializer } from '@patternfly/pfe-core/decorators.js';
6+
import { pfelement, initializer, colorContextConsumer } from '@patternfly/pfe-core/decorators.js';
57
import { getRandomId } from '@patternfly/pfe-core/functions/random.js';
68

79
import style from './pfe-tab-panel.scss';
@@ -18,6 +20,12 @@ export class PfeTabPanel extends LitElement {
1820

1921
static readonly styles = [style];
2022

23+
/**
24+
* Sets color theme based on parent context
25+
*/
26+
@colorContextConsumer()
27+
@property({ reflect: true }) on?: ColorTheme;
28+
2129
/** Selected tab */
2230
@property({ type: Boolean, reflect: true, attribute: 'aria-selected' }) selected = false;
2331

elements/pfe-tabs/pfe-tab.scss

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,12 +233,24 @@
233233
}
234234

235235
// SATURATED
236+
:host([variant="earth"][on="saturated"]) {
237+
--pfe-tabs--BackgroundColor: #{pfe-var(surface--accent)};
238+
--pfe-tabs--BackgroundColor--inactive: #{pfe-var(surface--complement)};
239+
border-right-color: pfe-var(surface--border--darker);
240+
border-left-color: pfe-var(surface--border--darker);
241+
}
242+
236243
:host([variant="earth"][on="saturated"][aria-selected="false"]) {
237-
--pfe-tabs--BackgroundColor: #{pfe-var(surface--lighter)};
244+
--pfe-tabs--Color: #6a6e73 // !important;
238245
}
239246

240247
:host([variant="earth"][on="saturated"][aria-selected="true"]) {
241-
--pfe-tabs--BackgroundColor: #{pfe-var(surface--lightest)};
248+
--pfe-tabs--Color: #151515; // !important;
249+
}
250+
251+
:host([variant="earth"][on="saturated"][aria-selected="false"]:hover) {
252+
--pfe-tabs--BackgroundColor: #{pfe-var(surface--complement)};
253+
--pfe-tabs--Color: #6a6e73 // !important;
242254
}
243255

244256

@@ -265,6 +277,8 @@
265277
--pfe-tabs--BorderColor: #{pfe-var(surface--border)};
266278
}
267279

280+
// DARK
281+
268282
:host([on="dark"]:not([variant="earth"])) {
269283
--pfe-tabs--Color: #{pfe-var(text--on-dark)};
270284
--pfe-tabs--Color--focus: #{pfe-var(text--on-dark)};

elements/pfe-tabs/pfe-tab.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
import type { ColorTheme } from '@patternfly/pfe-core';
2+
13
import { LitElement, html } from 'lit';
24
import { customElement, property, query } from 'lit/decorators.js';
35

4-
import { pfelement, bound, observed, initializer } from '@patternfly/pfe-core/decorators.js';
6+
import { pfelement, bound, observed, initializer, colorContextConsumer } from '@patternfly/pfe-core/decorators.js';
57
import { getRandomId } from '@patternfly/pfe-core/functions/random.js';
68
import { Logger } from '@patternfly/pfe-core/controllers/logger.js';
79

@@ -31,6 +33,12 @@ export class PfeTab extends LitElement {
3133
/** Variant */
3234
@property({ reflect: true }) variant: 'wind'|'earth' = 'wind';
3335

36+
/**
37+
* Sets color theme based on parent context
38+
*/
39+
@colorContextConsumer()
40+
@property({ reflect: true }) on?: ColorTheme;
41+
3442
/** @deprecated `tabIndex` property reflects per spec */
3543
get tabindex() {
3644
return this.tabIndex;

elements/pfe-tabs/pfe-tabs.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1+
import type { ColorPalette, ColorTheme } from '@patternfly/pfe-core';
2+
13
import { LitElement, html } from 'lit';
24
import { customElement, property } from 'lit/decorators.js';
35

46
import {
57
bound,
68
cascades,
9+
colorContextConsumer,
10+
colorContextProvider,
11+
deprecation,
712
initializer,
813
observed,
914
pfelement,
@@ -60,6 +65,26 @@ export class PfeTabs extends LitElement {
6065

6166
private _setFocus = false;
6267

68+
/**
69+
* Sets color palette, which affects the element's styles as well as descendants' color theme.
70+
* Overrides parent color context.
71+
* Your theme will influence these colors so check there first if you are seeing inconsistencies.
72+
* See [CSS Custom Properties](#css-custom-properties) for default values
73+
*
74+
* Card always resets its context to `base`, unless explicitly provided with a `color-palette`.
75+
*/
76+
@colorContextProvider()
77+
@property({ reflect: true, attribute: 'color-palette' }) colorPalette?: ColorPalette;
78+
79+
/** @deprecated use `color-palette` */
80+
@deprecation({ alias: 'colorPalette', attribute: 'color' }) color?: ColorPalette;
81+
82+
/**
83+
* Sets color theme based on parent context
84+
*/
85+
@colorContextConsumer()
86+
@property({ reflect: true }) on?: ColorTheme;
87+
6388
/**
6489
* Values:
6590
* - `wind`: Borders are removed, only an accent colored indicator appears under the active heading.

0 commit comments

Comments
 (0)