Skip to content

Commit 4aa22c3

Browse files
mperrottipksjce
authored andcommitted
Remove styled-system usage - TextInputWrapper and related (#6666)
1 parent e32d52a commit 4aa22c3

File tree

19 files changed

+154
-159
lines changed

19 files changed

+154
-159
lines changed

.changeset/gold-dingos-sneeze.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@primer/react': major
3+
---
4+
5+
Removes styled-system usage from TextInputWrapper and related components and Storybook stories.

e2e/components/TextInput.test.ts

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -219,24 +219,6 @@ test.describe('TextInput', () => {
219219
}
220220
})
221221

222-
test.describe('Dev: With Sx', () => {
223-
for (const theme of themes) {
224-
test.describe(theme, () => {
225-
test('default @vrt', async ({page}) => {
226-
await visit(page, {
227-
id: 'components-textinput-dev--with-sx',
228-
globals: {
229-
colorScheme: theme,
230-
},
231-
})
232-
233-
// Default state
234-
expect(await page.screenshot()).toMatchSnapshot(`TextInput.Dev.WithSx.${theme}.png`)
235-
})
236-
})
237-
}
238-
})
239-
240222
test.describe('Dev: With CSS', () => {
241223
for (const theme of themes) {
242224
test.describe(theme, () => {
@@ -254,22 +236,4 @@ test.describe('TextInput', () => {
254236
})
255237
}
256238
})
257-
258-
test.describe('Dev: With Sx and CSS', () => {
259-
for (const theme of themes) {
260-
test.describe(theme, () => {
261-
test('default @vrt', async ({page}) => {
262-
await visit(page, {
263-
id: 'components-textinput-dev--with-sx-and-css',
264-
globals: {
265-
colorScheme: theme,
266-
},
267-
})
268-
269-
// Default state
270-
expect(await page.screenshot()).toMatchSnapshot(`TextInput.Dev.WithSxAndCSS.${theme}.png`)
271-
})
272-
})
273-
}
274-
})
275239
})
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.EditableTextInput {
2+
min-width: 120px;
3+
max-width: 180px;
4+
font-size: inherit;
5+
border: var(--borderWidth-thin) dashed var(--borderColor-muted);
6+
}
7+
8+
.EditableTextInput:focus {
9+
border: var(--borderWidth-thin) solid var(--borderColor-accent-emphasis);
10+
}

packages/react/src/Breadcrumbs/Breadcrumbs.dev.stories.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {useState} from 'react'
22
import Breadcrumbs from '.'
33
import TextInput from '../TextInput'
4+
import classes from './Breadcrumbs.dev.stories.module.css'
45

56
export default {
67
title: 'Components/Breadcrumbs/Dev',
@@ -146,15 +147,7 @@ export const WithEditableNameInput = () => (
146147
<TextInput
147148
defaultValue="Untitled Document"
148149
size="small"
149-
sx={{
150-
minWidth: '120px',
151-
maxWidth: '180px',
152-
fontSize: 'inherit',
153-
border: '1px dashed var(--borderColor-muted)',
154-
'&:focus': {
155-
border: '1px solid var(--borderColor-accent-emphasis)',
156-
},
157-
}}
150+
className={classes.EditableTextInput}
158151
aria-label="Edit document name"
159152
/>
160153
</Breadcrumbs.Item>

packages/react/src/Overlay/Overlay.features.stories.module.css

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,24 @@
5858
padding: var(--base-size-12);
5959
}
6060

61+
.TextInputWithMargin {
62+
margin-bottom: var(--base-size-8);
63+
}
64+
65+
.IssueTitleInput {
66+
width: 100%;
67+
padding: var(--base-size-2) var(--base-size-8);
68+
text-align: left;
69+
color: var(--fgColor-default);
70+
}
71+
72+
.IssueTitleInput input {
73+
font-weight: var(--base-text-weight-semibold);
74+
font-size: var(--text-title-size-medium);
75+
padding-left: 0;
76+
padding-right: 0;
77+
}
78+
6179
.IssueEditorContainer {
6280
padding: var(--base-size-24);
6381
height: 100vh;

packages/react/src/Overlay/Overlay.features.stories.tsx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
ActionList,
1717
ActionMenu,
1818
useFocusTrap,
19+
Textarea,
1920
} from '..'
2021
import {Tooltip} from '../TooltipV2'
2122
import classes from './Overlay.features.stories.module.css'
@@ -386,8 +387,8 @@ export const NestedOverlays = ({role, open}: Args) => {
386387
<Text color="fg.muted" sx={{fontSize: 1, mb: 3}}>
387388
Create a list to organize your starred repositories.
388389
</Text>
389-
<TextInput placeholder="Name this list" sx={{mb: 2}} />
390-
<TextInput as="textarea" placeholder="Write a description" rows={3} sx={{mb: 2, textarea: {p: 2}}} />
390+
<TextInput placeholder="Name this list" className={classes.TextInputWithMargin} />
391+
<Textarea placeholder="Write a description" rows={3} className={classes.TextInputWithMargin} />
391392

392393
<Button variant="primary" onClick={() => setCreateListOverlayOpen(!createListOverlayOpen)}>
393394
Create
@@ -481,14 +482,7 @@ export const MemexIssueOverlay = ({role, open}: Args) => {
481482
}
482483
}}
483484
ref={inputRef}
484-
sx={{
485-
width: '100%',
486-
py: '2px',
487-
px: '7px',
488-
textAlign: 'left',
489-
color: 'fg.default',
490-
input: {fontWeight: 'bold', fontSize: 4, px: 0},
491-
}}
485+
className={classes.IssueTitleInput}
492486
/>
493487
) : (
494488
<Button

packages/react/src/SelectPanel/SelectPanel.module.css

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@
5252
color: var(--fgColor-muted);
5353
}
5454

