Skip to content

Commit

Permalink
Merge latest next
Browse files Browse the repository at this point in the history
  • Loading branch information
sophschneider committed Sep 22, 2023
2 parents e516a74 + a5aa56a commit 327bbc8
Show file tree
Hide file tree
Showing 17 changed files with 42 additions and 115 deletions.
5 changes: 5 additions & 0 deletions .changeset/short-kids-buy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/polaris': major
---

Removed `polarisSummerEditions2023` feature flag from AppProvider context
8 changes: 1 addition & 7 deletions polaris-react/.storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,7 @@ function AppProviderDecorator(Story, context) {
if (context.args.omitAppProvider) return <Story {...context} />;

return (
<AppProvider
theme={context.globals.theme}
features={{
polarisSummerEditions2023: true,
}}
i18n={enTranslations}
>
<AppProvider theme={context.globals.theme} i18n={enTranslations}>
<FrameContext.Provider value={{}}>
<Story {...context} />
</FrameContext.Provider>
Expand Down
14 changes: 1 addition & 13 deletions polaris-react/src/components/AppProvider/AppProvider.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ export function Default(_, context) {
},
},
}}
features={{
polarisSummerEditions2023: true,
}}
>
<Page>
<LegacyCard>
Expand Down Expand Up @@ -97,9 +94,6 @@ export function WithI18n(_, context) {
},
},
}}
features={{
polarisSummerEditions2023: true,
}}
>
<Page>
<LegacyCard>
Expand Down Expand Up @@ -155,13 +149,7 @@ export function WithLinkComponent(_, context) {
};

return (
<AppProvider
linkComponent={CustomLinkComponent}
i18n={{}}
features={{
polarisSummerEditions2023: true,
}}
>
<AppProvider linkComponent={CustomLinkComponent} i18n={{}}>
<Page
backAction={{content: 'Products', url: '#'}}
title="Jar With Lock-Lid"
Expand Down
12 changes: 1 addition & 11 deletions polaris-react/src/components/AppProvider/AppProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,20 +149,10 @@ export class AppProvider extends Component<AppProviderProps, State> {
document.documentElement.classList.add(classNamePolarisSummerEditions2023);
};

getFeatures = () => {
const {features} = this.props;

return {
...features,
polarisSummerEditions2023: features?.polarisSummerEditions2023 ?? true,
};
};

getThemeName = (): ThemeName => this.props.theme ?? themeNameDefault;

render() {
const {children} = this.props;
const features = this.getFeatures();
const {children, features} = this.props;
const themeName = this.getThemeName();

const {intl, link} = this.state;
Expand Down
3 changes: 0 additions & 3 deletions polaris-react/src/components/Frame/Frame.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,6 @@ function InAnApplicationComponent() {
},
},
}}
features={{polarisSummerEditions2023: true}}
>
<Frame
logo={logo}
Expand Down Expand Up @@ -701,7 +700,6 @@ function WithAnOffsetComponent() {
},
},
}}
features={{polarisSummerEditions2023: true}}
>
<Frame
logo={logo}
Expand Down Expand Up @@ -1060,7 +1058,6 @@ function WithSidebarEnabled() {
},
},
}}
features={{polarisSummerEditions2023: true}}
>
<Frame
logo={logo}
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 @@ -108,7 +108,7 @@ $loading-panel-height: 53px;

