Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
6d346e7
Replace typography components with new Text component
sam-b-rose Oct 25, 2022
ac6c400
Fix tests with replaced Text components
sam-b-rose Oct 25, 2022
7f3c51b
Add changeset
sam-b-rose Oct 25, 2022
e4b093d
Update polaris-react/src/components/Badge/tests/Badge.test.tsx
laurkim Oct 26, 2022
30d969f
Revert "Replace typography components with new Text component"
sam-b-rose Oct 28, 2022
0b1555d
Replace typography components with new Text component
sam-b-rose Oct 28, 2022
6325a53
Fix EmptyState typography tests
sam-b-rose Oct 28, 2022
866f1c9
Revert "Replace typography components with new Text component"
laurkim Oct 28, 2022
208ccfe
Replace typography components with new Text component
laurkim Oct 28, 2022
951cdd3
Fix variant mapping for Card.Header and Card.Section tests
laurkim Oct 28, 2022
316b1bd
Revert changes to Caption and DisplayText tests
laurkim Oct 28, 2022
4f9025a
Update references to `text-style-body` mixin with Text bodyMd variant
laurkim Oct 31, 2022
534fbfa
Update DropZone/Tabs tests
laurkim Oct 31, 2022
7267520
Remove unused mixins
laurkim Oct 31, 2022
5c426ce
Update references to `text-style-body` mixin
laurkim Oct 31, 2022
8dcde61
Update references to `text-style-caption` mixin
laurkim Oct 31, 2022
acc0dc2
[Text] Add support for `text-inverse` type for `color` prop
laurkim Oct 31, 2022
689d4d7
Update changeset
laurkim Oct 31, 2022
7958f56
Update references to `text-style-heading` mixin
laurkim Oct 31, 2022
b30b2dd
Update references to `text-style-subheading` mixin
laurkim Nov 1, 2022
95a9a3f
Update references to `text-emphasis-subdued` mixin
laurkim Nov 1, 2022
fc87762
Update references to `text-emphasis-strong` mixin
laurkim Nov 1, 2022
be5e701
Update Avatar stories with examples for initials and different sizes
laurkim Nov 1, 2022
06a5646
Add manual UI updates to `ActionList`
laurkim Nov 1, 2022
0fb7db5
Add manual UI updates to `Card`
laurkim Nov 1, 2022
3af820e
Add manual UI updates to `Toast`
laurkim Nov 1, 2022
9b51fce
Add manual UI updates to `DescriptionList`
laurkim Nov 1, 2022
6d7a9f0
Add manual UI updates to `Select` and `TextField`
laurkim Nov 1, 2022
b528de7
Update references to `text-style-button` mixin
laurkim Nov 1, 2022
e973039
Update references to `text-style-button-large` mixin
laurkim Nov 1, 2022
52fbc12
Add manual UI updates to `OptionList`
laurkim Nov 1, 2022
3a1df3f
Update references to `nav-item-text-attributes` mixin
laurkim Nov 2, 2022
76ebb11
Add manual UI updates to `Page`
laurkim Nov 2, 2022
dd69c56
Add manual UI updates to `Badge`
laurkim Nov 2, 2022
534cb08
Update changeset with breaking change on `Badge`
laurkim Nov 2, 2022
f0e758a
Add back support for `size` on `Badge` to hold off on next major release
laurkim Nov 2, 2022
8c046ac
Fix padding around actions in `ActionList`
laurkim Nov 2, 2022
2836b3b
Adjust spacing on sections and actions in `ActionList`
laurkim Nov 2, 2022
a8a3b3e
Fix lint failure on `ActionList`
laurkim Nov 2, 2022
28bcf09
Remove bottom border on `ActionList` section without title
laurkim Nov 2, 2022
dfd1f40
Update Card custom react node story to use Text component
laurkim Nov 2, 2022
2611432
Update FullscreenBar story to use Text component
laurkim Nov 2, 2022
ab9bba1
Update Popover searchable listbox story to use Text component
laurkim Nov 2, 2022
066a030
Update reference to `text-style-input` mixin in `FooterHelp`
laurkim Nov 2, 2022
203538f
Update changeset
laurkim Nov 2, 2022
0c228a2
Update conditional color on `Text` in `Filters`
laurkim Nov 2, 2022
88f3bee
Deprecate `size` prop on `Badge`
laurkim Nov 2, 2022
02d07b2
Update ternary logic for `Box borderBlockStart` in `OptionList`
laurkim Nov 2, 2022
725b03a
Update `DualThumb` class to use `first-child` selector
laurkim Nov 2, 2022
074e846
Fix formatting for Text props in `Filters`
laurkim Nov 2, 2022
c97bb81
Update `SingleThumb` class to use `first-child` selector
laurkim Nov 2, 2022
ce058fa
Remove test styles from `Select`
laurkim Nov 2, 2022
69c5c8e
Merge branch 'main' into replace-typography-components-with-text
alex-page Nov 2, 2022
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
7 changes: 7 additions & 0 deletions .changeset/calm-wasps-cough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@shopify/polaris': patch
---

