Skip to content

add next entry point and move Tooltip there #4225

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

Closed
wants to merge 2 commits into from
Closed
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
4 changes: 2 additions & 2 deletions docs/content/drafts/Tooltip.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
componentId: tooltip_v2
title: Tooltip v2
status: Draft
source: https://github.com/primer/react/blob/main/src/drafts/Tooltip.tsx
source: https://github.com/primer/react/blob/main/src/next/Tooltip.tsx
---

import data from '../../../src/drafts/Tooltip/Tooltip.docs.json'
import data from '../../../src/next/Tooltip/Tooltip.docs.json'

The Tooltip component is used to add context to interactive elements on the page.

Expand Down
20 changes: 10 additions & 10 deletions e2e/components/Tooltip--experimental.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ test.describe('Tooltip--experimental', () => {
test.describe(theme, () => {
test('default @vrt', async ({page}) => {
await visit(page, {
id: 'drafts-components-tooltip--default',
id: 'next-components-tooltip--default',
globals: {
colorScheme: theme,
},
Expand All @@ -26,7 +26,7 @@ test.describe('Tooltip--experimental', () => {

test('axe @aat', async ({page}) => {
await visit(page, {
id: 'drafts-components-tooltip--default',
id: 'next-components-tooltip--default',
globals: {
colorScheme: theme,
},
Expand All @@ -42,7 +42,7 @@ test.describe('Tooltip--experimental', () => {
test.describe(theme, () => {
test('default @vrt', async ({page}) => {
await visit(page, {
id: 'drafts-components-tooltip-features--anchor-has-margin',
id: 'next-components-tooltip-features--anchor-has-margin',
globals: {
colorScheme: theme,
},
Expand All @@ -60,7 +60,7 @@ test.describe('Tooltip--experimental', () => {

test('axe @aat', async ({page}) => {
await visit(page, {
id: 'drafts-components-tooltip-features--anchor-has-margin',
id: 'next-components-tooltip-features--anchor-has-margin',
globals: {
colorScheme: theme,
},
Expand All @@ -76,7 +76,7 @@ test.describe('Tooltip--experimental', () => {
test.describe(theme, () => {
test('default @vrt', async ({page}) => {
await visit(page, {
id: 'drafts-components-tooltip-features--calculated-direction',
id: 'next-components-tooltip-features--calculated-direction',
globals: {
colorScheme: theme,
},
Expand All @@ -94,7 +94,7 @@ test.describe('Tooltip--experimental', () => {

test('axe @aat', async ({page}) => {
await visit(page, {
id: 'drafts-components-tooltip-features--calculated-direction',
id: 'next-components-tooltip-features--calculated-direction',
globals: {
colorScheme: theme,
},
Expand All @@ -110,7 +110,7 @@ test.describe('Tooltip--experimental', () => {
test.describe(theme, () => {
test('default @vrt', async ({page}) => {
await visit(page, {
id: 'drafts-components-tooltip-features--icon-button-with-description',
id: 'next-components-tooltip-features--icon-button-with-description',
globals: {
colorScheme: theme,
},
Expand All @@ -128,7 +128,7 @@ test.describe('Tooltip--experimental', () => {

test('axe @aat', async ({page}) => {
await visit(page, {
id: 'drafts-components-tooltip-features--icon-button-with-description',
id: 'next-components-tooltip-features--icon-button-with-description',
globals: {
colorScheme: theme,
},
Expand All @@ -144,7 +144,7 @@ test.describe('Tooltip--experimental', () => {
test.describe(theme, () => {
test('default @vrt', async ({page}) => {
await visit(page, {
id: 'drafts-components-tooltip-features--label-type',
id: 'next-components-tooltip-features--label-type',
globals: {
colorScheme: theme,
},
Expand All @@ -162,7 +162,7 @@ test.describe('Tooltip--experimental', () => {

test('axe @aat', async ({page}) => {
await visit(page, {
id: 'drafts-components-tooltip-features--label-type',
id: 'next-components-tooltip-features--label-type',
globals: {
colorScheme: theme,
},
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
"import": "./lib-esm/deprecated/index.js",
"require": "./lib/deprecated/index.js"
},
"./next": {
"import": "./lib-esm/next/index.js",
"require": "./lib/next/index.js"
},
"./lib-esm/*": {
"import": [
"./lib-esm/*.js",
Expand Down
3 changes: 3 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ const input = new Set([
// "./deprecated"
'src/deprecated/index.ts',

// "./next"
'src/next/index.ts',

// Make sure all members are exported
'src/constants.ts',

Expand Down
18 changes: 9 additions & 9 deletions script/generate-e2e-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -1415,39 +1415,39 @@ const components = new Map([
},
],
[
'Tooltip--experimental',
'Tooltip--next',
{
stories: [
{
id: 'drafts-components-tooltip--default',
id: 'next-components-tooltip--default',
name: 'Default',
},
{
id: 'drafts-components-tooltip-features--anchor-has-margin',
id: 'next-components-tooltip-features--anchor-has-margin',
name: 'Anchor Has Margin',
},
{
id: 'drafts-components-tooltip-features--calculated-direction',
id: 'next-components-tooltip-features--calculated-direction',
name: 'Calculated Direction',
},
{
id: 'drafts-components-tooltip-features--icon-button-with-description',
id: 'next-components-tooltip-features--icon-button-with-description',
name: 'Icon Button With Description',
},
{
id: 'drafts-components-tooltip-features--label-type',
id: 'next-components-tooltip-features--label-type',
name: 'Label Type',
},
{
id: 'drafts-components-tooltip-features--multiline-text',
id: 'next-components-tooltip-features--multiline-text',
name: 'Multiline Text',
},
{
id: 'drafts-components-tooltip-features--on-action-menu-anchor',
id: 'next-components-tooltip-features--on-action-menu-anchor',
name: 'On Action Menu Anchor',
},
{
id: 'drafts-components-tooltip-examples--files-page',
id: 'next-components-tooltip-examples--files-page',
name: 'Files Page Example',
},
],
Expand Down
2 changes: 1 addition & 1 deletion src/ActionList/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import styled from 'styled-components'
import {AlertIcon} from '@primer/octicons-react'
import Box, {BoxProps} from '../Box'
import {Tooltip, TooltipProps} from '../drafts/Tooltip/Tooltip'
import {Tooltip, TooltipProps} from '../next/Tooltip/Tooltip'
import {useId} from '../hooks/useId'
import {useSlots} from '../hooks/useSlots'
import sx, {BetterSystemStyleObject, merge, SxProp} from '../sx'
Expand Down
2 changes: 1 addition & 1 deletion src/ActionMenu/ActionMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {Button, ButtonProps} from '../Button'
import {useId} from '../hooks/useId'
import {MandateProps} from '../utils/types'
import {ForwardRefComponent as PolymorphicForwardRefComponent} from '../utils/polymorphic'
import {Tooltip} from '../drafts/Tooltip/Tooltip'
import {Tooltip} from '../next/Tooltip/Tooltip'

export type MenuContextProps = Pick<
AnchoredOverlayProps,
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/ActionMenu.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {axe} from 'jest-axe'
import React from 'react'
import theme from '../theme'
import {ActionMenu, ActionList, BaseStyles, ThemeProvider, SSRProvider, Tooltip, Button} from '..'
import {Tooltip as TooltipV2} from '../drafts/Tooltip/Tooltip'
import {Tooltip as TooltipV2} from '../next/Tooltip/Tooltip'
import {behavesAsComponent, checkExports} from '../utils/testing'
import {SingleSelect} from '../ActionMenu/ActionMenu.features.stories'
import {MixedSelection} from '../ActionMenu/ActionMenu.examples.stories'
Expand Down
14 changes: 14 additions & 0 deletions src/__tests__/exports.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,20 @@ describe('@primer/react/deprecated', () => {
})
})

describe('@primer/react/next', () => {
it('should not update exports without a semver change', async () => {
const exports = project.getEntrypointExports(path.join(ROOT_DIR, 'src', 'next', 'index.ts'))
expect(
exports.map(exportInfo => {
if (exportInfo.type === 'type') {
return `type ${exportInfo.identifier}`
}
return exportInfo.identifier
}),
).toMatchSnapshot()
})
})

interface Project {
getEntrypointExports(filepath: string): Array<EntrypointExport>
}
Expand Down
3 changes: 2 additions & 1 deletion src/drafts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,5 @@ export type {
NavListDividerProps,
} from '../NavList'
export * from './SelectPanel2'
export * from './Tooltip'
// We will need to remove this in the next major release
export * from '../next/Tooltip'
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
import {default as VisuallyHidden} from '../../_VisuallyHidden'

export default {
title: 'Drafts/Components/Tooltip/Examples',
title: 'Next/Components/Tooltip/Examples',
component: Tooltip,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {Tooltip} from './Tooltip'
import {SearchIcon, BookIcon, CheckIcon, TriangleDownIcon, GitBranchIcon} from '@primer/octicons-react'

export default {
title: 'Drafts/Components/Tooltip/Features',
title: 'Next/Components/Tooltip/Features',
component: Tooltip,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {Tooltip} from './Tooltip'
import {Meta, StoryFn} from '@storybook/react'

export default {
title: 'Drafts/Components/Tooltip/Playground',
title: 'Next/Components/Tooltip/Playground',
component: Tooltip,

args: {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {Tooltip, TooltipProps} from '../Tooltip'
import {checkStoriesForAxeViolations} from '../../../utils/testing'
import {render as HTMLRender} from '@testing-library/react'
import theme from '../../../theme'
import {Button, IconButton, ActionMenu, ActionList, ThemeProvider, SSRProvider, BaseStyles} from '../../../'
import {Button, IconButton, ActionMenu, ActionList, ThemeProvider, SSRProvider, BaseStyles} from '../../..'
import {XIcon} from '@primer/octicons-react'

const TooltipComponent = (props: Omit<TooltipProps, 'text'> & {text?: string}) => (
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions src/next/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'use client'

export * from './Tooltip'