Skip to content

Commit 36a4922

Browse files
authored
Removing all unused components from @primer/styled-react (#7806)
1 parent 6889235 commit 36a4922

35 files changed

Lines changed: 15 additions & 1488 deletions
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@primer/styled-react": patch
3+
---
4+
5+
Removing `ActionList, Box, Button, Dialog, Flash, FormControl, Header, Heading, IconButton, Label, Link, LinkButton, SegmentedControl, Spinner, Text, TextInput, ToggleSwitch, UnderlineNav, DialogV1, Octicon, TabNav` from the @primer/styled-react package

e2e/styled-react/components/Button.test.ts

Lines changed: 0 additions & 21 deletions
This file was deleted.

packages/styled-react/package.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,6 @@
77
"types": "./dist/index.d.ts",
88
"default": "./dist/index.js"
99
},
10-
"./deprecated": {
11-
"types": "./dist/deprecated.d.ts",
12-
"default": "./dist/deprecated.js"
13-
},
14-
"./experimental": {
15-
"types": "./dist/experimental.d.ts",
16-
"default": "./dist/experimental.js"
17-
},
1810
"./components.json": "./dist/components.json"
1911
},
2012
"files": [

packages/styled-react/rollup.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function createPackageRegex(name) {
1616
}
1717

1818
export default defineConfig({
19-
input: ['src/index.tsx', 'src/experimental.tsx', 'src/deprecated.tsx'],
19+
input: ['src/index.tsx'],
2020
external: dependencies.map(createPackageRegex),
2121
plugins: [
2222
typescript({

packages/styled-react/script/generate-components-json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ async function generateComponentsJson() {
1414
const types = new Set()
1515
const utilities = new Set()
1616

17-
const entrypoints = ['src/index.tsx', 'src/deprecated.tsx', 'src/experimental.tsx']
17+
const entrypoints = ['src/index.tsx']
1818

1919
for (const entrypoint of entrypoints) {
2020
const filename = path.join(PACKAGE_ROOT, entrypoint)

packages/styled-react/src/__tests__/Box.browser.test.tsx

Lines changed: 0 additions & 131 deletions
This file was deleted.

packages/styled-react/src/__tests__/ThemeProvider.browser.test.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ import {render, screen, waitFor} from '@testing-library/react'
22
import userEvent from '@testing-library/user-event'
33
import {describe, expect, it, vi} from 'vitest'
44
import React from 'react'
5-
import {ThemeProvider, useColorSchemeVar, useTheme, Box} from '../'
5+
import styled from 'styled-components'
6+
import {color, space} from 'styled-system'
7+
import type {ColorProps, SpaceProps} from 'styled-system'
8+
import {ThemeProvider, useColorSchemeVar, useTheme} from '../'
9+
10+
const Box = styled.div<ColorProps & SpaceProps>(color, space)
611

712
// window.matchMedia() is not implemented by JSDOM so we have to create a mock:
813
// https://vijs.io/docs/manual-mocks#mocking-methods-which-are-not-implemented-in-jsdom

packages/styled-react/src/__tests__/__snapshots__/ThemeProvider.browser.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
exports[`has default theme 1`] = `
44
<div
5-
class="sc-aXZVg hPmBIl"
5+
class="sc-aXZVg iOsRUA"
66
color="fg.default"
77
>
88
Hello

packages/styled-react/src/__tests__/__snapshots__/exports.test.ts.snap

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,13 @@
22

33
exports[`@primer/styled-react exports 1`] = `
44
[
5-
"ActionList",
65
"BaseStyles",
7-
"Box",
8-
"Button",
9-
"Dialog",
10-
"Flash",
11-
"Heading",
12-
"IconButton",
13-
"Label",
14-
"Link",
156
"merge",
16-
"Spinner",
177
"sx",
18-
"Text",
19-
"TextInput",
208
"theme",
219
"themeGet",
2210
"ThemeProvider",
23-
"ToggleSwitch",
24-
"UnderlineNav",
2511
"useColorSchemeVar",
2612
"useTheme",
2713
]
2814
`;
29-
30-
exports[`@primer/styled-react/deprecated exports 1`] = `
31-
[
32-
"ActionList",
33-
"Dialog",
34-
"Octicon",
35-
]
36-
`;
37-
38-
exports[`@primer/styled-react/experimental exports 1`] = `
39-
[
40-
"Dialog",
41-
]
42-
`;

packages/styled-react/src/__tests__/deprecated-exports.test.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@ import path from 'node:path'
44

55
const entrypoints: Array<
66
[name: string, filepath: string, exports: Array<[name: string, deprecatedTag: boolean, deprecatedComment: boolean]>]
7-
> = [
8-
['@primer/styled-react', path.resolve(import.meta.dirname, '../index.tsx'), []],
9-
['@primer/styled-react/deprecated', path.resolve(import.meta.dirname, '../deprecated.tsx'), []],
10-
['@primer/styled-react/experimental', path.resolve(import.meta.dirname, '../experimental.tsx'), []],
11-
]
7+
> = [['@primer/styled-react', path.resolve(import.meta.dirname, '../index.tsx'), []]]
128

139
const program = ts.createProgram(
1410
entrypoints.map(entrypoint => entrypoint[1]),

0 commit comments

Comments
 (0)