Replaced all typography components with the new `Text` component.
Added support for `text-inverse` color type on `Text`.
Removed references to the following mixins to use the new `Text` or tokens directly in classes: `text-style-body`, `text-style-heading`, `text-style-subheading`, `text-style-caption`, `text-style-button`, `text-style-button-large`, `text-emphasis-subdued`, `text-emphasis-strong`, `nav-item-text-attributes`.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {Avatar} from '../Avatar';
import {buttonFrom} from '../Button';
import {Card} from '../Card';
import {Stack} from '../Stack';
import {TextStyle} from '../TextStyle';
import {Text} from '../Text';
import {SettingAction} from '../SettingAction';

import styles from './AccountConnection.scss';
Expand Down Expand Up @@ -61,7 +61,9 @@ export function AccountConnection({

const detailsMarkup = details ? (
<div>
<TextStyle variation="subdued">{details}</TextStyle>
<Text variant="bodyMd" color="subdued" as="span">
{details}
</Text>
</div>
) : null;

Expand Down
18 changes: 12 additions & 6 deletions polaris-react/src/components/ActionList/ActionList.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
outline: none;
list-style: none;
margin: 0;
border-top: var(--p-border-divider);
border-bottom: var(--p-border-divider);
padding: var(--p-space-2);
}

Expand All @@ -24,16 +24,22 @@
// stylelint-disable-next-line selector-max-class, selector-max-combinators, selector-max-specificity
> .Section-withoutTitle .Actions {
border-top: none;
border-bottom: none;
}
}

