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

[Switch] Migrate to emotion #24693

Merged
merged 12 commits into from
Feb 18, 2021
4 changes: 3 additions & 1 deletion docs/pages/api-docs/switch.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"type": { "name": "enum", "description": "'medium'<br>&#124;&nbsp;'small'" },
"default": "'medium'"
},
"sx": { "type": { "name": "object" } },
"value": { "type": { "name": "any" } }
},
"name": "Switch",
Expand All @@ -42,6 +43,7 @@
"colorPrimary",
"colorSecondary",
"sizeSmall",
"sizeMedium",
"checked",
"disabled",
"input",
Expand All @@ -56,6 +58,6 @@
"filename": "/packages/material-ui/src/Switch/Switch.js",
"inheritance": { "component": "IconButton", "pathname": "/api/icon-button/" },
"demos": "<ul><li><a href=\"/components/switches/\">Switches</a></li>\n<li><a href=\"/components/transfer-list/\">Transfer List</a></li></ul>",
"styledComponent": false,
"styledComponent": true,
"cssComponent": false
}
6 changes: 6 additions & 0 deletions docs/translations/api-docs/switch/switch.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"onChange": "Callback fired when the state is changed.<br><br><strong>Signature:</strong><br><code>function(event: object) =&gt; void</code><br><em>event:</em> The event source of the callback. You can pull out the new value by accessing <code>event.target.value</code> (string). You can pull out the new checked state by accessing <code>event.target.checked</code> (boolean).",
"required": "If <code>true</code>, the <code>input</code> element is required.",
"size": "The size of the component. <code>small</code> is equivalent to the dense switch styling.",
"sx": "The system prop that allows defining system overrides as well as additional CSS styles. See the <a href=\"/system/basics/#the-sx-prop\">`sx` page</a> for more details.",
"value": "The value of the component. The DOM API casts this to a string. The browser uses &quot;on&quot; as the default value."
},
"classDescriptions": {
Expand Down Expand Up @@ -49,6 +50,11 @@
"nodeName": "the root element",
"conditions": "<code>size=\"small\"</code>"
},
"sizeMedium": {
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the root element",
"conditions": "<code>size=\"medium\"</code>"
},
"checked": {
"description": "Pseudo-class applied to {{nodeName}}.",
"nodeName": "the internal `SwitchBase` component's `checked` class"
Expand Down
2 changes: 1 addition & 1 deletion framer/scripts/framerConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ export const componentSettings = {
template: 'snackbar_content.txt',
},
Switch: {
ignoredProps: ['checkedIcon', 'edge', 'icon', 'onChange', 'required', 'type', 'value'],
ignoredProps: ['checkedIcon', 'edge', 'icon', 'onChange', 'required', 'sx', 'type', 'value'],
propValues: {
label: "'Switch'",
width: 100,
Expand Down
9 changes: 8 additions & 1 deletion packages/material-ui/src/Switch/Switch.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react';
import { InternalStandardProps as StandardProps } from '..';
import { SxProps } from '@material-ui/system';
import { InternalStandardProps as StandardProps, Theme } from '..';
import { SwitchBaseProps } from '../internal/SwitchBase';

export interface SwitchProps
Expand All @@ -26,6 +27,8 @@ export interface SwitchProps
colorSecondary?: string;
/** Styles applied to the root element if `size="small"`. */
sizeSmall?: string;
/** Styles applied to the root element if `size="medium"`. */
sizeMedium?: string;
/** Pseudo-class applied to the internal `SwitchBase` component's `checked` class. */
checked?: string;
/** Pseudo-class applied to the internal SwitchBase component's disabled class. */
Expand Down Expand Up @@ -56,6 +59,10 @@ export interface SwitchProps
* @default 'medium'
*/
size?: 'small' | 'medium';
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
sx?: SxProps<Theme>;
/**
* The value of the component. The DOM API casts this to a string.
* The browser uses "on" as the default value.
Expand Down
Loading