Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 5 additions & 0 deletions .changeset/great-spies-deliver.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
---
'@primer/react': major
---

Remove deprecated `extralarge` variant from `Token` and `TextInputWithToken` component
6 changes: 2 additions & 4 deletions src/TextInputWithTokens/TextInputWithTokens.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -60,8 +60,7 @@ const overflowCountFontSizeMap: Record<TokenSizeKeys, number> = {
small: 0,
medium: 1,
large: 1,
extralarge: 2,
xlarge: 2, // will eventually replace "extralarge" per this ADR: https://github.com/github/primer/blob/main/adrs/2022-02-09-size-naming-guidelines.md
xlarge: 2,
}

// using forwardRef is important so that other components (ex. Autocomplete) can use the ref
Expand DownExpand Up@@ -240,8 +239,7 @@ function TextInputWithTokensInnerComponent<TokenComponentType extends AnyReactCo
small: 'small',
medium: 'small',
large: 'medium',
extralarge: 'medium',
xlarge: 'medium', // will eventually replace "extralarge" per this ADR: https://github.com/github/primer/blob/main/adrs/2022-02-09-size-naming-guidelines.md
xlarge: 'medium',
}
const showLeadingLoadingIndicator =
loading && (loaderPosition === 'leading' || Boolean(LeadingVisual && loaderPosition !== 'trailing'))
Expand Down
2 changes: 1 addition & 1 deletion src/Token/Token.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,7 @@ const LeadingVisualContainer: React.FC<React.PropsWithChildren<Pick<TokenBasePro
sx={{
flexShrink: 0,
lineHeight: 0,
marginRight: size && ['large', 'extralarge', 'xlarge'].includes(size) ? 2 : 1,
marginRight: size && ['large', 'xlarge'].includes(size) ? 2 : 1,
}}
>
{children}
Expand Down
11 changes: 2 additions & 9 deletions src/Token/TokenBase.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,19 +5,13 @@ import {get} from '../constants'
import sx, {SxProp} from '../sx'
import {ForwardRefComponent as PolymorphicForwardRefComponent} from '../utils/polymorphic'

// TODO: remove invalid "extralarge" size name in next breaking change
/** @deprecated 'extralarge' to be removed to align with size naming ADR https://github.com/github/primer/blob/main/adrs/2022-02-09-size-naming-guidelines.md **/
type ExtraLarge = 'extralarge'
export type TokenSizeKeys = 'small' | 'medium' | 'large' | 'xlarge' | ExtraLarge

const xlargeSize = '32px'
export type TokenSizeKeys = 'small' | 'medium' | 'large' | 'xlarge'

export const tokenSizes: Record<TokenSizeKeys, string> = {
small: '16px',
medium: '20px',
large: '24px',
extralarge: xlargeSize,
xlarge: xlargeSize,
xlarge: '32px',
}

export const defaultTokenSize: TokenSizeKeys = 'medium'
Expand DownExpand Up@@ -112,7 +106,6 @@ const variants = variant<
paddingLeft: 2,
paddingRight: 2,
},
extralarge: xlargeVariantStyles,
xlarge: xlargeVariantStyles,
},
})
Expand Down
6 changes: 0 additions & 6 deletions src/Token/_RemoveTokenButton.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,11 +28,6 @@ const variants = variant<{height: string; width: string}, TokenSizeKeys>({
height: tokenSizes.large,
width: tokenSizes.large,
},
extralarge: {
height: tokenSizes.extralarge,
width: tokenSizes.extralarge,
},
// xlarge will eventually replace "extralarge" per this ADR: https://github.com/github/primer/blob/main/adrs/2022-02-09-size-naming-guidelines.md
xlarge: {
height: tokenSizes.xlarge,
width: tokenSizes.xlarge,
Expand DownExpand Up@@ -62,7 +57,6 @@ const StyledTokenButton = styled.span<TokenButtonProps & SxProp>`
${props => {
switch (props.size) {
case 'large':
case 'extralarge':
case 'xlarge':
return css`
margin-left: ${get('space.2')};
Expand Down
Loading