// This is to bust specificity with .Table-scrolling and TableCell:first-child or TableCell:first-child + TableCell bg color above.
.TableRow-subdued {
// stylelint-disable-next-line selector-max-class, selector-max-combinators, selector-max-compound-selectors, selector-max-specificity -- generated by polaris-migrator DO NOT COPY
// stylelint-disable-next-line selector-max-class, selector-max-combinators, selector-max-specificity, selector-max-compound-selectors -- bg color overrides
.TableCell-first,
.TableCell-first + .TableCell {
background-color: var(--p-color-bg-subdued);
Expand Down Expand Up @@ -693,7 +693,7 @@ $loading-panel-height: 53px;
}
// This is to bust specificity with Table-unselectable and TableCel:first-child bg color above.
.TableRow-subdued:not(.TableRow-hovered) {
/* stylelint-disable-next-line selector-max-class, selector-max-combinators,selector-max-specificity -- generated by polaris-migrator DO NOT COPY */
// stylelint-disable-next-line selector-max-class, selector-max-combinators, selector-max-specificity -- bg color override
.TableCell:first-child {
background-color: var(--p-color-bg-subdued);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@ describe('<Pagination />', () => {
label="Hello, world!"
type="page"
/>,
{features: {polarisSummerEditions2023: false}},
);

expect(pagination).toContainReactComponent(ButtonGroup, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,6 @@ export function PolarisTestProvider({

const stickyManager = useMemo(() => new StickyManager(), []);

const featuresConfig = useMemo(
() => ({
polarisSummerEditions2023: true,
...features,
}),
[features],
);

const mergedFrame = createFrameContext(frame);

const mergedMediaQuery = merge(defaultMediaQuery, mediaQuery);
Expand All @@ -94,7 +86,7 @@ export function PolarisTestProvider({

return (
<Wrapper>
<FeaturesContext.Provider value={featuresConfig}>
<FeaturesContext.Provider value={features}>
<I18nContext.Provider value={intl}>
<ScrollLockManagerContext.Provider value={scrollLockManager}>
<StickyManagerContext.Provider value={stickyManager}>
Expand Down
2 changes: 2 additions & 0 deletions polaris-react/src/styles/_common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@
// tag+attribute selector.
// However, we're still supporting iOS 12 for embedded web views in some apps, which
// unfortunately doesn't support :where https://caniuse.com/?search=%3Awhere

// 🚨 WARNING: Refrain from using the `se23` flag, this will be deprecated post v12.
$se23: 'html[class~="Polaris-Summer-Editions-2023"]';
1 change: 0 additions & 1 deletion polaris-react/src/utilities/features/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export interface FeaturesConfig {
polarisSummerEditions2023?: boolean;
[key: string]: boolean | undefined;
}

Expand Down
11 changes: 2 additions & 9 deletions polaris-react/tests/utilities/react-testing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,9 @@ export const mountWithApp = createMount<
return options;
},
render(element, context) {
const {features, ...rest} = context;
const {...rest} = context;
return (
<PolarisTestProvider
i18n={translations}
features={{
polarisSummerEditions2023: true,
...features,
}}
{...rest}
>
<PolarisTestProvider i18n={translations} {...rest}>
{element}
</PolarisTestProvider>
);
Expand Down
4 changes: 2 additions & 2 deletions polaris.shopify.com/src/components/Lede/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import {forwardRef} from 'react';
import styles from './Lede.module.scss';
import {Box, type WithAsProp} from '../Box';

export const Lede = forwardRef(({as = 'p', className, ...props}, ref) => (
export const Lede = forwardRef(({as = 'div', className, ...props}, ref) => (
<Box
ref={ref}
as={as}
className={[styles.LedeParagraph, className]}
{...props}
/>
)) as WithAsProp<{}, typeof Box, 'p'>;
)) as WithAsProp<{}, typeof Box, 'div'>;

Lede.displayName = 'Lede';
4 changes: 2 additions & 2 deletions polaris.shopify.com/src/components/PropsTable/PropsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,10 @@ function TypeTable({
</p>
)}
{deprecationMessage && (
<p className={styles.DeprecationNotice}>
<div className={styles.DeprecationNotice}>
<StatusBadge status={StatusName.Deprecated} />{' '}
{endWithPeriod(deprecationMessage)}
</p>
</div>
)}
</div>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,37 +1,24 @@
.StatusBadge {
font-size: var(--p-font-size-75);
font-size: var(--font-size-100);
letter-spacing: 0;
font-weight: var(--p-font-weight-medium);
padding: var(--p-space-05) var(--p-space-2);
color: var(--p-color-text-subdued);
border-radius: var(--p-border-radius-2);
}
font-weight: var(--font-weight-400);
border-radius: var(--border-radius-round);
padding: 0.05rem 0.25rem;
color: var(--text);

.toneSuccess {
background-color: var(--p-color-bg-success);
color: var(--p-color-text-success);
}
&[data-value='alpha'] {
background: var(--surface-attention);
}

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

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

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

.toneCritical {
background-color: var(--p-color-bg-critical);
color: var(--p-color-text-critical);
}
&[data-value='warning'],
&[data-value='deprecated'],
&[data-value='legacy'] {
background: var(--surface-warning);
}

.toneNew {
background-color: var(--p-color-bg-transparent-subdued-experimental);
&[data-value='beta'],
&[data-value='information'],
&[data-value='new'] {
background: var(--surface-information);
}
}
23 changes: 4 additions & 19 deletions polaris.shopify.com/src/components/StatusBadge/StatusBadge.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,15 @@
import {Status} from '../../types';
import {className as classNames, variationName} from '../../utils/various';
import styles from './StatusBadge.module.scss';

interface Props {
status: Status;
}

type Tone = 'info' | 'success' | 'warning' | 'critical' | 'attention' | 'new';

const StatusToneMapping: {[S in Status]: Tone} = {
Alpha: 'info',
Beta: 'success',
Deprecated: 'critical',
Information: 'info',
Legacy: 'warning',
New: 'new',
Warning: 'warning',
};

function StatusBadge({status}: Props) {
const className = classNames(
styles.StatusBadge,
styles[variationName('tone', StatusToneMapping[status])],
return (
<div className={styles.StatusBadge} data-value={status.toLowerCase()}>
{status}
</div>
);

return <div className={className}>{status}</div>;
}

export default StatusBadge;
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const Preview = ({
return (
<Box className={[styles.ThumbnailPreview, className]}>
{src ? (
<Image alt={alt} src={src} fill style={{objectFit: 'contain'}} />
<Image alt={alt} src={src} fill style={{objectFit: 'cover'}} />
) : null}
</Box>
);
Expand Down
4 changes: 0 additions & 4 deletions polaris.shopify.com/src/utils/various.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ export const className = (...classNames: ClassName[]): string => {
.join(' ');
};

export const variationName = (name: string, value: string) => {
return `${name}${value.charAt(0).toUpperCase()}${value.slice(1)}`;
};

export const toPascalCase = (str: string): string =>
(str.match(/[a-zA-Z0-9]+/g) || [])
.map((w) => `${w.charAt(0).toUpperCase()}${w.slice(1)}`)
Expand Down

0 comments on commit 327bbc8

Please sign in to comment.