Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate color custom properties from Polaris v11 to v12 #10797

Merged
merged 5 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions polaris-react/src/components/ActionList/ActionList.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@ $indented-item-width: calc(100% - #{$indented-item-margin});
&:focus-visible:not(:active) {
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
@include no-focus-ring;
background-color: var(--p-color-bg);
outline: var(--p-border-width-050) solid
var(--p-color-border-interactive-focus);
background-color: var(--p-color-bg-surface);
outline: var(--p-border-width-050) solid var(--p-color-border-focus);
}

&:visited {
Expand Down Expand Up @@ -83,13 +82,13 @@ $indented-item-width: calc(100% - #{$indented-item-margin});
}

&:hover {
background-color: var(--p-color-bg-critical-subdued-hover);
background-color: var(--p-color-bg-surface-critical-hover);
}

// stylelint-disable-next-line selector-max-class -- generated by polaris-migrator DO NOT COPY
&:active,
&.active {
background-color: var(--p-color-bg-critical-subdued-active);
background-color: var(--p-color-bg-surface-critical-active);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,29 @@
text-align: right;
// stylelint-disable-next-line selector-no-qualifying-type -- override `.iconOnly` negative margins
button[type='button'] {
background: var(--p-color-bg-strong);
background: var(--p-color-bg-fill-tertiary);
border-radius: var(--p-border-radius-200);
border: none;
box-shadow: none;
margin: 0;

// stylelint-disable-next-line selector-max-specificity -- apply active styles
&:active {
background: var(--p-color-bg-strong-active);
background: var(--p-color-bg-fill-tertiary-active);
}

// stylelint-disable-next-line selector-max-specificity -- apply focus styles
&:focus:not(:active) {
/* stylelint-disable-next-line polaris/border/polaris/at-rule-disallowed-list -- button overrides */
@include no-focus-ring;
outline: var(--p-border-width-050) solid
var(--p-color-border-interactive-focus);
outline: var(--p-border-width-050) solid var(--p-color-border-focus);
outline-offset: var(--p-space-050);
background: var(--p-color-bg-strong-active);
background: var(--p-color-bg-fill-tertiary-active);
}

// stylelint-disable-next-line selector-max-specificity -- apply hover styles
&:hover {
background: var(--p-color-bg-strong-hover);
background: var(--p-color-bg-fill-tertiary-hover);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,32 @@
button {
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
@include focus-ring($border-width: 1px);
background-color: var(--p-color-bg-strong) !important;
background-color: var(--p-color-bg-fill-tertiary) !important;
box-shadow: none !important;
border: none;
border-radius: var(--p-border-radius-200) !important;
padding: var(--p-space-100) var(--p-space-300);
min-height: 28px;

&:is(:hover, :focus) {
background-color: var(--p-color-bg-strong-hover) !important;
background-color: var(--p-color-bg-fill-tertiary-hover) !important;
}

&:active {
background-color: var(--p-color-bg-strong-active) !important;
background-color: var(--p-color-bg-fill-tertiary-active) !important;
box-shadow: var(--p-shadow-inset-200) !important;
}

&:focus-visible {
/* stylelint-disable-next-line polaris/border/polaris/at-rule-disallowed-list -- focus styles */
@include no-focus-ring;
outline: var(--p-border-width-050) solid
var(--p-color-border-interactive-focus);
outline: var(--p-border-width-050) solid var(--p-color-border-focus);
outline-offset: var(--p-space-050);
}

// stylelint-disable-next-line selector-no-qualifying-type -- apply disabled styles
&[aria-disabled='true'] {
background-color: var(
--p-color-bg-transparent-disabled-experimental
) !important;
background-color: var(--p-color-bg-fill-disabled) !important;
}

@media #{$p-breakpoints-md-up} {
Expand All @@ -53,7 +50,7 @@

// stylelint-disable-next-line selector-max-combinators, selector-max-type -- override svg fill
svg {
fill: var(--p-color-icon-critical-strong-experimental);
fill: var(--p-color-text-critical);
}

// stylelint-disable-next-line selector-max-specificity -- apply hover styles
Expand All @@ -63,7 +60,7 @@

// stylelint-disable-next-line selector-max-specificity -- apply focus/active styles
&:active {
background-color: var(--p-color-bg-strong-active) !important;
background-color: var(--p-color-bg-fill-tertiary-active) !important;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion polaris-react/src/components/AppProvider/AppProvider.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ body {
padding: 0;

// hardcoding background color because app provider does not have access to
// the --p-color-bg-app custom property. Will revisit best way to address in
// the --p-color-bg custom property. Will revisit best way to address in
// follow-up. PR convo for reference
// https://github.com/Shopify/polaris-react/pull/4636/files#r748646268
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
Expand Down
2 changes: 1 addition & 1 deletion polaris-react/src/components/AppProvider/AppProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export class AppProvider extends Component<AppProviderProps, State> {
}

setBodyStyles = () => {
document.body.style.backgroundColor = 'var(--p-color-bg-app)';
document.body.style.backgroundColor = 'var(--p-color-bg)';
document.body.style.color = 'var(--p-color-text)';
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
border-radius: var(--p-border-radius-200);

&:hover {
background-color: var(--p-color-bg-hover);
background-color: var(--p-color-bg-surface-hover);
text-decoration: none;

@media (-ms-high-contrast: active) {
Expand All @@ -63,7 +63,7 @@
}

&:active {
background-color: var(--p-color-bg-active);
background-color: var(--p-color-bg-surface-active);

svg {
fill: var(--p-color-icon-emphasis);
Expand Down
34 changes: 17 additions & 17 deletions polaris-react/src/components/Avatar/Avatar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
min-width: var(--pc-avatar-xs-size);
max-width: 100%;
background: var(--p-color-avatar-background-experimental);
color: var(--p-color-avatar-color-experimental);
background: var(--p-color-avatar-bg-fill);
color: var(--p-color-avatar-text-on-bg-fill);
user-select: none;

&.imageHasLoaded {
Expand Down Expand Up @@ -83,52 +83,52 @@
}

.styleOne {
background: var(--p-color-avatar-style-one-background-experimental);
color: var(--p-color-avatar-style-one-color-experimental);
background: var(--p-color-avatar-one-bg-fill);
color: var(--p-color-avatar-one-text-on-bg-fill);

svg,
text {
color: var(--p-color-avatar-style-one-color-experimental);
color: var(--p-color-avatar-one-text-on-bg-fill);
}
}

.styleTwo {
background: var(--p-color-avatar-style-two-background-experimental);
color: var(--p-color-avatar-style-two-color-experimental);
background: var(--p-color-avatar-two-bg-fill);
color: var(--p-color-avatar-two-text-on-bg-fill);

svg,
text {
color: var(--p-color-avatar-style-two-color-experimental);
color: var(--p-color-avatar-two-text-on-bg-fill);
}
}

.styleThree {
background: var(--p-color-avatar-style-three-background-experimental);
color: var(--p-color-avatar-style-three-color-experimental);
background: var(--p-color-avatar-three-bg-fill);
color: var(--p-color-avatar-three-text-on-bg-fill);

svg,
text {
color: var(--p-color-avatar-style-three-color-experimental);
color: var(--p-color-avatar-three-text-on-bg-fill);
}
}

.styleFour {
background: var(--p-color-avatar-style-four-background-experimental);
color: var(--p-color-avatar-style-four-color-experimental);
background: var(--p-color-avatar-four-bg-fill);
color: var(--p-color-avatar-four-text-on-bg-fill);

svg,
text {
color: var(--p-color-avatar-style-four-color-experimental);
color: var(--p-color-avatar-four-text-on-bg-fill);
}
}

.styleFive {
background: var(--p-color-avatar-style-five-background-experimental);
color: var(--p-color-avatar-style-five-color-experimental);
background: var(--p-color-avatar-five-bg-fill);
color: var(--p-color-avatar-five-text-on-bg-fill);

svg,
text {
color: var(--p-color-avatar-style-five-color-experimental);
color: var(--p-color-avatar-five-text-on-bg-fill);
}
}

Expand Down
36 changes: 18 additions & 18 deletions polaris-react/src/components/Badge/Badge.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
align-items: center;
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
padding: var(--pc-badge-vertical-padding) var(--pc-badge-horizontal-padding);
background-color: var(--p-color-bg-transparent-subdued-experimental);
background-color: var(--p-color-bg-fill-transparent-secondary);
border-radius: var(--p-border-radius-200);
color: var(--p-color-text-subdued);
color: var(--p-color-text-secondary);
font-weight: var(--p-font-weight-medium);

svg {
fill: var(--p-color-text-subdued);
fill: var(--p-color-text-secondary);
}

@media print {
Expand All @@ -24,7 +24,7 @@
}

.toneSuccess {
background-color: var(--p-color-bg-success);
background-color: var(--p-color-bg-fill-success-secondary);
color: var(--p-color-text-success);

svg {
Expand All @@ -34,15 +34,15 @@

.toneSuccess-strong {
color: var(--p-color-text-success-on-bg-fill);
background-color: var(--p-color-bg-success-strong);
background-color: var(--p-color-bg-fill-success);

svg {
fill: var(--p-color-text-success-on-bg-fill);
}
}

.toneInfo {
background-color: var(--p-color-bg-info);
background-color: var(--p-color-bg-fill-info-secondary);
color: var(--p-color-text-info);

svg {
Expand All @@ -52,15 +52,15 @@

.toneInfo-strong {
color: var(--p-color-text-info-on-bg-fill);
background-color: var(--p-color-bg-info-strong);
background-color: var(--p-color-bg-fill-info);

svg {
fill: var(--p-color-text-info-on-bg-fill);
}
}

.toneAttention {
background-color: var(--p-color-bg-caution);
background-color: var(--p-color-bg-fill-caution-secondary);
color: var(--p-color-text-caution);

svg {
Expand All @@ -70,16 +70,16 @@

.toneAttention-strong {
color: var(--p-color-text-caution-on-bg-fill);
background-color: var(--p-color-bg-caution-strong);
background-color: var(--p-color-bg-fill-caution);

svg {
fill: var(--p-color-text-caution-on-bg-fill);
}
}

.toneWarning {
background-color: var(--p-color-bg-warning);
color: var(--p-color-text-warning-experimental);
background-color: var(--p-color-bg-fill-warning-secondary);
color: var(--p-color-text-warning);

svg {
fill: var(--p-color-icon-warning);
Expand All @@ -88,15 +88,15 @@

.toneWarning-strong {
color: var(--p-color-text-warning-on-bg-fill);
background-color: var(--p-color-bg-warning-strong-experimental);
background-color: var(--p-color-bg-fill-warning);

svg {
fill: var(--p-color-text-warning-on-bg-fill);
}
}

.toneCritical {
background-color: var(--p-color-bg-critical);
background-color: var(--p-color-bg-fill-critical-secondary);
color: var(--p-color-text-critical);

svg {
Expand All @@ -106,7 +106,7 @@

.toneCritical-strong {
color: var(--p-color-text-critical-on-bg-fill);
background-color: var(--p-color-bg-critical-strong);
background-color: var(--p-color-bg-fill-critical);

svg {
fill: var(--p-color-text-critical-on-bg-fill);
Expand All @@ -115,18 +115,18 @@

.toneNew {
border: none;
background-color: var(--p-color-bg-transparent-subdued-experimental);
color: var(--p-color-text-subdued);
background-color: var(--p-color-bg-fill-transparent-secondary);
color: var(--p-color-text-secondary);
font-weight: var(--p-font-weight-bold);
border-radius: var(--p-border-radius-200);

svg {
fill: var(--p-color-text-subdued);
fill: var(--p-color-text-secondary);
}
}

.toneRead-only {
color: var(--p-color-text-subdued);
color: var(--p-color-text-secondary);
background-color: transparent;

svg {
Expand Down
4 changes: 2 additions & 2 deletions polaris-react/src/components/Badge/components/Pip/Pip.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.Pip {
// stylelint-disable -- Polaris component custom properties
--pc-pip-size: var(--p-space-200);
--pc-pip-color: var(--p-color-text-subdued);
--pc-pip-color: var(--p-color-text-secondary);
--pc-border-width: 1.25px;
// stylelint-enable
display: inline-block;
Expand Down Expand Up @@ -34,7 +34,7 @@

.toneNew {
// stylelint-disable-next-line -- Polaris component custom properties
--pc-pip-color: var(--p-color-text-subdued);
--pc-pip-color: var(--p-color-text-secondary);
}

.toneAttention {
Expand Down
Loading