.Title {
@include text-style-subheading;
padding: var(--p-space-3) var(--p-space-4) var(--p-space-3) var(--p-space-4);
.ActionList .Section {
// stylelint-disable-next-line selector-max-class, selector-max-combinators
.Actions {
padding-top: 0;
}
}

.Section:not(:first-child) .Title {
padding-top: var(--p-space-1);
.ActionList .Section:last-child {
// stylelint-disable-next-line selector-max-class, selector-max-combinators, selector-max-specificity
.Actions {
border-bottom: none;
}
}

.Item {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {Scrollable} from '../../../Scrollable';
import {Icon} from '../../../Icon';
import {UnstyledLink} from '../../../UnstyledLink';
import {Badge} from '../../../Badge';
import {TextStyle} from '../../../TextStyle';
import {Text} from '../../../Text';
import styles from '../../ActionList.scss';
import {handleMouseUpByBlurring} from '../../../../utilities/focus';

Expand Down Expand Up @@ -63,7 +63,9 @@ export function Item({
const contentMarkup = helpText ? (
<span className={styles.ContentBlock}>
<span className={styles.ContentBlockInner}>{contentText}</span>
<TextStyle variation="subdued">{helpText}</TextStyle>
<Text variant="bodyMd" color="subdued" as="span">
{helpText}
</Text>
</span>
) : (
contentText
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import {mountWithApp} from 'tests/utilities';

import {Item} from '../Item';
import {TextStyle} from '../../../../TextStyle';
import {Text} from '../../../../Text';
import {UnstyledLink} from '../../../../UnstyledLink';

describe('<Item />', () => {
Expand Down Expand Up @@ -54,7 +54,7 @@ describe('<Item />', () => {
it('renders helpText when the helpText prop is defined', () => {
const helpText = 'Foo';
const item = mountWithApp(<Item helpText={helpText} />);
expect(item.find(TextStyle)).toContainReactText(helpText);
expect(item.find(Text)).toContainReactText(helpText);
});

it('passes `accessibilityLabel` to `<button />`', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React from 'react';

import {Item} from '../Item';
import {Box} from '../../../Box';
import {Text} from '../../../Text';
import type {
ActionListItemDescriptor,
ActionListSection,
Expand Down Expand Up @@ -56,7 +58,16 @@ export function Section({
const className = section.title ? undefined : styles['Section-withoutTitle'];

const titleMarkup = section.title ? (
<p className={styles.Title}>{section.title}</p>
<Box
paddingBlockStart="4"
paddingInlineStart="4"
paddingBlockEnd="2"
paddingInlineEnd="4"
>
<Text as="p" variant="headingXs">
{section.title}
</Text>
</Box>
) : null;

let sectionRole;
Expand Down
8 changes: 7 additions & 1 deletion polaris-react/src/components/AppProvider/AppProvider.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@

html,
body {
@include text-style-body;
font-size: var(--p-font-size-100);
line-height: var(--p-font-line-height-2);
font-weight: var(--p-font-weight-regular);

text-transform: initial;
letter-spacing: initial;

@include text-emphasis-normal;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {classNames} from '../../../../utilities/css';
import {MappedActionContext} from '../../../../utilities/autocomplete';
import {Listbox} from '../../../Listbox';
import {Icon} from '../../../Icon';
import {TextStyle} from '../../../TextStyle';
import {Text} from '../../../Text';
import {useI18n} from '../../../../utilities/i18n';

import styles from './MappedAction.scss';
Expand Down Expand Up @@ -75,7 +75,11 @@ export function MappedAction({
const contentMarkup = (
<div className={styles.Text}>
<div className={contentOverflowStyle}>{contentText}</div>
{helpText ? <TextStyle variation="subdued">{helpText}</TextStyle> : null}
{helpText ? (
<Text variant="bodyMd" color="subdued" as="span">
{helpText}
</Text>
) : null}
</div>
);

Expand Down
76 changes: 67 additions & 9 deletions polaris-react/src/components/Avatar/Avatar.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ export function ExtraSmall() {
);
}

export function Square() {
return <Avatar name="Shop One" shape="square" />;
}

export function ExternalImage() {
return (
<Avatar
Expand All @@ -55,20 +51,82 @@ export function ExternalImage() {
);
}

export function Square() {
return <Avatar name="Shop One" shape="square" />;
}

export function SquareWithInitials() {
return (
<Stack vertical>
<Stack.Item>
<Avatar
shape="square"
initials="OE"
name="Oluwayemisi Eun-Jung"
size="extraSmall"
/>
</Stack.Item>
<Stack.Item>
<Avatar
shape="square"
initials="OE"
name="Oluwayemisi Eun-Jung"
size="small"
/>
</Stack.Item>
<Stack.Item>
<Avatar
shape="square"
initials="OE"
name="Oluwayemisi Eun-Jung"
size="medium"
/>
</Stack.Item>
<Stack.Item>
<Avatar
shape="square"
initials="OE"
name="Oluwayemisi Eun-Jung"
size="large"
/>
</Stack.Item>
</Stack>
);
}

export function Sizes() {
return (
<Stack>
<Stack vertical>
<Stack.Item>
<Avatar name="Farrah" size="extraSmall" />
</Stack.Item>
<Stack.Item>
<Avatar name="Farrah" size="small" />
</Stack.Item>
<Stack.Item>
<Avatar name="Farrah" size="medium" />
</Stack.Item>
<Stack.Item>
<Avatar name="Farrah" size="large" />
</Stack.Item>
</Stack>
);
}

export function SizesWithInitials() {
return (
<Stack vertical>
<Stack.Item>
<Avatar customer name="Farrah" size="extraSmall" />
<Avatar initials="OE" name="Oluwayemisi Eun-Jung" size="extraSmall" />
</Stack.Item>
<Stack.Item>
<Avatar customer name="Farrah" size="small" />
<Avatar initials="OE" name="Oluwayemisi Eun-Jung" size="small" />
</Stack.Item>
<Stack.Item>
<Avatar customer name="Farrah" size="medium" />
<Avatar initials="OE" name="Oluwayemisi Eun-Jung" size="medium" />
</Stack.Item>
<Stack.Item>
<Avatar customer name="Farrah" size="large" />
<Avatar initials="OE" name="Oluwayemisi Eun-Jung" size="large" />
</Stack.Item>
</Stack>
);
Expand Down
8 changes: 0 additions & 8 deletions polaris-react/src/components/Badge/Badge.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,12 @@
padding: var(--pc-badge-vertical-padding) var(--pc-badge-horizontal-padding);
background-color: var(--p-surface-neutral);
border-radius: var(--p-border-radius-5);
font-size: 13px;
line-height: var(--p-font-line-height-1);
color: var(--p-text);
font-weight: var(--p-font-weight-regular);

@media print {
border: solid var(--p-border-width-1) var(--p-border);
}
}

.sizeSmall {
font-size: var(--p-font-size-75);
}

.statusSuccess {
background-color: var(--p-surface-success);
color: var(--p-text);
Expand Down
14 changes: 11 additions & 3 deletions polaris-react/src/components/Badge/Badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, {useContext} from 'react';
import {classNames, variationName} from '../../utilities/css';
import {useI18n} from '../../utilities/i18n';
import {WithinFilterContext} from '../../utilities/within-filter-context';
import {VisuallyHidden} from '../VisuallyHidden';
import {Text} from '../Text';
import {Icon} from '../Icon';
import type {IconSource} from '../../types';

Expand All @@ -23,6 +23,7 @@ interface NonMutuallyExclusiveProps {
/** Icon to display to the left of the badge’s content. */
icon?: IconSource;
/**
* @deprecated
* Medium or small size.
* @default 'medium'
*/
Expand Down Expand Up @@ -52,6 +53,7 @@ export function Badge({
styles.Badge,
status && styles[variationName('status', status)],
icon && styles.icon,
// TODO: remove support for the size prop in the next major release
size && size !== DEFAULT_SIZE && styles[variationName('size', size)],
withinFilter && styles.withinFilter,
);
Expand All @@ -61,7 +63,9 @@ export function Badge({
: getDefaultAccessibilityLabel(i18n, progress, status);

let accessibilityMarkup = Boolean(accessibilityLabel) && (
<VisuallyHidden>{accessibilityLabel}</VisuallyHidden>
<Text variant="bodySm" as="span" visuallyHidden>
{accessibilityLabel}
</Text>
);

if (progress && !icon) {
Expand All @@ -84,7 +88,11 @@ export function Badge({
<Icon source={icon} />
</span>
)}
{children && <span>{children}</span>}
{children && (
<Text as="span" variant="bodySm">
{children}
</Text>
)}
</span>
);
}
Expand Down
6 changes: 4 additions & 2 deletions polaris-react/src/components/Badge/components/Pip/Pip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';

import {classNames, variationName} from '../../../../utilities/css';
import type {Progress, Status} from '../../types';
import {VisuallyHidden} from '../../../VisuallyHidden';
import {Text} from '../../../Text';
import {useI18n} from '../../../../utilities/i18n';
import {getDefaultAccessibilityLabel} from '../../utils';

Expand Down Expand Up @@ -32,7 +32,9 @@ export function Pip({

return (
<span className={className}>
<VisuallyHidden>{accessibilityLabel}</VisuallyHidden>
<Text variant="bodySm" as="span" visuallyHidden>
{accessibilityLabel}
</Text>
</span>
);
}
Loading