diff --git a/.changeset/funny-ears-add.md b/.changeset/funny-ears-add.md new file mode 100644 index 00000000000..314f71b9e02 --- /dev/null +++ b/.changeset/funny-ears-add.md @@ -0,0 +1,5 @@ +--- +"@primer/react": patch +--- + +Checkbox: `value` prop is now optional diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4c4f1d4cc64..ad5fc2c5e0f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,3 +29,6 @@ jobs: - name: Test run: npm run test + + - name: Type check + run: npm run test:type-check diff --git a/package.json b/package.json index a01da6a3276..6e9f3d5e1a2 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,7 @@ "lint:fix": "npm run lint -- --fix", "test": "jest", "test:update": "npm run test -- --updateSnapshot", + "test:type-check": "tsc --noEmit", "release": "npm run build && changeset publish", "size": "size-limit", "prepare": "husky install" diff --git a/src/Button/Button2.stories.tsx b/src/Button/Button2.stories.tsx index 033030ddb7d..2df7749e413 100644 --- a/src/Button/Button2.stories.tsx +++ b/src/Button/Button2.stories.tsx @@ -1,8 +1,8 @@ -import React, {useState, forwardRef} from 'react' -import {Button, ButtonProps, IconButton, LinkButton} from '.' -import {BaseStyles, ThemeProvider} from '..' +import {EyeClosedIcon, EyeIcon, SearchIcon, TriangleDownIcon, XIcon} from '@primer/octicons-react' import {Meta} from '@storybook/react' -import {XIcon, SearchIcon, EyeIcon, EyeClosedIcon, TriangleDownIcon, TriangleRightIcon} from '@primer/octicons-react' +import React, {useState} from 'react' +import {Button, ButtonProps, IconButton} from '.' +import {BaseStyles, ThemeProvider} from '..' import Box from '../Box' export default { @@ -186,52 +186,52 @@ export const disabledButton = ({...args}: ButtonProps) => { ) } -type ReactRouterLikeLinkProps = {to: string; children: React.ReactNode} -const ReactRouterLikeLink = forwardRef( - ({to, ...props}: {to: string; children: React.ReactNode}, ref) => { - // eslint-disable-next-line jsx-a11y/anchor-has-content - return - } -) +// type ReactRouterLikeLinkProps = {to: string; children: React.ReactNode} +// const ReactRouterLikeLink = forwardRef( +// ({to, ...props}: {to: string; children: React.ReactNode}, ref) => { +// // eslint-disable-next-line jsx-a11y/anchor-has-content +// return +// } +// ) -export const linkButton = ({...args}: ButtonProps) => { - return ( - <> - - - Link to Primer - - - - - Link to Primer - - - - - Link to Primer - - - - - Link to Primer - - - - - Link to Primer - - - - - Link to Primer - - - - - Link to Primer - - - - ) -} +// export const linkButton = ({...args}: ButtonProps) => { +// return ( +// <> +// +// +// Link to Primer +// +// +// +// +// Link to Primer +// +// +// +// +// Link to Primer +// +// +// +// +// Link to Primer +// +// +// +// +// Link to Primer +// +// +// +// +// Link to Primer +// +// +// +// +// Link to Primer +// +// +// +// ) +// } diff --git a/src/Checkbox.tsx b/src/Checkbox.tsx index d7aeb16090a..bbad54491ca 100644 --- a/src/Checkbox.tsx +++ b/src/Checkbox.tsx @@ -30,7 +30,7 @@ export type CheckboxProps = { * A unique value that is never shown to the user. * Used during form submission and to identify which checkbox inputs are selected */ - value: string + value?: string } & Exclude, 'value'> & SxProp diff --git a/src/PageLayout/PageLayout.stories.tsx b/src/PageLayout/PageLayout.stories.tsx index 50e66080990..93d41a0a459 100644 --- a/src/PageLayout/PageLayout.stories.tsx +++ b/src/PageLayout/PageLayout.stories.tsx @@ -1,7 +1,6 @@ import {Meta, Story} from '@storybook/react' import React from 'react' -import {Box, BranchName, Heading, Link, SideNav, StateLabel, TabNav, Text} from '..' -import {Button} from '../drafts' +import {Box, BranchName, Heading, Link, SideNav, StateLabel, TabNav, Text, Button} from '..' import {Placeholder} from '../Placeholder' import {PageLayout} from './PageLayout' diff --git a/src/Select.tsx b/src/Select.tsx index ac9cfeeaf02..25708efa576 100644 --- a/src/Select.tsx +++ b/src/Select.tsx @@ -3,8 +3,8 @@ import styled from 'styled-components' import {get} from './constants' import TextInputWrapper, {StyledWrapperProps} from './_TextInputWrapper' -type SelectProps = Omit< - Omit, 'size'> & Omit, +export type SelectProps = Omit< + Omit, 'size'> & Omit, 'multiple' | 'hasLeadingVisual' | 'hasTrailingVisual' | 'as' > @@ -42,7 +42,7 @@ const ArrowIndicator = styled(ArrowIndicatorSVG)` ` const Select = React.forwardRef( - ({children, disabled, placeholder, size, required, validationStatus, ref: _propsRef, ...rest}: SelectProps, ref) => ( + ({children, disabled, placeholder, size, required, validationStatus, ...rest}: SelectProps, ref) => ( - ) diff --git a/src/__tests__/deprecated/Label.types.test.tsx b/src/__tests__/deprecated/Label.types.test.tsx index dcfa2638521..a88a34a76ef 100644 --- a/src/__tests__/deprecated/Label.types.test.tsx +++ b/src/__tests__/deprecated/Label.types.test.tsx @@ -1,5 +1,5 @@ import React from 'react' -import Label from '../deprecated/Label' +import Label from '../../deprecated/Label' export function shouldAcceptCallWithNoProps() { return