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

Update semantic border-radius token layer #10669

Merged
merged 4 commits into from
Sep 28, 2023
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
6 changes: 6 additions & 0 deletions .changeset/quick-icons-joke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@shopify/polaris': major
'@shopify/polaris-tokens': minor
---

Added `border-radius` semantic layer
12 changes: 6 additions & 6 deletions polaris-react/src/components/Box/Box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type {
ColorBackgroundAlias,
ColorBorderAlias,
BorderWidthScale,
BorderRadiusScale,
BorderRadiusAliasOrScale,
ShadowAlias,
SpaceScale,
} from '@shopify/polaris-tokens';
Expand Down Expand Up @@ -39,15 +39,15 @@ export interface BoxProps extends React.AriaAttributes {
/** Border style */
borderStyle?: LineStyles;
/** Border radius */
borderRadius?: BorderRadiusScale;
borderRadius?: BorderRadiusAliasOrScale;
/** Vertical end horizontal start border radius */
borderEndStartRadius?: BorderRadiusScale;
borderEndStartRadius?: BorderRadiusAliasOrScale;
/** Vertical end horizontal end border radius */
borderEndEndRadius?: BorderRadiusScale;
borderEndEndRadius?: BorderRadiusAliasOrScale;
/** Vertical start horizontal start border radius */
borderStartStartRadius?: BorderRadiusScale;
borderStartStartRadius?: BorderRadiusAliasOrScale;
/** Vertical start horizontal end border radius */
borderStartEndRadius?: BorderRadiusScale;
borderStartEndRadius?: BorderRadiusAliasOrScale;
/** Border width */
borderWidth?: BorderWidthScale;
/** Vertical start border width */
Expand Down
4 changes: 2 additions & 2 deletions polaris-react/src/components/Card/Card.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type {
BreakpointsAlias,
ColorBackgroundAlias,
BorderRadiusScale,
BorderRadiusAliasOrScale,
SpaceScale,
} from '@shopify/polaris-tokens';
import React from 'react';
Expand Down Expand Up @@ -38,7 +38,7 @@ export const Card = ({
roundedAbove,
}: CardProps) => {
const breakpoints = useBreakpoints();
const defaultBorderRadius: BorderRadiusScale = '300';
const defaultBorderRadius: BorderRadiusAliasOrScale = '300';

let hasBorderRadius = !roundedAbove;

Expand Down
7 changes: 5 additions & 2 deletions polaris-react/src/components/ShadowBevel/ShadowBevel.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import React from 'react';
import type {BorderRadiusScale, ShadowAlias} from '@shopify/polaris-tokens';
import type {
BorderRadiusAliasOrScale,
ShadowAlias,
} from '@shopify/polaris-tokens';

import {getResponsiveValue} from '../../utilities/css';
import type {ResponsiveProp} from '../../utilities/css';
Expand All @@ -12,7 +15,7 @@ export interface ShadowBevelProps {
/** The box-shadow applied to the root element. */
boxShadow: ShadowAlias;
/** The border-radius applied to both the root and pseudo elements. */
borderRadius: BorderRadiusScale;
borderRadius: BorderRadiusAliasOrScale;
/** The z-index applied to the pseudo element. */
zIndex?: string;
/**
Expand Down
7 changes: 5 additions & 2 deletions polaris-react/src/components/Tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import React, {useEffect, useState, useRef, useCallback, useId} from 'react';
import type {BorderRadiusScale, SpaceScale} from '@shopify/polaris-tokens';
import type {
BorderRadiusAliasOrScale,
SpaceScale,
} from '@shopify/polaris-tokens';

import {Portal} from '../Portal';
import {useEphemeralPresenceManager} from '../../utilities/ephemeral-presence-manager';
Expand All @@ -13,7 +16,7 @@ import styles from './Tooltip.scss';

export type Width = 'default' | 'wide';
export type Padding = 'default' | Extract<SpaceScale, '400'>;
export type BorderRadius = Extract<BorderRadiusScale, '100' | '200'>;
export type BorderRadius = Extract<BorderRadiusAliasOrScale, '100' | '200'>;

export interface TooltipProps {
/** The element that will activate to tooltip */
Expand Down
2 changes: 2 additions & 0 deletions polaris-tokens/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export type {
BorderTokenGroup,
BorderTokenName,
BorderRadiusScale,
BorderRadiusAlias,
BorderRadiusAliasOrScale,
BorderWidthScale,
} from './themes/base/border';

Expand Down
7 changes: 5 additions & 2 deletions polaris-tokens/src/themes/base/border.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export type BorderRadiusScale =
| '400'
| '500'
| '750'
| 'full'
| '05'
| '1'
| '2'
Expand All @@ -27,6 +26,10 @@ export type BorderRadiusScale =

type BorderWidthScaleExperimental = Experimental<'1' | '2'>;

export type BorderRadiusAlias = 'full';

export type BorderRadiusAliasOrScale = BorderRadiusAlias | BorderRadiusScale;

export type BorderWidthScale =
| '0165'
| '025'
Expand All @@ -40,7 +43,7 @@ export type BorderWidthScale =
| BorderWidthScaleExperimental;

export type BorderTokenName =
| `border-radius-${BorderRadiusScale}`
| `border-radius-${BorderRadiusAliasOrScale}`
| `border-width-${BorderWidthScale}`;

export type BorderTokenGroup = {
Expand Down
Loading