Skip to content

Commit 664ad79

Browse files
authored
refactor!: remove theme defaultProp (#1905)
1 parent 89af13b commit 664ad79

File tree

308 files changed

+281
-1952
lines changed

Some content is hidden

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

308 files changed

+281
-1952
lines changed

docs/migration.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,11 @@ consider additional positioning prop support on a case-by-case basis.
180180
scheme to custom components that are not part of the Garden framework. It is
181181
recommended to utilize this stopgap measure until such components can be updated
182182
to leverage the full capabilities of v9 `getColor`.
183-
- The `focusVisibleRef` prop (and the resulting scoping `<div>`) has been
184-
removed from `<ThemeProvider>`. Current browser support obviates the need for a
183+
- Removed the `theme` default prop from all components. Garden components must
184+
be nested within `<ThemeProvider>` to receive the `theme` object and
185+
render successfully.
186+
- Removed `focusVisibleRef` prop (and the resulting scoping `<div>`) from
187+
`<ThemeProvider>`. Current browser support obviates the need for a
185188
`:focus-visible` polyfill.
186189
- Removed `message` and `connect` values from `PALETTE.product`
187190
- Utility function `getColor` has been refactored with a signature that supports

eslint.config.mjs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import noticePlugin from '@zendeskgarden/eslint-config/plugins/notice.js';
1111
import reactPlugin from '@zendeskgarden/eslint-config/plugins/react.js';
1212
import typescriptPlugin from '@zendeskgarden/eslint-config/plugins/typescript.js';
1313
import jestPlugin from '@zendeskgarden/eslint-config/plugins/jest.js';
14-
import gardenLocalPlugin from 'eslint-plugin-garden-local';
1514

1615
const typescriptRules = {
1716
...typescriptPlugin.rules,
@@ -46,16 +45,6 @@ export default [
4645
...typescriptRules
4746
}
4847
},
49-
{
50-
files: ['packages/*/src/**/*.{ts,tsx}'],
51-
ignores: ['packages/.template/**/*.{ts,tsx}', 'packages/*/src/**/*.spec.{ts,tsx}'],
52-
plugins: {
53-
'garden-local': gardenLocalPlugin
54-
},
55-
rules: {
56-
'garden-local/require-default-theme': 'error'
57-
}
58-
},
5948
{
6049
files: ['packages/*/src/**/*.spec.{ts,tsx}'],
6150
ignores: ['packages/.template/**/*.spec.{ts,tsx}'],

package-lock.json

Lines changed: 1 addition & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@
7373
"envalid": "8.0.0",
7474
"eslint": "9.9.0",
7575
"eslint-config-prettier": "9.1.0",
76-
"eslint-plugin-garden-local": "file:./utils/eslint",
7776
"execa": "9.3.1",
7877
"husky": "9.1.5",
7978
"identity-obj-proxy": "3.0.0",

packages/accordions/src/styled/accordion/StyledAccordion.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
import styled from 'styled-components';
9-
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9+
import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
1010

1111
const COMPONENT_ID = 'accordions.accordion';
1212

@@ -16,7 +16,3 @@ export const StyledAccordion = styled.div.attrs({
1616
})`
1717
${props => retrieveComponentStyles(COMPONENT_ID, props)};
1818
`;
19-
20-
StyledAccordion.defaultProps = {
21-
theme: DEFAULT_THEME
22-
};

packages/accordions/src/styled/accordion/StyledButton.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,7 @@
66
*/
77

88
import styled, { css, ThemeProps, DefaultTheme } from 'styled-components';
9-
import {
10-
getLineHeight,
11-
retrieveComponentStyles,
12-
DEFAULT_THEME,
13-
getColor
14-
} from '@zendeskgarden/react-theming';
9+
import { getLineHeight, retrieveComponentStyles, getColor } from '@zendeskgarden/react-theming';
1510

1611
export const COMPONENT_ID = 'accordions.button';
1712

@@ -79,7 +74,3 @@ export const StyledButton = styled.button.attrs<IStyledButton>({
7974
8075
${props => retrieveComponentStyles(COMPONENT_ID, props)};
8176
`;
82-
83-
StyledButton.defaultProps = {
84-
theme: DEFAULT_THEME
85-
};

packages/accordions/src/styled/accordion/StyledHeader.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
import styled from 'styled-components';
9-
import { retrieveComponentStyles, DEFAULT_THEME, focusStyles } from '@zendeskgarden/react-theming';
9+
import { retrieveComponentStyles, focusStyles } from '@zendeskgarden/react-theming';
1010
import { StyledButton } from './StyledButton';
1111

1212
const COMPONENT_ID = 'accordions.header';
@@ -38,7 +38,3 @@ export const StyledHeader = styled.div.attrs<IStyledHeader>({
3838
3939
${props => retrieveComponentStyles(COMPONENT_ID, props)};
4040
`;
41-
42-
StyledHeader.defaultProps = {
43-
theme: DEFAULT_THEME
44-
};

packages/accordions/src/styled/accordion/StyledInnerPanel.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
import styled from 'styled-components';
9-
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9+
import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
1010
import { StyledPanel } from './StyledPanel';
1111

1212
const COMPONENT_ID = 'accordions.step_inner_panel';
@@ -34,7 +34,3 @@ export const StyledInnerPanel = styled.div.attrs({
3434
3535
${props => retrieveComponentStyles(COMPONENT_ID, props)};
3636
`;
37-
38-
StyledInnerPanel.defaultProps = {
39-
theme: DEFAULT_THEME
40-
};

packages/accordions/src/styled/accordion/StyledRotateIcon.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,7 @@
66
*/
77

88
import styled, { css, ThemeProps, DefaultTheme } from 'styled-components';
9-
import {
10-
retrieveComponentStyles,
11-
DEFAULT_THEME,
12-
StyledBaseIcon,
13-
getColor
14-
} from '@zendeskgarden/react-theming';
9+
import { retrieveComponentStyles, StyledBaseIcon, getColor } from '@zendeskgarden/react-theming';
1510

1611
const COMPONENT_ID = 'accordions.rotate_icon';
1712

@@ -65,7 +60,3 @@ export const StyledRotateIcon = styled(StyledBaseIcon).attrs({
6560
6661
${props => retrieveComponentStyles(COMPONENT_ID, props)};
6762
`;
68-
69-
StyledRotateIcon.defaultProps = {
70-
theme: DEFAULT_THEME
71-
};

packages/accordions/src/styled/accordion/StyledSection.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
import styled from 'styled-components';
9-
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9+
import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
1010
import { StyledPanel } from './StyledPanel';
1111

1212
const COMPONENT_ID = 'accordions.section';
@@ -21,7 +21,3 @@ export const StyledSection = styled.div.attrs({
2121
2222
${props => retrieveComponentStyles(COMPONENT_ID, props)};
2323
`;
24-
25-
StyledSection.defaultProps = {
26-
theme: DEFAULT_THEME
27-
};

0 commit comments

Comments
 (0)