Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] Improve support for extended props in theme #25934

Merged
merged 35 commits into from
Apr 26, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
d8b4ffe
Support custom sizes for ToggleButton ToggleButtonGroup Table and Aut…
vicasas Apr 24, 2021
4f1e80c
Add support custom color Slider
vicasas Apr 24, 2021
617802e
fix leaky types
oliviertassinari Apr 24, 2021
ff5c61d
Add support custom color and size Pagination
vicasas Apr 24, 2021
7e1e15e
Fix framer Slider
vicasas Apr 24, 2021
7f1fa8b
Fix framer Slider
vicasas Apr 24, 2021
de467cc
Fix types
vicasas Apr 24, 2021
be00d65
Add support custom color and size PaginationItem
vicasas Apr 24, 2021
a5c3bef
Add support custom color and size Fab
vicasas Apr 24, 2021
ceac217
Add support custom color and size SvgIcon
vicasas Apr 24, 2021
5c15f10
Add support custom color and size Icon
vicasas Apr 24, 2021
25d0a27
Add support custom color and size Chip
vicasas Apr 24, 2021
bc5db41
Add support custom color and size Checkbox
vicasas Apr 25, 2021
507cdb3
Fix framer
vicasas Apr 25, 2021
20a901a
Fix framer
vicasas Apr 25, 2021
c08b395
Fix framer
vicasas Apr 25, 2021
e01c219
Fix framer
vicasas Apr 25, 2021
6ace85a
Revert "Add support custom color and size Checkbox"
vicasas Apr 25, 2021
f4f39c0
Add support custom color and size InputBase
vicasas Apr 25, 2021
0833d0c
Add support custom color and size OutlinedInput
vicasas Apr 25, 2021
d74cc58
Add support custom color and size FilledInput
vicasas Apr 25, 2021
aa8c65c
Add support custom color Input
vicasas Apr 25, 2021
c47f730
Add support custom color and size Switch
vicasas Apr 25, 2021
df75463
Fix framer
vicasas Apr 25, 2021
8c8ef43
yarn workspace framer build
oliviertassinari Apr 25, 2021
33d80d0
it doesn't matter
oliviertassinari Apr 25, 2021
2efb6a5
fix build
oliviertassinari Apr 25, 2021
5dd2e64
Revert "Revert "Add support custom color and size Checkbox""
vicasas Apr 25, 2021
523a20a
Fix framer Checkbox
vicasas Apr 25, 2021
a480ffe
Fix framer
vicasas Apr 25, 2021
c1734af
yarn prettier
vicasas Apr 25, 2021
1c07ec0
Add support custom color and size Radio
vicasas Apr 25, 2021
531c304
Merge branch 'next' into feature/support-custom-part2
mnajdova Apr 26, 2021
5b2757b
Update packages/material-ui/src/Table/Table.d.ts
mnajdova Apr 26, 2021
fedb770
fix wrong padding value
mnajdova Apr 26, 2021
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
5 changes: 4 additions & 1 deletion docs/pages/api-docs/autocomplete.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@
"renderTags": { "type": { "name": "func" } },
"selectOnFocus": { "type": { "name": "bool" }, "default": "!props.freeSolo" },
"size": {
"type": { "name": "enum", "description": "'medium'<br>&#124;&nbsp;'small'" },
"type": {
"name": "union",
"description": "'medium'<br>&#124;&nbsp;'small'<br>&#124;&nbsp;string"
},
"default": "'medium'"
},
"sx": { "type": { "name": "object" } },
Expand Down
5 changes: 4 additions & 1 deletion docs/pages/api-docs/slider.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
"aria-valuetext": { "type": { "name": "custom", "description": "string" } },
"classes": { "type": { "name": "object" } },
"color": {
"type": { "name": "enum", "description": "'primary'<br>&#124;&nbsp;'secondary'" },
"type": {
"name": "union",
"description": "'primary'<br>&#124;&nbsp;'secondary'<br>&#124;&nbsp;string"
},
"default": "'primary'"
},
"component": { "type": { "name": "elementType" } },
Expand Down
5 changes: 4 additions & 1 deletion docs/pages/api-docs/table.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
"default": "'default'"
},
"size": {
"type": { "name": "enum", "description": "'medium'<br>&#124;&nbsp;'small'" },
"type": {
"name": "union",
"description": "'medium'<br>&#124;&nbsp;'small'<br>&#124;&nbsp;string"
},
"default": "'medium'"
},
"stickyHeader": { "type": { "name": "bool" } },
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/api-docs/toggle-button-group.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
},
"size": {
"type": {
"name": "enum",
"description": "'large'<br>&#124;&nbsp;'medium'<br>&#124;&nbsp;'small'"
"name": "union",
"description": "'large'<br>&#124;&nbsp;'medium'<br>&#124;&nbsp;'small'<br>&#124;&nbsp;string"
},
"default": "'medium'"
},
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/api-docs/toggle-button.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"selected": { "type": { "name": "bool" } },
"size": {
"type": {
"name": "enum",
"description": "'large'<br>&#124;&nbsp;'medium'<br>&#124;&nbsp;'small'"
"name": "union",
"description": "'large'<br>&#124;&nbsp;'medium'<br>&#124;&nbsp;'small'<br>&#124;&nbsp;string"
},
"default": "'medium'"
},
Expand Down
5 changes: 4 additions & 1 deletion packages/material-ui/src/Autocomplete/Autocomplete.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { InternalStandardProps as StandardProps, Theme } from '@material-ui/core
import { ChipProps, ChipTypeMap } from '@material-ui/core/Chip';
import { PopperProps } from '@material-ui/core/Popper';
import { SxProps } from '@material-ui/system';
import { OverridableStringUnion } from '@material-ui/types';
import useAutocomplete, {
AutocompleteChangeDetails,
AutocompleteChangeReason,
Expand Down Expand Up @@ -59,6 +60,8 @@ export interface AutocompleteRenderInputParams {
inputProps: ReturnType<ReturnType<typeof useAutocomplete>['getInputProps']>;
}

export interface AutocompletePropsSizeOverrides {}

export interface AutocompleteProps<
T,
Multiple extends boolean | undefined,
Expand Down Expand Up @@ -266,7 +269,7 @@ export interface AutocompleteProps<
* The size of the component.
* @default 'medium'
*/
size?: 'small' | 'medium';
size?: OverridableStringUnion<'small' | 'medium', AutocompletePropsSizeOverrides>;
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
Expand Down
5 changes: 4 additions & 1 deletion packages/material-ui/src/Autocomplete/Autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -1046,7 +1046,10 @@ Autocomplete.propTypes /* remove-proptypes */ = {
* The size of the component.
* @default 'medium'
*/
size: PropTypes.oneOf(['medium', 'small']),
size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([
PropTypes.oneOf(['medium', 'small']),
PropTypes.string,
]),
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
Expand Down
5 changes: 4 additions & 1 deletion packages/material-ui/src/Slider/Slider.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ import {
SliderUnstyledTypeMap,
} from '@material-ui/unstyled/SliderUnstyled';
import { SxProps } from '@material-ui/system';
import { OverridableStringUnion } from '@material-ui/types';
import { Theme } from '../styles';
import { OverrideProps } from '../OverridableComponent';

export interface SliderPropsColorOverrides {}

export type SliderTypeMap<
D extends React.ElementType = 'span',
P = {}
Expand All @@ -17,7 +20,7 @@ export type SliderTypeMap<
* The color of the component. It supports those theme colors that make sense for this component.
* @default 'primary'
*/
color?: 'primary' | 'secondary';
color?: OverridableStringUnion<'primary' | 'secondary', SliderPropsColorOverrides>;
/**
* Override or extend the styles applied to the component.
*/
Expand Down
5 changes: 4 additions & 1 deletion packages/material-ui/src/Slider/Slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,10 @@ Slider.propTypes /* remove-proptypes */ = {
* The color of the component. It supports those theme colors that make sense for this component.
* @default 'primary'
*/
color: PropTypes.oneOf(['primary', 'secondary']),
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([
PropTypes.oneOf(['primary', 'secondary']),
PropTypes.string,
]),
/**
* The components used for each slot inside the Slider.
* Either a string to use a HTML element or a component.
Expand Down
5 changes: 4 additions & 1 deletion packages/material-ui/src/Table/Table.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import * as React from 'react';
import { SxProps } from '@material-ui/system';
import { OverridableStringUnion } from '@material-ui/types';
import { Theme } from '..';
import { OverridableComponent, OverrideProps } from '../OverridableComponent';

export type Padding = 'default' | 'checkbox' | 'none';

export type Size = 'small' | 'medium';

export interface TablePropsSizeOverrides {}

export interface TableTypeMap<P = {}, D extends React.ElementType = 'table'> {
props: P & {
/**
Expand All @@ -31,7 +34,7 @@ export interface TableTypeMap<P = {}, D extends React.ElementType = 'table'> {
* Allows TableCells to inherit size of the Table.
* @default 'medium'
*/
size?: Size;
size?: OverridableStringUnion<Size, TablePropsSizeOverrides>;
/**
* Set the header sticky.
*
Expand Down
5 changes: 4 additions & 1 deletion packages/material-ui/src/Table/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,10 @@ Table.propTypes /* remove-proptypes */ = {
* Allows TableCells to inherit size of the Table.
* @default 'medium'
*/
size: PropTypes.oneOf(['medium', 'small']),
size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([
PropTypes.oneOf(['medium', 'small']),
PropTypes.string,
]),
/**
* Set the header sticky.
*
Expand Down
5 changes: 4 additions & 1 deletion packages/material-ui/src/ToggleButton/ToggleButton.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { SxProps } from '@material-ui/system';
import { OverridableStringUnion } from '@material-ui/types';
import { Theme } from '..';
import { ExtendButtonBase, ExtendButtonBaseTypeMap } from '../ButtonBase';
import { OverrideProps } from '../OverridableComponent';

export interface ToggleButtonPropsSizeOverrides {}

export type ToggleButtonTypeMap<
P = {},
D extends React.ElementType = 'button'
Expand Down Expand Up @@ -66,7 +69,7 @@ export type ToggleButtonTypeMap<
* The prop defaults to the value inherited from the parent ToggleButtonGroup component.
* @default 'medium'
*/
size?: 'small' | 'medium' | 'large';
size?: OverridableStringUnion<'small' | 'medium' | 'large', ToggleButtonPropsSizeOverrides>;
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
Expand Down
5 changes: 4 additions & 1 deletion packages/material-ui/src/ToggleButton/ToggleButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,10 @@ ToggleButton.propTypes /* remove-proptypes */ = {
* The prop defaults to the value inherited from the parent ToggleButtonGroup component.
* @default 'medium'
*/
size: PropTypes.oneOf(['large', 'medium', 'small']),
size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([
PropTypes.oneOf(['large', 'medium', 'small']),
PropTypes.string,
]),
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import * as React from 'react';
import { SxProps } from '@material-ui/system';
import { OverridableStringUnion } from '@material-ui/types';
import { InternalStandardProps as StandardProps } from '..';
import { Theme } from '../styles';

export interface ToggleButtonGroupPropsSizeOverrides {}

export interface ToggleButtonGroupProps
extends StandardProps<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'children'> {
/**
Expand Down Expand Up @@ -57,7 +60,7 @@ export interface ToggleButtonGroupProps
* The size of the component.
* @default 'medium'
*/
size?: 'small' | 'medium' | 'large';
size?: OverridableStringUnion<'small' | 'medium' | 'large', ToggleButtonGroupPropsSizeOverrides>;
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,10 @@ ToggleButtonGroup.propTypes /* remove-proptypes */ = {
* The size of the component.
* @default 'medium'
*/
size: PropTypes.oneOf(['large', 'medium', 'small']),
size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([
PropTypes.oneOf(['large', 'medium', 'small']),
PropTypes.string,
]),
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
Expand Down