Skip to content

Commit

Permalink
Migrate depth custom properties from v10 to v11 (#8601)
Browse files Browse the repository at this point in the history
### WHY are these changes introduced?

Part of #8405 

### WHAT is this pull request doing?

Runs the
[`v11-styles-replace-custom-property-depth`](#8272)
from `@shopify/polaris-migrator` to migrate `depth` custom properties
from `v10` to `v11`. e.g.

```sh
cd polaris-react
npx @shopify/[email protected] v11-styles-replace-custom-property-depth './src/**/*.scss'
npx prettier --write "./src/**/*.scss"
yarn lint:styles
```
<hr>

🚨 Note: This PR will not merge until:
- [x] Shopify/web#85942 is ready to merge (so
that we can release these changes in both polaris and web at the same
time)
- [x] #8604 is merged since one of the migrations in this PR will need
to access it
  • Loading branch information
lgriffee authored Mar 16, 2023
1 parent 443898f commit 243fd62
Show file tree
Hide file tree
Showing 27 changed files with 41 additions and 35 deletions.
6 changes: 6 additions & 0 deletions .changeset/strange-socks-fry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@shopify/polaris': minor
'polaris.shopify.com': minor
---

Migrate `depth` custom properties from Polaris `v10` to `v11`
2 changes: 1 addition & 1 deletion polaris-react/src/components/AlphaCard/AlphaCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const AlphaCard = ({
<Box
background={background}
padding={padding}
shadow="card"
shadow="md"
borderRadius={hasBorderRadius ? defaultBorderRadius : undefined}
>
{children}
Expand Down
4 changes: 2 additions & 2 deletions polaris-react/src/components/Box/Box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type {
ColorsOverlayTokenAlias,
ColorsSurfaceTokenAlias,
ShapeBorderWidthScale,
DepthShadowAlias,
ShadowAlias,
SpacingSpaceScale,
} from '@shopify/polaris-tokens';

Expand Down Expand Up @@ -155,7 +155,7 @@ export interface BoxProps extends React.AriaAttributes {
'status' | 'presentation' | 'menu' | 'listbox' | 'combobox'
>;
/** Shadow on box */
shadow?: DepthShadowAlias;
shadow?: ShadowAlias;
/** Set tab order */
tabIndex?: Extract<React.AllHTMLAttributes<HTMLElement>['tabIndex'], number>;
/** Width of container */
Expand Down
2 changes: 1 addition & 1 deletion polaris-react/src/components/BulkActions/BulkActions.scss
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ $bulk-actions-button-stacking-order: (
padding: var(--p-space-4);
background: var(--p-surface);
border-radius: var(--p-border-radius-2);
box-shadow: var(--p-shadow-deep), var(--p-shadow-popover);
box-shadow: var(--p-shadow-md), var(--p-shadow-xl);
max-width: 100%;
pointer-events: auto;

Expand Down
10 changes: 5 additions & 5 deletions polaris-react/src/components/Button/Button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
background: var(--pc-button-color);
border-width: 0;
border-color: transparent;
box-shadow: var(--p-shadow-button), var(--p-shadows-inset-button);
box-shadow: var(--p-shadow-sm);
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
color: var(--pc-button-text);

Expand All @@ -169,14 +169,14 @@

&:focus {
border-color: transparent;
box-shadow: var(--p-shadow-button), var(--p-shadows-inset-button);
box-shadow: var(--p-shadow-sm);
}

&:active {
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
background: var(--pc-button-color-active);
border-color: transparent;
box-shadow: var(--p-shadow-button), var(--p-shadows-inset-button);
box-shadow: var(--p-shadow-sm);
}

&.pressed {
Expand All @@ -185,13 +185,13 @@
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
background: var(--pc-button-color-depressed);
border-color: transparent;
box-shadow: var(--p-shadow-button), var(--p-shadows-inset-button);
box-shadow: var(--p-shadow-sm);

&:hover,
&:focus {
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
background: var(--pc-button-color-depressed);
box-shadow: var(--p-shadow-button), var(--p-shadows-inset-button);
box-shadow: var(--p-shadow-sm);
}
}

Expand Down
2 changes: 1 addition & 1 deletion polaris-react/src/components/Card/Card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

.Card {
background-color: var(--p-surface);
box-shadow: var(--p-shadow-card);
box-shadow: var(--p-shadow-md);
outline: var(--p-border-width-1) solid transparent;

+ .Card {
Expand Down
2 changes: 1 addition & 1 deletion polaris-react/src/components/DataTable/DataTable.scss
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@
.StickyHeaderInner-isSticky {
visibility: visible;
background-color: var(--p-surface);
box-shadow: var(--p-shadow-base);
box-shadow: var(--p-shadow-md);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ $Backdrop-opacity: 0.88;
background: var(--p-surface-dark);
color: var(--p-text-on-interactive);
margin-bottom: var(--p-space-5);
box-shadow: var(--p-shadow-popover);
box-shadow: var(--p-shadow-xl);

@media #{$p-breakpoints-sm-up} {
padding: var(--p-space-3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
position: relative;
display: flex;
height: $top-bar-height;
box-shadow: var(--p-shadow-top-bar);
box-shadow: var(--p-shadow-sm);
background-color: var(--p-surface);
}

Expand Down
4 changes: 2 additions & 2 deletions polaris-react/src/components/IndexTable/IndexTable.scss
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ $loading-panel-height: 53px;
align-items: center;
background: var(--p-surface);
padding: var(--p-space-2) var(--p-space-4);
box-shadow: var(--p-shadow-base);
box-shadow: var(--p-shadow-md);

.LoadingPanelRow {
display: flex;
Expand Down Expand Up @@ -560,7 +560,7 @@ $loading-panel-height: 53px;
.StickyTableHeader-isSticky {
visibility: visible;
background-color: var(--p-surface);
box-shadow: var(--p-shadow-base);
box-shadow: var(--p-shadow-md);
}

.IndexTable:hover {
Expand Down
2 changes: 1 addition & 1 deletion polaris-react/src/components/LegacyCard/LegacyCard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

.LegacyCard {
background-color: var(--p-surface);
box-shadow: var(--p-shadow-card);
box-shadow: var(--p-shadow-md);
outline: var(--p-border-width-1) solid transparent;

+ .LegacyCard {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ $large-width: 980px;
width: 100%;
max-height: calc(100vh - #{$vertical-spacing});
background: var(--p-surface);
box-shadow: var(--p-shadow-modal);
box-shadow: var(--p-shadow-2xl);

@media (forced-colors: active) {
border: var(--p-border-width-1) solid transparent;
Expand Down
2 changes: 1 addition & 1 deletion polaris-react/src/components/Navigation/Navigation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ $nav-max-width: 360px;
height: $top-bar-height;
padding: 0 var(--p-space-2) 0 var(--p-space-4);
background-color: var(--p-surface);
box-shadow: var(--p-shadow-top-bar);
box-shadow: var(--p-shadow-sm);
margin-bottom: var(--p-space-4);

// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
Expand Down
2 changes: 1 addition & 1 deletion polaris-react/src/components/Popover/Popover.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ $vertical-motion-offset: -5px;
.Popover {
max-width: calc(100vw - var(--p-space-8));
margin: $visible-portion-of-arrow var(--p-space-2) var(--p-space-4);
box-shadow: var(--p-shadow-popover);
box-shadow: var(--p-shadow-xl);
border-radius: var(--p-border-radius-2);
will-change: left, top;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ $range-output-size: 32px;
min-width: $range-output-size;
height: $range-output-size;
background-color: var(--p-surface);
box-shadow: var(--p-shadow-popover);
box-shadow: var(--p-shadow-xl);
border-radius: var(--p-border-radius-1);
transition-property: transform;
transition-duration: var(--p-duration-150);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ $range-output-translate-x: calc(
.OutputBubble {
position: relative;
display: flex;
box-shadow: var(--p-shadow-popover);
box-shadow: var(--p-shadow-xl);
padding: 0 var(--p-space-2);
min-width: $range-output-size;
height: $range-output-size;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ $item-wrapper-loading-height: 64px;
}

.HeaderWrapper-isSticky {
box-shadow: var(--p-shadow-base);
box-shadow: var(--p-shadow-md);
}

.HeaderContentWrapper {
Expand Down
2 changes: 1 addition & 1 deletion polaris-react/src/components/Select/Select.scss
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
border: var(--p-border-width-1) solid var(--p-border-shadow);
border-radius: var(--p-border-radius-1);
background-color: var(--p-surface);
box-shadow: var(--p-shadow-button);
box-shadow: var(--p-shadow-sm);
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
@include focus-ring($border-width: 1px);
// stylelint-disable-next-line order/properties-order -- 'position' needs to sit below focus-ring since it will be overwritten with relative when the focus ring style is 'base'
Expand Down
2 changes: 1 addition & 1 deletion polaris-react/src/components/Sheet/Sheet.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ $sheet-desktop-width: 380px;
width: 100%;
height: 100%;
background-color: var(--p-surface);
box-shadow: var(--p-shadow-modal);
box-shadow: var(--p-shadow-2xl);

@media screen and (-ms-high-contrast: active) {
border-left: var(--p-border-base);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
margin: var(--pc-tooltip-overlay-offset) var(--p-space-4) var(--p-space-4);
opacity: 1;
box-shadow: var(--p-shadow-popover), var(--p-shadow-lg);
box-shadow: var(--p-shadow-xl), var(--p-shadow-lg);
// stylelint-disable-next-line -- Polaris component custom properties
border-radius: var(--pc-tooltip-border-radius);
pointer-events: none;
Expand Down
2 changes: 1 addition & 1 deletion polaris-react/src/components/TopBar/TopBar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ $icon-size: 20px;
position: relative;
display: flex;
height: $top-bar-height;
box-shadow: var(--p-shadow-top-bar);
box-shadow: var(--p-shadow-sm);
background-color: var(--p-surface);
transition: var(--p-duration-200) background-color var(--p-ease-in-out);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
top: $top-bar-height;
left: 0;
right: 0;
box-shadow: var(--p-shadow-modal);
box-shadow: var(--p-shadow-2xl);
overflow: hidden;

@media #{$p-breakpoints-sm-up} {
Expand Down
8 changes: 4 additions & 4 deletions polaris-react/src/styles/shared/_buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
margin: 0;
padding: $vertical-padding var(--p-space-4);
background: var(--p-surface);
box-shadow: var(--p-shadow-button);
box-shadow: var(--p-shadow-sm);
border-radius: var(--p-border-radius-1);
color: var(--p-text);
border: var(--p-border-width-1) solid var(--p-border-neutral-subdued);
Expand All @@ -37,15 +37,15 @@
}

&:focus-visible {
box-shadow: var(--p-shadow-button);
box-shadow: var(--p-shadow-sm);
outline: 0;
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
@include focus-ring($style: 'focused');
}

&:active {
background: var(--p-action-secondary-pressed);
box-shadow: var(--p-shadow-button);
box-shadow: var(--p-shadow-sm);

&::after {
border: none;
Expand All @@ -55,7 +55,7 @@

&.pressed {
background: var(--p-action-secondary-depressed);
box-shadow: var(--p-shadows-inset-button-pressed);
box-shadow: var(--p-shadow-inset-md);
color: var(--p-text-on-primary);
border-color: var(--p-border-depressed);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ examples:
- fileName: alpha-card-default.tsx
title: Default
description: >-
By default, cards have an 8px border radius and uses `--p-surface` as the background and `--p-shadow-card` as the shadow. There is padding of `space-5` (20px) around children and `space-4` (16px) for small screens.
By default, cards have an 8px border radius and uses `--p-surface` as the background and `--p-shadow-md` as the shadow. There is padding of `space-5` (20px) around children and `space-4` (16px) for small screens.
- fileName: alpha-card-with-subdued-background.tsx
title: With subdued background
description: >-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ examples:
- fileName: box-with-shadow.tsx
title: Shadow
description: >-
Shadow can be applied using the [Depth tokens](https://polaris.shopify.com/tokens/depth).
Shadow can be applied using the [Shadow tokens](https://polaris.shopify.com/tokens/shadow).
---

## Related components
Expand Down
2 changes: 1 addition & 1 deletion polaris.shopify.com/pages/examples/box-with-shadow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {withPolarisExample} from '../../src/components/PolarisExampleWrapper';

function BoxWithShadowExample() {
return (
<Box shadow="base">
<Box shadow="md">
<Placeholder label="Content inside a box" />
</Box>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.Banner {
border-radius: var(--border-radius-700);
background-color: var(--surface-subdued);
box-shadow: var(--p-shadow-card);
box-shadow: var(--p-shadow-md);
display: flex;
align-items: center;
gap: var(--p-space-6);
Expand Down

0 comments on commit 243fd62

Please sign in to comment.