Skip to content

Commit 8b62db5

Browse files
chazdeanlaurkim
andauthored
[Typography foundations] Add deprecation warnings for existing Text components (#6605)
~~#### WARNING ⚠️~~ ~~https://polaris.shopify.com/components/text is not currently active~~ ~~Do Not Merge!~~ ### WHY are these changes introduced? Fixes #6537 <!-- link to issue if one exists --> <!-- Context about the problem that’s being addressed. --> ### WHAT is this pull request doing? Add deprecation warnings to all of the following existing Text components: - TextStyle - DisplayText - Heading - Subheading - Caption - VisuallyHidden | Text component | `console.log` | | --- | --- | | <img width="870" alt="Screen Shot 2022-07-12 at 10 12 53 AM" src="https://user-images.githubusercontent.com/59836805/178513139-742442e5-ccdc-4591-b0ad-b5ad0a19cbf0.png"> | <img width="633" alt="Screen Shot 2022-07-12 at 10 12 23 AM" src="https://user-images.githubusercontent.com/59836805/178513188-95c3db0e-0536-4de8-8396-fc36cf876818.png"> | Co-authored-by: Lo Kim <lo.kim@shopify.com>
1 parent a3710e2 commit 8b62db5

File tree

63 files changed

+223
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+223
-1
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/polaris': minor
3+
---
4+
5+
Deprecated `DisplayText`, `Heading`, `Subheading`, `Caption`, `TextStyle`, and `VisuallyHidden` components

polaris-react/playground/DetailsPage.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
import {
2020
ActionList,
2121
Badge,
22+
// eslint-disable-next-line import/no-deprecated
2223
Caption,
2324
Card,
2425
ContextualSaveBar,
@@ -41,6 +42,7 @@ import {
4142
Thumbnail,
4243
Toast,
4344
TopBar,
45+
// eslint-disable-next-line import/no-deprecated
4446
VisuallyHidden,
4547
} from '../src';
4648

polaris-react/src/components/AccountConnection/AccountConnection.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {Avatar} from '../Avatar';
55
import {buttonFrom} from '../Button';
66
import {Card} from '../Card';
77
import {Stack} from '../Stack';
8+
// eslint-disable-next-line import/no-deprecated
89
import {TextStyle} from '../TextStyle';
910
import {SettingAction} from '../SettingAction';
1011

polaris-react/src/components/ActionList/components/Item/Item.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {Scrollable} from '../../../Scrollable';
66
import {Icon} from '../../../Icon';
77
import {UnstyledLink} from '../../../UnstyledLink';
88
import {Badge} from '../../../Badge';
9+
// eslint-disable-next-line import/no-deprecated
910
import {TextStyle} from '../../../TextStyle';
1011
import styles from '../../ActionList.scss';
1112
import {handleMouseUpByBlurring} from '../../../../utilities/focus';

polaris-react/src/components/ActionList/components/Item/tests/Item.test.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22
import {mountWithApp} from 'tests/utilities';
33

44
import {Item} from '../Item';
5+
// eslint-disable-next-line import/no-deprecated
56
import {TextStyle} from '../../../../TextStyle';
67
import {UnstyledLink} from '../../../../UnstyledLink';
78

@@ -54,6 +55,7 @@ describe('<Item />', () => {
5455
it('renders helpText when the helpText prop is defined', () => {
5556
const helpText = 'Foo';
5657
const item = mountWithApp(<Item helpText={helpText} />);
58+
// eslint-disable-next-line import/no-deprecated
5759
expect(item.find(TextStyle)).toContainReactText(helpText);
5860
});
5961

polaris-react/src/components/Autocomplete/components/MappedAction/MappedAction.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {classNames} from '../../../../utilities/css';
66
import {MappedActionContext} from '../../../../utilities/autocomplete';
77
import {Listbox} from '../../../Listbox';
88
import {Icon} from '../../../Icon';
9+
// eslint-disable-next-line import/no-deprecated
910
import {TextStyle} from '../../../TextStyle';
1011
import {useI18n} from '../../../../utilities/i18n';
1112

polaris-react/src/components/Badge/Badge.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import React, {useContext} from 'react';
33
import {classNames, variationName} from '../../utilities/css';
44
import {useI18n} from '../../utilities/i18n';
55
import {WithinFilterContext} from '../../utilities/within-filter-context';
6+
// eslint-disable-next-line import/no-deprecated
67
import {VisuallyHidden} from '../VisuallyHidden';
78
import {Icon} from '../Icon';
89
import type {IconSource} from '../../types';

polaris-react/src/components/Badge/components/Pip/Pip.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22

33
import {classNames, variationName} from '../../../../utilities/css';
44
import type {Progress, Status} from '../../types';
5+
// eslint-disable-next-line import/no-deprecated
56
import {VisuallyHidden} from '../../../VisuallyHidden';
67
import {useI18n} from '../../../../utilities/i18n';
78
import {getDefaultAccessibilityLabel} from '../../utils';

polaris-react/src/components/Badge/tests/Badge.test.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22
import {mountWithApp} from 'tests/utilities';
33
import {GlobeMinor} from '@shopify/polaris-icons';
44

5+
// eslint-disable-next-line import/no-deprecated
56
import {VisuallyHidden} from '../../VisuallyHidden';
67
import {Icon} from '../../Icon';
78
import {Badge} from '../Badge';
@@ -14,11 +15,13 @@ describe('<Badge />', () => {
1415

1516
it('accepts a status prop and renders a visually hidden label', () => {
1617
const badge = mountWithApp(<Badge status="success" />);
18+
// eslint-disable-next-line import/no-deprecated
1719
expect(badge).toContainReactComponent(VisuallyHidden);
1820
});
1921

2022
it('accepts a progress prop and renders a visually hidden label', () => {
2123
const badge = mountWithApp(<Badge progress="incomplete" />);
24+
// eslint-disable-next-line import/no-deprecated
2225
expect(badge).toContainReactComponent(VisuallyHidden);
2326
});
2427

@@ -27,6 +30,7 @@ describe('<Badge />', () => {
2730
<Badge progress="incomplete" status="attention" />,
2831
);
2932

33+
// eslint-disable-next-line import/no-deprecated
3034
expect(badge).toContainReactComponentTimes(VisuallyHidden, 1, {
3135
children: 'Attention Incomplete',
3236
});
@@ -87,6 +91,7 @@ describe('<Badge />', () => {
8791
/>,
8892
);
8993

94+
// eslint-disable-next-line import/no-deprecated
9095
expect(badge).toContainReactComponent(VisuallyHidden, {
9196
children: mockAccessibilityLabel,
9297
});
@@ -102,6 +107,7 @@ describe('<Badge />', () => {
102107
/>,
103108
);
104109

110+
// eslint-disable-next-line import/no-deprecated
105111
expect(badge).not.toContainReactComponent(VisuallyHidden, {
106112
children: 'Attention Incomplete',
107113
});
@@ -112,24 +118,28 @@ describe('<Badge />', () => {
112118
<Badge status="attention" progress="incomplete" />,
113119
);
114120

121+
// eslint-disable-next-line import/no-deprecated
115122
expect(badge).toContainReactComponent(VisuallyHidden, {
116123
children: 'Attention Incomplete',
117124
});
118125

119126
badge = mountWithApp(<Badge progress="incomplete" />);
120127

128+
// eslint-disable-next-line import/no-deprecated
121129
expect(badge).toContainReactComponent(VisuallyHidden, {
122130
children: 'Incomplete',
123131
});
124132

125133
badge = mountWithApp(<Badge status="attention" />);
126134

135+
// eslint-disable-next-line import/no-deprecated
127136
expect(badge).toContainReactComponent(VisuallyHidden, {
128137
children: 'Attention',
129138
});
130139

131140
badge = mountWithApp(<Badge />);
132141

142+
// eslint-disable-next-line import/no-deprecated
133143
expect(badge).not.toContainReactComponent(VisuallyHidden);
134144
});
135145
});
@@ -140,24 +150,28 @@ describe('<Badge.Pip />', () => {
140150
<Badge.Pip status="attention" progress="incomplete" />,
141151
);
142152

153+
// eslint-disable-next-line import/no-deprecated
143154
expect(badge).toContainReactComponent(VisuallyHidden, {
144155
children: 'Attention Incomplete',
145156
});
146157

147158
badge = mountWithApp(<Badge.Pip progress="partiallyComplete" />);
148159

160+
// eslint-disable-next-line import/no-deprecated
149161
expect(badge).toContainReactComponent(VisuallyHidden, {
150162
children: 'Partially complete',
151163
});
152164

153165
badge = mountWithApp(<Badge.Pip status="attention" />);
154166

167+
// eslint-disable-next-line import/no-deprecated
155168
expect(badge).toContainReactComponent(VisuallyHidden, {
156169
children: 'Attention Complete',
157170
});
158171

159172
badge = mountWithApp(<Badge.Pip />);
160173

174+
// eslint-disable-next-line import/no-deprecated
161175
expect(badge).toContainReactComponent(VisuallyHidden, {
162176
children: 'Complete',
163177
});

polaris-react/src/components/Banner/Banner.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {useUniqueId} from '../../utilities/unique-id';
1919
import {useI18n} from '../../utilities/i18n';
2020
import type {Action, DisableableAction, LoadableAction} from '../../types';
2121
import {Button} from '../Button';
22+
// eslint-disable-next-line import/no-deprecated
2223
import {Heading} from '../Heading';
2324
import {ButtonGroup} from '../ButtonGroup';
2425
import {UnstyledButton, unstyledButtonFrom} from '../UnstyledButton';

0 commit comments

Comments
 (0)