diff --git a/.changeset/tasty-laws-bathe.md b/.changeset/tasty-laws-bathe.md new file mode 100644 index 00000000000..441d6684c25 --- /dev/null +++ b/.changeset/tasty-laws-bathe.md @@ -0,0 +1,26 @@ +--- +'@primer/components': minor +--- + +System props are deprecated in all components except `Box`. Move all system props into the [`sx` prop](https://primer.style/components/overriding-styles) instead. Example: + +```diff +- ++ +``` + +There is a codemod available to migrate from system props to the `sx` prop: + +- TypeScript example: + + ```shell + npx jscodeshift -t node_modules/@primer/components/codemods/removeSystemProps.js + --parser=tsx path/to/workspace/src/*.tsx + ``` + +- Babel example: + + ```shell + npx jscodeshift -t node_modules/@primer/components/codemods/removeSystemProps.js + --parser=babel path/to/workspace/src/*.tsx + ``` diff --git a/codemods/__tests__/removeSystemProps.js b/codemods/__tests__/removeSystemProps.js new file mode 100644 index 00000000000..40307079fa7 --- /dev/null +++ b/codemods/__tests__/removeSystemProps.js @@ -0,0 +1,225 @@ +import {defineInlineTest} from 'jscodeshift/dist/testUtils' +import removeSystemProps from '../removeSystemProps' + +defineInlineTest( + removeSystemProps, + {}, + ` +import {Label} from '@primer/components' +const leftMargin = 2 +export default () => ( + +) +`.trim(), + ` +import {Label} from '@primer/components' +const leftMargin = 2 +export default () => ( + +) +`.trim(), + 'removeSystemProps' +) + +defineInlineTest( + removeSystemProps, + {}, + ` +import {Button, StyledOcticon} from '@primer/components' +import {CheckIcon, ClippyIcon} from '@primer/octicons-react' + +const ClipboardCopy = ({value}) => + +`.trim(), + ` +import {Button, StyledOcticon} from '@primer/components' +import {CheckIcon, ClippyIcon} from '@primer/octicons-react' + +const ClipboardCopy = ({value}) => ( + +)`.trim(), + 'removeSystemProps' +) + +defineInlineTest( + removeSystemProps, + {}, + ` +import {Link} from '@primer/components' +const siteMetadata = {shortName: 'inline-block'} + +const link = + Primer + +`.trim(), + ` +import {Link} from '@primer/components' +const siteMetadata = {shortName: 'inline-block'} + +const link = ( + + Primer + +)`.trim(), + 'removeSystemProps' +) + +defineInlineTest( + removeSystemProps, + {}, + ` +import {Label} from '@primer/components' +const leftMargin = 2 +export default () => ( + +) +`.trim(), + ` +import {Label} from '@primer/components' +const leftMargin = 2 +export default () => ( + +) +`.trim(), + 'removeSystemProps' +) + +defineInlineTest( + removeSystemProps, + {}, + ` +import {Label} from '@primer/components' +const leftMargin = 2 +export default () => ( + +) +`.trim(), + ` +import {Label} from '@primer/components' +const leftMargin = 2 +export default () => ( + +) +`.trim(), + 'removeSystemProps' +) + +defineInlineTest( + removeSystemProps, + {}, + ` +import {Label} from '@primer/components' +const leftMargin = 2 +const colorProps = {backgroundColor: 'red'} +const borderProps = {borderColor: 'red'} +export default () => ( + +) +`.trim(), + ` +import {Label} from '@primer/components' +const leftMargin = 2 +const colorProps = {backgroundColor: 'red'} +const borderProps = {borderColor: 'red'} +export default () => ( + +) +`.trim(), + 'removeSystemProps' +) + +defineInlineTest( + removeSystemProps, + {}, + ` +import {Label} from '@primer/components' +const leftMargin = 2 +export default () => ( + +) +`.trim(), + ` +import {Label} from '@primer/components' +const leftMargin = 2 +export default () => ( + +) +`.trim(), + 'removeSystemProps' +) + +defineInlineTest( + removeSystemProps, + {}, + ` +import {Label} from '@primer/components' +const leftMargin = 2 +const colorProps = {dark: {backgroundColor: 'red'}} +export default () => ( + +) +`.trim(), + ` +import {Label} from '@primer/components' +const leftMargin = 2 +const colorProps = {dark: {backgroundColor: 'red'}} +export default () => ( + +) +`.trim(), + 'removeSystemProps' +) diff --git a/codemods/removeSystemProps.js b/codemods/removeSystemProps.js new file mode 100644 index 00000000000..919c2c9447f --- /dev/null +++ b/codemods/removeSystemProps.js @@ -0,0 +1,312 @@ +const prettify = require('./lib/prettify') + +const COMMON = [ + 'margin', + 'marginTop', + 'marginRight', + 'marginBottom', + 'marginLeft', + 'marginX', + 'marginY', + 'm', + 'mt', + 'mr', + 'mb', + 'ml', + 'mx', + 'my', + 'padding', + 'paddingTop', + 'paddingRight', + 'paddingBottom', + 'paddingLeft', + 'paddingX', + 'paddingY', + 'p', + 'pt', + 'pr', + 'pb', + 'pl', + 'px', + 'py', + 'color', + 'backgroundColor', + 'opacity', + 'bg', + 'display' +] + +const TYPOGRAPHY = [ + 'fontFamily', + 'fontSize', + 'fontWeight', + 'lineHeight', + 'letterSpacing', + 'textAlign', + 'fontStyle', + 'whiteSpace' +] + +const BORDER = [ + 'border', + 'borderWidth', + 'borderStyle', + 'borderColor', + 'borderRadius', + 'borderTop', + 'borderTopLeftRadius', + 'borderTopRightRadius', + 'borderRight', + 'borderBottom', + 'borderBottomLeftRadius', + 'borderBottomRightRadius', + 'borderLeft', + 'borderX', + 'borderY', + 'borderTopWidth', + 'borderTopColor', + 'borderTopStyle', + 'borderBottomWidth', + 'borderBottomColor', + 'borderBottomStyle', + 'borderLeftWidth', + 'borderLeftColor', + 'borderLeftStyle', + 'borderRightWidth', + 'borderRightColor', + 'borderRightStyle', + 'boxShadow', + 'textShadow' +] + +const LAYOUT = [ + 'width', + 'height', + 'minWidth', + 'minHeight', + 'maxWidth', + 'maxHeight', + 'size', + 'overflow', + 'overflowX', + 'overflowY', + 'display', + 'verticalAlign' +] + +const POSITION = ['position', 'zIndex', 'top', 'right', 'bottom', 'left'] + +const FLEX = [ + 'alignItems', + 'alignContent', + 'justifyItems', + 'justifyContent', + 'flexWrap', + 'flexDirection', + 'flex', + 'flexGrow', + 'flexShrink', + 'flexBasis', + 'justifySelf', + 'alignSelf', + 'order' +] + +// const GRID = [ +// 'gridGap', +// 'gridColumnGap', +// 'gridRowGap', +// 'gridColumn', +// 'gridRow', +// 'gridAutoFlow', +// 'gridAutoColumns', +// 'gridAutoRows', +// 'gridTemplateColumns', +// 'gridTemplateRows', +// 'gridTemplateAreas', +// 'gridArea' +// ] + +const stylePropsMap = { + Avatar: [...COMMON], + AvatarStack: [...COMMON], + BranchName: [...COMMON], + Breadcrumb: [...COMMON, ...FLEX], + Button: [...COMMON, ...LAYOUT, ...TYPOGRAPHY], + ButtonBase: [...COMMON, ...LAYOUT], + ButtonClose: [...COMMON, ...LAYOUT], + ButtonTableList: [...COMMON, ...TYPOGRAPHY, ...LAYOUT], + CircleBadge: [...COMMON], + CounterLabel: [...COMMON], + Details: [...COMMON], + Dialog: [...LAYOUT, ...COMMON, ...POSITION], + Dropdown: [...COMMON], + FilteredSearch: [...COMMON], + FilterList: [...COMMON], + Flash: [...COMMON], + FormGroup: [...COMMON], + FormGroupLabel: [...COMMON, ...TYPOGRAPHY], + Header: [...COMMON, ...BORDER], + HeaderItem: [...COMMON, ...BORDER], + Label: [...COMMON, ...BORDER], + LabelGroup: [...COMMON], + Link: [...COMMON, ...TYPOGRAPHY], + Overlay: [...COMMON], + Pagehead: [...COMMON], + Pagination: [...COMMON], + Popover: [...COMMON, ...LAYOUT, ...POSITION], + PopoverContent: [...COMMON, ...LAYOUT, ...POSITION, ...FLEX], + SelectMenu: [...COMMON], + SelectMenuDivider: [...COMMON], + SelectMenuFilter: [...COMMON], + SelectMenuFooter: [...COMMON], + SelectMenuHeader: [...COMMON, ...TYPOGRAPHY], + SelectMenuItem: [...COMMON], + SelectMenuList: [...COMMON], + SelectMenuLoadingAnimation: [...COMMON], + SelectMenuModal: [...COMMON], + SelectMenuTab: [...COMMON], + SelectMenuTabPanel: [...COMMON], + SelectMenuTabs: [...COMMON], + SideNav: [...COMMON], + Spinner: [...COMMON], + StateLabel: [...COMMON], + StyledOcticon: [...COMMON], + SubNav: [...COMMON, ...FLEX], + TabNav: [...COMMON], + TabNavLink: [...COMMON, ...TYPOGRAPHY], + TextInput: [...COMMON], + Timeline: [...COMMON], + Tooltip: [...COMMON], + Truncate: [...TYPOGRAPHY, ...COMMON], + UnderlineNav: [...COMMON] +} + +const expressionToString = expression => { + if (expression.type === 'Literal') { + const expressionValue = expression.value + return typeof expressionValue === 'string' ? `"${expressionValue}"` : expressionValue + } else if (expression.type === 'Identifier') { + return expression.name + } else if (expression.type === 'Identifier') { + return expression.name + } else if (['null', 'undefined'].includes(expression.raw)) { + return expression.raw + } else { + const start = expression.start + const end = expression.end + const toks = expression.loc.tokens.filter(token => { + return token.type !== 'CommentLine' && token.start >= start && token.end <= end + }) + const vals = toks.map(tok => { + return tok.type.label === 'string' ? `"${tok.value}"` : tok.value + }) + return vals.join('') + } +} + +const objectToString = (object, spreads = []) => { + const values = Object.values(object) + const keys = Object.keys(object) + const duples = keys.map(function (key, i) { + return [key, values[i]] + }) + const accumulator = (string, duple) => { + const expression = duple[1] + const expressionString = expressionToString(expression) + return `${string} ${duple[0]}: ${expressionString},` + } + const objString = duples.reduce(accumulator, '') + const spreadsString = spreads.map(s => `...${s},`).join('') + return `{${spreadsString}${objString}}` +} + +module.exports = (file, api) => { + const j = api.jscodeshift + const ast = j(file.source) + + const importsByName = {} + + ast + .find(j.ImportDeclaration, decl => decl.source.value.includes('@primer/components')) + .forEach(decl => { + j(decl) + .find(j.ImportSpecifier) + .forEach(spec => { + importsByName[spec.node.imported.name] = spec.node.local.name + }) + }) + + ast + .find(j.JSXElement, { + openingElement: { + name: { + name: name => { + return name in stylePropsMap + } + } + } + }) + .forEach(el => { + const sx = {} + const elementName = el.value?.openingElement?.name?.name + const elementNameScrubbed = elementName.replace('.', '') + const systemProps = stylePropsMap[elementNameScrubbed] + const attrNodes = j(el).find(j.JSXAttribute, { + name: name => { + const isInElement = name.start >= el.node.start && name.end <= el.value.openingElement.end + return systemProps && systemProps.includes(name.name) && isInElement + } + }) + + const sxNodes = j(el).find(j.JSXAttribute, { + name: name => { + const isInElement = name.start >= el.node.start && name.end <= el.value.openingElement.end + return name.name === 'sx' && isInElement + } + }) + + const existingSx = {} + const sxNodesArray = sxNodes.nodes() || [] + const existingSxProps = sxNodesArray[0]?.value?.expression?.properties + existingSxProps && + existingSxProps.forEach(p => { + const keyName = p?.key?.name + const keyValue = p?.key?.raw + if (!keyName && !keyValue) { + return + } + existingSx[keyName || keyValue] = p.value + }) + const spreads = + existingSxProps && + existingSxProps + .filter(p => p.type === 'SpreadElement') + .map(s => { + const argName = s?.argument?.name + const propName = s?.argument?.property?.name + const objectName = s?.argument?.object?.name + return argName || `${objectName}.${propName}` + }) + + attrNodes.forEach((attr, index) => { + const key = attr?.value?.name?.name + const literal = attr?.value?.value + const val = literal.type === 'JSXExpressionContainer' ? literal.expression : literal + if (key && val) { + sx[key] = val + } + if (index + 1 !== attrNodes.length) { + attr.prune() + } else { + const keys = Object.keys(sx) + if (keys.length > 0) { + sxNodes.forEach(node => node.prune()) + j(attr).replaceWith(`sx={${objectToString({...existingSx, ...sx}, spreads)}}`) + } + } + }) + }) + + return prettify(ast, file) +} diff --git a/docs/content/AvatarStack.mdx b/docs/content/AvatarStack.mdx index 61bc65aedd5..1b1ee21728d 100644 --- a/docs/content/AvatarStack.mdx +++ b/docs/content/AvatarStack.mdx @@ -5,32 +5,39 @@ title: AvatarStack AvatarStack is used to display more than one Avatar in an inline stack. ### Default example + ```jsx live - - - - - - - ``` - - ### Right aligned + + + + + + +``` + +### Right aligned + ```jsx live - - - - - - - ``` + + + + + + +``` ## System props -AvatarStack components get `COMMON` system props, AvatarStack.Item components do not get any system props. Read our [System Props](/system-props) doc page for a full list of available props. + +System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead. + + + +AvatarStack components get `COMMON` system props, AvatarStack.Item components do not get any system props. Read our [System Props](/system-props) doc page for a full list of available props. ## AvatarStack Component props -| Name | Type | Default | Description | -| :- | :- | :-: | :- | -| alignRight | Boolean | | Creates right aligned AvatarStack | \ No newline at end of file +| Name | Type | Default | Description | +| :--------- | :------ | :-----: | :-------------------------------- | +| alignRight | Boolean | | Creates right aligned AvatarStack | diff --git a/docs/content/BranchName.md b/docs/content/BranchName.md index 1badc1882a2..be80991dd1b 100644 --- a/docs/content/BranchName.md +++ b/docs/content/BranchName.md @@ -10,10 +10,6 @@ BranchName is a label-type component rendered as an `` tag by default with mo a_new_feature_branch ``` -## System props - -BranchName components get `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props. - ## Component props | Name | Type | Default | Description | diff --git a/docs/content/Breadcrumbs.md b/docs/content/Breadcrumbs.md index db6ed9df52e..d9d4a89728a 100644 --- a/docs/content/Breadcrumbs.md +++ b/docs/content/Breadcrumbs.md @@ -27,6 +27,12 @@ This ensures that the NavLink gets `activeClassName='selected'` ## System props + + +System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead. + + + Breadcrumb and Breadcrumb.Item components get `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props. ## Component props @@ -37,8 +43,8 @@ The `Breadcrumb` component does not receive any additional props besides `COMMON ### Breadcrumb.Item -| Prop name | Type | Default | Description | -| :- | :- | :-: | :- | -| as | String | `a` | Sets the HTML tag for the component | -| href | String | | URL to be used for the Link | -| selected | Boolean | false | Used to style the link as selected or unselected | +| Prop name | Type | Default | Description | +| :-------- | :------ | :-----: | :----------------------------------------------- | +| as | String | `a` | Sets the HTML tag for the component | +| href | String | | URL to be used for the Link | +| selected | Boolean | false | Used to style the link as selected or unselected | diff --git a/docs/content/Buttons.md b/docs/content/Buttons.md index d576ed76801..4d6d225c72a 100644 --- a/docs/content/Buttons.md +++ b/docs/content/Buttons.md @@ -2,7 +2,6 @@ title: Buttons --- - `Button` is used for actions, like in forms, while `Link` is used for destinations, or moving from one page to another. In special cases where you'd like to use a `` styled like a Button, use ` + Delete @@ -86,6 +86,12 @@ You can also pass any non-text content into the header: ## System props + + +System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead. + + + `Dialog` components get the `COMMON` and `LAYOUT` categories of system props. `Dialog.Header` components get `COMMON`, `LAYOUT`, and `FLEX` system props. Read our [System Props](/system-props) doc page for a full list of available props. ## Component props diff --git a/docs/content/Dialog2.mdx b/docs/content/Dialog2.mdx index 49d8103892a..9699b3e1490 100644 --- a/docs/content/Dialog2.mdx +++ b/docs/content/Dialog2.mdx @@ -71,10 +71,6 @@ By default, the Dialog component implements the design and interactions defined ``` -## System props - -`Dialog`, `Dialog.Header`, `Dialog.Title`, `Dialog.Subtitle`, `Dialog.Body`, and `Dialog.Footer` components get the `COMMON`, `LAYOUT`, and `FLEX` categories of system props. Read our [System Props](/system-props) doc page for a full list of available props. - ## Component props ### DialogProps @@ -89,8 +85,8 @@ By default, the Dialog component implements the design and interactions defined | footerButtons | `DialogButtonProps[]` | | Optional. Specify buttons that will be rendered in the footer of the dialog. | | onClose | `(gesture: 'close-button' │ 'escape') => void` | | Required. This method is invoked when a gesture to close the dialog is used (either an Escape key press or clicking the "X" in the top-right corner). The gesture argument indicates the gesture that was used to close the dialog (either 'close-button' or 'escape'). | | role | `"dialog" │ "alertdialog"` | `"dialog"` | The ARIA role given to the dialog element. More info: [dialog](https://www.w3.org/TR/wai-aria-practices-1.1/#dialog_modal), [alertdialog](https://www.w3.org/TR/wai-aria-practices-1.1/#alertdialog) | -| width | `"small" │ "medium" │ "large" │ "xlarge"` | `"xlarge"` | The fixed width of the dialog. | -| height | `"small" │ "large" │ "auto"` | `"auto"` | The fixed height of the dialog, or, auto to adjust the height based on its contents. | +| width | `"small" │ "medium" │ "large" │ "xlarge"` | `"xlarge"` | The fixed width of the dialog. | +| height | `"small" │ "large" │ "auto"` | `"auto"` | The fixed height of the dialog, or, auto to adjust the height based on its contents. | ### DialogHeaderProps diff --git a/docs/content/Dropdown.md b/docs/content/Dropdown.md index 48adbd83f85..b5c6f06a93c 100644 --- a/docs/content/Dropdown.md +++ b/docs/content/Dropdown.md @@ -1,6 +1,7 @@ --- title: Dropdown --- + The Dropdown component is a lightweight context menu for housing navigation and actions. Use `Dropdown.Button` as the trigger for the dropdown, or use a custom `summary` element if you would like. **You must use a `summary` tag in order for the dropdown to behave properly!**. You should also add `aria-haspopup="true"` to custom dropdown triggers for accessibility purposes. You can use the `Dropdown.Caret` component to add a caret to a custom dropdown trigger. @@ -8,10 +9,11 @@ Use `Dropdown.Button` as the trigger for the dropdown, or use a custom `summary` Dropdown.Menu wraps your menu content. Be sure to pass a `direction` prop to this component to position the menu in relation to the Dropdown.Button. ## Default example + ```jsx live Dropdown - + Item 1 Item 2 Item 3 @@ -20,13 +22,14 @@ Dropdown.Menu wraps your menu content. Be sure to pass a `direction` prop to thi ``` ## With custom button + ```jsx live Dropdown - + - + Item 1 Item 2 Item 3 @@ -34,28 +37,36 @@ Dropdown.Menu wraps your menu content. Be sure to pass a `direction` prop to thi ``` - ## System props + + +System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead. + + + Dropdown, Dropdown.Menu, Dropdown.Button, Dropdown.Caret, and Dropdown.Item all get `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props. ## Component props The Dropdown component is extended from the [`Details`](/Details) component and gets all props that the [`Details`](/Details) component gets. - #### Dropdown.Menu -| Name | Type | Default | Description | -| :- | :- | :-: | :- | -| direction | String | 'sw' | Sets the direction of the dropdown menu. Pick from 'ne', 'e', 'se', 's', 'sw', or 'w' | + +| Name | Type | Default | Description | +| :-------- | :----- | :-----: | :------------------------------------------------------------------------------------ | +| direction | String | 'sw' | Sets the direction of the dropdown menu. Pick from 'ne', 'e', 'se', 's', 'sw', or 'w' | #### Dropdown.Button -| Name | Type | Default | Description | -| :- | :- | :-: | :- | -| onClick | Function | none | Use the `onClick` handler to add additional functionality when the button is clicked, such as fetching data. | + +| Name | Type | Default | Description | +| :------ | :------- | :-----: | :----------------------------------------------------------------------------------------------------------- | +| onClick | Function | none | Use the `onClick` handler to add additional functionality when the button is clicked, such as fetching data. | #### Dropdown.Caret + No additional props. #### Dropdown.Item + No additional props. diff --git a/docs/content/FilterList.md b/docs/content/FilterList.md index 51a9cf81cdf..5430cc7e10f 100644 --- a/docs/content/FilterList.md +++ b/docs/content/FilterList.md @@ -20,6 +20,12 @@ The FilterList component is a menu with filter options that filter the main cont ## System props + + +System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead. + + + FilterList components get `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props. ## Component props diff --git a/docs/content/FilteredSearch.md b/docs/content/FilteredSearch.md index 97bd4f9fffc..b7d88646abf 100644 --- a/docs/content/FilteredSearch.md +++ b/docs/content/FilteredSearch.md @@ -4,7 +4,8 @@ title: FilteredSearch The FilteredSearch component helps style a Dropdown and a TextInput side-by-side. -**Note:** You *must* use a `TextInput` and `Dropdown` (or native `
` and ``) in order for this component to work properly. +**Note:** You _must_ use a `TextInput` and `Dropdown` (or native `
` and ``) in order for this component to work properly. + ## Default example ```jsx live @@ -23,6 +24,12 @@ The FilteredSearch component helps style a Dropdown and a TextInput side-by-side ## System props + + +System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead. + + + FilteredSearch gets `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props. ## Component props diff --git a/docs/content/Flash.md b/docs/content/Flash.md index 220efc528b6..3233f24c68e 100644 --- a/docs/content/Flash.md +++ b/docs/content/Flash.md @@ -19,18 +19,24 @@ Flash components with icons inside of them will automatically set the correct co ```jsx live - + Success! ``` ## System props + + +System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead. + + + Flash components get `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props. ## Component props -| Name | Type | Default | Description | -| :- | :- | :-: | :- | -| full | Boolean | | Creates a full width Flash component| -| variant | String | default | Can be one of `default`, `success`, `warning`, or `danger` - sets the background color and border of the Flash component | +| Name | Type | Default | Description | +| :------ | :------ | :-----: | :----------------------------------------------------------------------------------------------------------------------- | +| full | Boolean | | Creates a full width Flash component | +| variant | String | default | Can be one of `default`, `success`, `warning`, or `danger` - sets the background color and border of the Flash component | diff --git a/docs/content/FormGroup.md b/docs/content/FormGroup.md index 5a5e7d70e9a..8779fce01a4 100644 --- a/docs/content/FormGroup.md +++ b/docs/content/FormGroup.md @@ -20,6 +20,12 @@ Adds styles for multiple form elements used together. ## System props + + +System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead. + + + FormGroup components get `COMMON` system props. FormGroup.Label components get `COMMON` and `TYPOGRAPHY` system props. Read our [System Props](/system-props) doc page for a full list of available props. ## Component props @@ -32,7 +38,7 @@ FormGroup components get `COMMON` system props. FormGroup.Label components get ` ### FormGroup.Label -| Name | Type | Default | Description | -| :--- | :----- | :-----: | :---------------------------------- | -| as | String | `label` | Sets the HTML tag for the component | -| htmlFor | String | | The value of `htmlFor` needs to be the same as the `id` of the input it labels | +| Name | Type | Default | Description | +| :------ | :----- | :-----: | :----------------------------------------------------------------------------- | +| as | String | `label` | Sets the HTML tag for the component | +| htmlFor | String | | The value of `htmlFor` needs to be the same as the `id` of the input it labels | diff --git a/docs/content/Header.md b/docs/content/Header.md index 8a9244e2582..26548ad3fb3 100644 --- a/docs/content/Header.md +++ b/docs/content/Header.md @@ -20,26 +20,17 @@ All items directly under the Header component should be a `Header.Item` componen Menu - + ``` -## Header with full-size item example +## Header with full-size item example ```jsx live
Item 1 - + Item 2 Item 3 @@ -64,19 +55,25 @@ All items directly under the Header component should be a `Header.Item` componen ## System props + + +System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead. + + + `Header` and `Header.Item` components get `COMMON` and `BORDER` system props. `Header.Link` component gets `COMMON`, `BORDER`, and `TYPOGRAPHY` system props. Read our [System Props](/system-props) doc page for a full list of available props. ## Component props ### Header.Item -| Prop name | Type | Description | -| :--------- | :------ | :------------------------------------------------------------------------------------- | -| full | Boolean | stretches item to fill the available space | +| Prop name | Type | Description | +| :-------- | :------ | :----------------------------------------- | +| full | Boolean | stretches item to fill the available space | ### Header.Link -| Prop name | Type | Description | -| :--------- | :------ | :------------------------------------------------------------------------------------- | -| as | String | sets the HTML tag for the component | -| href | String | URL to be used for the Link | \ No newline at end of file +| Prop name | Type | Description | +| :-------- | :----- | :---------------------------------- | +| as | String | sets the HTML tag for the component | +| href | String | URL to be used for the Link | diff --git a/docs/content/Label.md b/docs/content/Label.md index 40375d4d484..fa22787397c 100644 --- a/docs/content/Label.md +++ b/docs/content/Label.md @@ -7,21 +7,27 @@ The Label component is used to add contextual metadata to a design. Visually it ## Default example ```jsx live - - - + + + - - - - - + + + + + ``` ## System props + + +System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead. + + + Label components get `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props. ## Component props diff --git a/docs/content/LabelGroup.md b/docs/content/LabelGroup.md index 8f3e62766c9..3fdcafc9a5a 100644 --- a/docs/content/LabelGroup.md +++ b/docs/content/LabelGroup.md @@ -9,15 +9,23 @@ The LabelGroup component is used to add commonly used margins and wrapping for g ```jsx live - + ``` ## System props + + +System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead. + + + LabelGroup components get `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props. ## Component props -LabelGroup does not get any additional props other than the `COMMON` system props. +LabelGroup does not get any additional props. diff --git a/docs/content/Link.md b/docs/content/Link.md index 106fda6d2e8..4ec7fc339bb 100644 --- a/docs/content/Link.md +++ b/docs/content/Link.md @@ -11,13 +11,19 @@ In special cases where you'd like a ` @@ -39,11 +39,11 @@ function PopoverDemo(props) { return ( - + Caret Position - + Popover Visibility @@ -55,7 +55,7 @@ function PopoverDemo(props) { - + {pos} caret Message about this particular piece of UI. @@ -107,7 +107,13 @@ render() ## System props -`Popover` components get `COMMON`, `LAYOUT`, and `POSITION` system props. `Popover.Content` components get `COMMON`, `LAYOUT`, `BORDER`, and `FLEX` system props. Read our [System Props](/system-props) doc page for a full list of available props. + + +System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead. + + + +ProgressBar components get `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props. ## Component props diff --git a/docs/content/ProgressBar.mdx b/docs/content/ProgressBar.mdx index d7ec53f061f..a9e9c46b0e2 100644 --- a/docs/content/ProgressBar.mdx +++ b/docs/content/ProgressBar.mdx @@ -15,14 +15,10 @@ If you'd like to use ProgressBar inline, pass the `inline` boolean prop & **be s ```jsx live <> 5 of 10 - + ``` -## System props - -ProgressBar components get `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props. - ## Component props | Name | Type | Default | Description | diff --git a/docs/content/SelectMenu.md b/docs/content/SelectMenu.md index f2cb5992708..e817188f564 100644 --- a/docs/content/SelectMenu.md +++ b/docs/content/SelectMenu.md @@ -31,10 +31,6 @@ Main wrapper component for select menu. {/* all other sub components are wrapped here*/} ``` -### System props - -SelectMenu components get `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props. - ### Component Props | Name | Type | Default | Description | @@ -112,10 +108,6 @@ Use the `align='right'` prop to align the modal to the right. Note that this onl ``` -### System Props - -SelectMenu.Modal components get `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props. - ### Component Props | Prop name | Type | Default | Description | @@ -131,10 +123,6 @@ Used to wrap the select menu list content. All menu items **must** be wrapped in {/* all menu list items are wrapped in the list*/} ``` -### System Props - -SelectMenu.List components get `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props. - ### Component Props SelectMenu.List components do not get any additional props besides system props. @@ -151,9 +139,15 @@ You can use a `button` tag instead by utilizing the [`as` prop](/core-concepts#t ``` -### System Props +### System props + + + +System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead. + + -SelectMenu.Item components get `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props. +SelectMenu components get `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props. ### Component Props @@ -185,6 +179,12 @@ Use a `SelectMenu.Filter` to add a filter UI to your select menu. Users are expe ### System Props + + +System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead. + + + SelectMenu.Filter components get `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props. ### Component Props @@ -230,10 +230,6 @@ If you need access to the selected tab state, you can find it in the MenuContext ``` -### System Props - -SelectMenu.Tabs components get `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props. - ### Component Props SelectMenu.Tabs components do not get any additional props besides system props. @@ -251,6 +247,12 @@ The `onClick` prop is optional and can be used for any events or data fetching y ### System Props + + +System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead. + + + SelectMenu.Tab components get `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props. ### Component Props @@ -273,6 +275,12 @@ Wraps the content for each tab. Make sure to use the `tabName` prop to identify ### System Props + + +System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead. + + + SelectMenu.TabPanel components get `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props. ### Component Props @@ -303,6 +311,12 @@ Use a `SelectMenu.Divider` to add information between items in a `SelectMenu.Lis ### System Props + + +System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead. + + + SelectMenu.Divder components get `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props. ### Component Props @@ -331,6 +345,12 @@ Use a `SelectMenu.Footer` to add content to the bottom of the select menu. ### System Props + + +System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead. + + + SelectMenu.Footer components get `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props. ### Component Props @@ -359,6 +379,12 @@ Use a `SelectMenu.Header` to add a header to the top of the select menu content. ### System Props + + +System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead. + + + SelectMenu.Header components get `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props. ### Component Props @@ -394,6 +420,12 @@ Use a `SelectMenu.LoadingAnimation` to add a loading animation inside of the Sel ### System Props + + +System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead. + + + SelectMenu.LoadingAnimation components get `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props. ### Component Props diff --git a/docs/content/SideNav.md b/docs/content/SideNav.md index f58ed63c81c..19752a93f65 100644 --- a/docs/content/SideNav.md +++ b/docs/content/SideNav.md @@ -39,12 +39,12 @@ Add the `variant='full'` prop to a `SideNav.Link` to spread child elements acros With an avatar - + With an Octicon With a status icon - + With a label @@ -55,7 +55,7 @@ Add the `variant='full'` prop to a `SideNav.Link` to spread child elements acros 16 - + A heading and some more content @@ -149,6 +149,12 @@ If using React Router, you can use the `as` prop to render the element as a `Nav ## System props + + +System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead. + + + `SideNav` components get `COMMON`, `BORDER`, `LAYOUT`, and `FLEX` system props. `SideNav.Link` components get `COMMON` and `TYPOGRAPHY` system props. Read our [System Props](/system-props) doc page for a full list of available props. ## Component props diff --git a/docs/content/Spinner.md b/docs/content/Spinner.md index 8c8a48d7120..5d2adc9a2c3 100644 --- a/docs/content/Spinner.md +++ b/docs/content/Spinner.md @@ -16,17 +16,23 @@ Use Spinner to let users know that content is being loaded. ### Small ```jsx live - + ``` ### Large ```jsx live - + ``` ## System props + + +System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead. + + + Spinner components get `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props. ## Component props diff --git a/docs/content/StateLabel.md b/docs/content/StateLabel.md index 19b0a6d68c0..79fa62fd6d8 100644 --- a/docs/content/StateLabel.md +++ b/docs/content/StateLabel.md @@ -1,6 +1,7 @@ --- title: StateLabel --- + Use StateLabel components to show the status of an issue or pull request. ## Default example @@ -16,11 +17,17 @@ Use StateLabel components to show the status of an issue or pull request. ## System props + + +System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead. + + + StateLabel components get `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props. ## Component props -| Name | Type | Default | Description | -| :- | :- | :-: | :- | -| variant | String | 'normal' | a value of `small` or `normal` results in a smaller or larger version of the StateLabel. | -| status | String | | Can be one of `issueOpened`, `issueClosed`, `pullOpened`, `pullClosed`, `pullMerged`, or `draft`. +| Name | Type | Default | Description | +| :------ | :----- | :------: | :------------------------------------------------------------------------------------------------ | +| variant | String | 'normal' | a value of `small` or `normal` results in a smaller or larger version of the StateLabel. | +| status | String | | Can be one of `issueOpened`, `issueClosed`, `pullOpened`, `pullClosed`, `pullMerged`, or `draft`. | diff --git a/docs/content/StyledOcticon.md b/docs/content/StyledOcticon.md index 36285795443..bb88081c480 100644 --- a/docs/content/StyledOcticon.md +++ b/docs/content/StyledOcticon.md @@ -14,6 +14,12 @@ StyledOcticon renders an [Octicon](https://octicons.github.com) with common syst ## System props + + +System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead. + + + StyledOcticon components get `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props. ## Component props diff --git a/docs/content/SubNav.md b/docs/content/SubNav.md index 5e53ebf065d..92d3312a03e 100644 --- a/docs/content/SubNav.md +++ b/docs/content/SubNav.md @@ -37,7 +37,7 @@ This ensures that the NavLink gets `activeClassName='selected'` Support - + ``` @@ -74,6 +74,12 @@ This ensures that the NavLink gets `activeClassName='selected'` ## System props + + +System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead. + + + SubNav and SubNav.Link components get `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props. ## Component props diff --git a/docs/content/TabNav.md b/docs/content/TabNav.md index 71c0a1e173a..6dd4e83ce9b 100644 --- a/docs/content/TabNav.md +++ b/docs/content/TabNav.md @@ -25,6 +25,12 @@ This ensures that the NavLink gets `activeClassName='selected'` ## System props + + +System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead. + + + TabNav and TabNav.Link components get `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props. ## Component props diff --git a/docs/content/Text.md b/docs/content/Text.md index a3984b2b54a..6dbd96fb555 100644 --- a/docs/content/Text.md +++ b/docs/content/Text.md @@ -14,6 +14,12 @@ The Text component is a wrapper component that will apply typography styles to t ## System props + + +System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead. + + + Text components get `TYPOGRAPHY` and `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props. ## Component props diff --git a/docs/content/TextInput.md b/docs/content/TextInput.md index 254784df865..83d557f59fa 100644 --- a/docs/content/TextInput.md +++ b/docs/content/TextInput.md @@ -5,31 +5,38 @@ title: TextInput TextInput is a form component to add default styling to the native text input. **Note:** Don't forget to set `aria-label` to make the TextInput accessible to screen reader users. + ## Default example ```jsx live - + - + ``` ## System props + + +System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead. + + + TextInput components get `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props. ## Component props Native `` attributes are forwarded to the underlying React `input` component and are not listed below. -| Name | Type | Default | Description | -| :- | :- | :-: | :- | -| aria-label | String | | Required. Allows input to be accessible. | -| block | Boolean | | Adds `display: block` to element | -| contrast | Boolean | | Changes background color to a higher contrast color | -| variant | String | | Can be either `small` or `large`. Creates a smaller or larger input than the default. -| width | String or Number | | Set the width of the input | -| maxWidth | String or Number or [Array](https://styled-system.com/guides/array-props) | | Set the maximum width of the input | -| minWidth | String or Number or [Array](https://styled-system.com/guides/array-props) | | Set the minimum width of the input | -| icon | Node (pass Octicon react component) | | Icon to be used inside of input. Positioned on the left edge. | +| Name | Type | Default | Description | +| :--------- | :------------------------------------------------------------------------ | :-----: | :------------------------------------------------------------------------------------ | +| aria-label | String | | Required. Allows input to be accessible. | +| block | Boolean | | Adds `display: block` to element | +| contrast | Boolean | | Changes background color to a higher contrast color | +| variant | String | | Can be either `small` or `large`. Creates a smaller or larger input than the default. | +| width | String or Number | | Set the width of the input | +| maxWidth | String or Number or [Array](https://styled-system.com/guides/array-props) | | Set the maximum width of the input | +| minWidth | String or Number or [Array](https://styled-system.com/guides/array-props) | | Set the minimum width of the input | +| icon | Node (pass Octicon react component) | | Icon to be used inside of input. Positioned on the left edge. | diff --git a/docs/content/Timeline.md b/docs/content/Timeline.md index a0b141148b9..707a5eb404d 100644 --- a/docs/content/Timeline.md +++ b/docs/content/Timeline.md @@ -13,10 +13,10 @@ The Timeline.Item component is used to display items on a vertical timeline, con - + Monalisa - created one + created one hot potato @@ -50,20 +50,20 @@ of the child `StyledOcticon` if necessary. ```jsx live - - + + Background used when closed events occur - + Background when opened or passed events occur - - + + Background used when pull requests are merged @@ -98,15 +98,15 @@ To create a visual break in the timeline, use Timeline.Break. This adds a horizo ```jsx live - + Background used when closed events occur - - + + Background when opened or passed events occur @@ -115,6 +115,12 @@ To create a visual break in the timeline, use Timeline.Break. This adds a horizo ## System props + + +System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead. + + + Timeline and Timeline.Item components get `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props. ## Component props diff --git a/docs/content/Tooltip.md b/docs/content/Tooltip.md index 6e9c525ac0a..9cc42489526 100644 --- a/docs/content/Tooltip.md +++ b/docs/content/Tooltip.md @@ -22,6 +22,12 @@ Before adding a tooltip, please consider: Is this information essential and nece ## System props + + +System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead. + + + Tooltip components get `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props. ## Component props diff --git a/docs/content/Truncate.md b/docs/content/Truncate.md index 8e52b5a9469..3f5a7b287ff 100644 --- a/docs/content/Truncate.md +++ b/docs/content/Truncate.md @@ -47,6 +47,12 @@ You can use the `expandable` boolean prop to display the truncated text on hover ## System props + + +System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead. + + + Truncate components get `TYPOGRAPHY` and `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props. ## Component props diff --git a/docs/content/UnderlineNav.md b/docs/content/UnderlineNav.md index 6d71b211752..4dae70d8943 100644 --- a/docs/content/UnderlineNav.md +++ b/docs/content/UnderlineNav.md @@ -25,6 +25,12 @@ This ensures that the NavLink gets `activeClassName='selected'` ## System props + + +System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead. + + + UnderlineNav and UnderlineNav.Link components get `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props. ## Component props diff --git a/docs/content/overriding-styles.mdx b/docs/content/overriding-styles.mdx index 3c9da4d3110..83b3eed5570 100644 --- a/docs/content/overriding-styles.mdx +++ b/docs/content/overriding-styles.mdx @@ -2,9 +2,9 @@ title: Overriding styles with the sx prop --- -Our goal with Primer React is to hit the sweet spot between providing too little and too much styling flexibility; too little and the design system is too rigid, and too much and it becomes too difficult to maintain a consistent style. Our components already support a standard set of [system props](/system-props), but sometimes a component just isn't _quite_ flexible enough to look the way you need it to look. For those cases, we provide the `sx` prop. +Our goal with Primer React is to hit the sweet spot between providing too little and too much styling flexibility; too little and the design system is too rigid, and too much and it becomes too difficult to maintain a consistent style. Our components are designed to cover common usage patterns, but sometimes a component just isn't _quite_ flexible enough to look the way you need it to look. For those cases, we provide the `sx` prop. -The `sx` prop allows ad-hoc styling that is still theme aware. Declare the styles you want to apply in camel-cased object notation, and try to use theme values in appropriate CSS properties when possible. If you've passed a custom theme using `ThemeProvider` or a `theme` prop, the `sx` prop will honor the custom theme. For more information on theming in Primer React, check out [the Primer Theme documentation](/primer-theme). +The `sx` prop allows ad-hoc styling that is still theme-aware. Declare the styles you want to apply in camel-cased object notation, and try to use theme values in appropriate CSS properties when possible. If you've passed a custom theme using `ThemeProvider` or a `theme` prop, the `sx` prop will honor the custom theme. For more information on theming in Primer React, check out [the Primer Theme documentation](/primer-theme). ## When to use the `sx` prop diff --git a/docs/content/system-props.mdx b/docs/content/system-props.mdx index 755a8e86f72..f04051ce3d3 100644 --- a/docs/content/system-props.mdx +++ b/docs/content/system-props.mdx @@ -4,11 +4,18 @@ title: System Props import {PropsList, COMMON, LAYOUT, BORDER, TYPOGRAPHY, FLEX, POSITION, GRID} from '../components' + + +System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead. + + + Primer React components utilize what we call "system props" to apply a standard set of props to each component. Using [styled-system](https://github.com/jxnblk/styled-system), groups of props are automatically applied to each component. Most components get the `COMMON` set of props which give the component access to color and space props (margin, padding, color and background color). These groups correspond to the `color` and `space` functions from `styled-system` which can be referenced in the styled system [table of style functions](https://github.com/jxnblk/styled-system/blob/master/docs/table.md#core). To check which system props each component includes, check the documentation for that component. ### The `as` prop + All Primer React components have access to the `as` prop, provided by [styled-components](https://www.styled-components.com/docs/api#as-polymorphic-prop). We use the `as` prop to render a component with the styles of the passed component in `as`, but with the system props of the base component. For example, if you wanted to add some flex utilities to the `Text` component, you could do: @@ -17,15 +24,14 @@ For example, if you wanted to add some flex utilities to the `Text` component, y Hello! ``` - ### System Prop Categories -| Category | Included Props | styled-system docs | -|-----|--------|--------| -| `COMMON`| | [styled-system core docs](https://github.com/jxnblk/styled-system/blob/master/docs/table.md#core) | -| `TYPOGRAPHY`| | [styled-system typography docs](https://github.com/jxnblk/styled-system/blob/master/docs/table.md#typography) | -| `BORDER`| | [styled-system border docs](https://github.com/jxnblk/styled-system/blob/master/docs/table.md#border) | -| `LAYOUT` | | [styled-system layout docs](https://github.com/jxnblk/styled-system/blob/master/docs/table.md#layout)
[styled-system misc docs](https://github.com/jxnblk/styled-system/blob/master/docs/table.md#misc) | -| `POSITION` | | [styled-system position docs](https://github.com/jxnblk/styled-system/blob/master/docs/table.md#position) -| `FLEX` | | [styled-system flexbox docs](https://github.com/jxnblk/styled-system/blob/master/docs/table.md#flexbox) | -| `GRID` | | [styled-system grid docs](https://github.com/styled-system/styled-system/blob/master/docs/table.md#grid-layout) | +| Category | Included Props | styled-system docs | +| ------------ | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `COMMON` | | [styled-system core docs](https://github.com/jxnblk/styled-system/blob/master/docs/table.md#core) | +| `TYPOGRAPHY` | | [styled-system typography docs](https://github.com/jxnblk/styled-system/blob/master/docs/table.md#typography) | +| `BORDER` | | [styled-system border docs](https://github.com/jxnblk/styled-system/blob/master/docs/table.md#border) | +| `LAYOUT` | | [styled-system layout docs](https://github.com/jxnblk/styled-system/blob/master/docs/table.md#layout)
[styled-system misc docs](https://github.com/jxnblk/styled-system/blob/master/docs/table.md#misc) | +| `POSITION` | | [styled-system position docs](https://github.com/jxnblk/styled-system/blob/master/docs/table.md#position) | +| `FLEX` | | [styled-system flexbox docs](https://github.com/jxnblk/styled-system/blob/master/docs/table.md#flexbox) | +| `GRID` | | [styled-system grid docs](https://github.com/styled-system/styled-system/blob/master/docs/table.md#grid-layout) | diff --git a/jest.config.js b/jest.config.js index 119f24e2909..15b0dbfef92 100644 --- a/jest.config.js +++ b/jest.config.js @@ -5,5 +5,5 @@ module.exports = { collectCoverage: true, collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}', '!src/stories/**'], setupFilesAfterEnv: ['/src/utils/test-matchers.tsx', '/src/utils/test-deprecations.tsx'], - testRegex: '/src/__tests__/.*\\.[jt]sx?$' + testRegex: '/(src|codemods)/__tests__/.*\\.[jt]sx?$' }