55+
.FilterInputWrapper {
56+
margin: var(--base-size-8);
57+
width: auto;
58+
}
59+
5560
.Notice {
5661
margin-top: var(--base-size-4);
5762
margin-right: var(--base-size-8);
@@ -230,7 +235,3 @@
230235
inset: 0;
231236
background-color: var(--overlay-backdrop-bgColor);
232237
}
233-
234-
.TextInput {
235-
margin: var(--base-size-8);
236-
}

packages/react/src/SelectPanel/SelectPanel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ function Panel({
648648

649649
const extendedTextInputProps: Partial<TextInputProps> = useMemo(() => {
650650
return {
651-
className: classes.TextInput,
651+
className: classes.FilterInputWrapper,
652652
contrast: true,
653653
leadingVisual: SearchIcon,
654654
'aria-label': inputLabel,

packages/react/src/TextInput/TextInput.dev.stories.tsx

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,3 @@ export const WithCSS = () => (
1818
</FormControl>
1919
</form>
2020
)
21-
22-
export const WithSx = () => (
23-
<form>
24-
<FormControl>
25-
<FormControl.Label>Default label</FormControl.Label>
26-
<TextInput sx={{borderColor: 'red'}} />
27-
</FormControl>
28-
</form>
29-
)
30-
31-
export const WithSxAndCSS = () => (
32-
<form>
33-
<FormControl>
34-
<FormControl.Label>Default label</FormControl.Label>
35-
<TextInput sx={{borderColor: 'red'}} className="testCustomClassnameBorderColor" />
36-
</FormControl>
37-
</form>
38-
)

packages/react/src/TextInput/TextInput.docs.json

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -140,27 +140,6 @@
140140
"deprecated": true,
141141
"description": "(Use size) Creates a smaller or larger input than the default."
142142
},
143-
{
144-
"name": "width",
145-
"type": "string | number | Array<string | number>",
146-
"defaultValue": "",
147-
"deprecated": true,
148-
"description": "(Use sx prop) Set the width of the input"
149-
},
150-
{
151-
"name": "maxWidth",
152-
"type": "string | number | Array<string | number>",
153-
"defaultValue": "",
154-
"deprecated": true,
155-
"description": "(Use sx prop) Set the maximum width of the input"
156-
},
157-
{
158-
"name": "minWidth",
159-
"type": "string | number | Array<string | number>",
160-
"defaultValue": "",
161-
"deprecated": true,
162-
"description": "(Use sx prop) Set the minimum width of the input"
163-
},
164143
{
165144
"name": "icon",
166145
"type": "React.ComponentType",
@@ -228,4 +207,4 @@
228207
}
229208
}
230209
]
231-
}
210+
}

0 commit comments

Comments
 (0)