From 02a2a2bf0b02e0c2f9a09351eefbe91f9370e210 Mon Sep 17 00:00:00 2001 From: Owen Niblock Date: Wed, 8 May 2024 17:39:26 +0100 Subject: [PATCH] Export things we need for CommentEditor (#4513) * Export things we need for CommentEditor * Add changeset * Update snapshot * Remove ComponentProps export and use React.ComponentProps in dotcom * Remove the bits of ComponentProps --- .changeset/tiny-ghosts-notice.md | 5 +++++ packages/react/src/RelativeTime/RelativeTime.tsx | 2 +- .../react/src/__tests__/__snapshots__/exports.test.ts.snap | 1 + packages/react/src/drafts/TabPanels/TabPanels.tsx | 2 +- packages/react/src/index.ts | 3 +++ .../src/utils/{custom-element.ts => create-component.ts} | 0 6 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 .changeset/tiny-ghosts-notice.md rename packages/react/src/utils/{custom-element.ts => create-component.ts} (100%) diff --git a/.changeset/tiny-ghosts-notice.md b/.changeset/tiny-ghosts-notice.md new file mode 100644 index 00000000000..bc390eb0811 --- /dev/null +++ b/.changeset/tiny-ghosts-notice.md @@ -0,0 +1,5 @@ +--- +'@primer/react': minor +--- + +Exports createComponent diff --git a/packages/react/src/RelativeTime/RelativeTime.tsx b/packages/react/src/RelativeTime/RelativeTime.tsx index 12eb1776669..b33e8d79a45 100644 --- a/packages/react/src/RelativeTime/RelativeTime.tsx +++ b/packages/react/src/RelativeTime/RelativeTime.tsx @@ -1,7 +1,7 @@ import React from 'react' import {RelativeTimeElement} from '@github/relative-time-element' import type {ComponentProps} from '../utils/types' -import {createComponent} from '../utils/custom-element' +import {createComponent} from '../utils/create-component' const RelativeTimeComponent = createComponent(RelativeTimeElement, 'relative-time') diff --git a/packages/react/src/__tests__/__snapshots__/exports.test.ts.snap b/packages/react/src/__tests__/__snapshots__/exports.test.ts.snap index c29dc006f94..4dbaf3f35d0 100644 --- a/packages/react/src/__tests__/__snapshots__/exports.test.ts.snap +++ b/packages/react/src/__tests__/__snapshots__/exports.test.ts.snap @@ -58,6 +58,7 @@ exports[`@primer/react should not update exports without a semver change 1`] = ` "type ConfirmationDialogProps", "CounterLabel", "type CounterLabelProps", + "createComponent", "Details", "type DetailsProps", "Dialog", diff --git a/packages/react/src/drafts/TabPanels/TabPanels.tsx b/packages/react/src/drafts/TabPanels/TabPanels.tsx index 85bd5de263b..ba73e72783b 100644 --- a/packages/react/src/drafts/TabPanels/TabPanels.tsx +++ b/packages/react/src/drafts/TabPanels/TabPanels.tsx @@ -4,7 +4,7 @@ import React from 'react' import styled from 'styled-components' import {get} from '../../constants' import {TabContainerElement} from '@github/tab-container-element' -import {createComponent} from '../../utils/custom-element' +import {createComponent} from '../../utils/create-component' import sx, {type SxProp} from '../../sx' import type {ComponentProps} from '../../utils/types' import getGlobalFocusStyles from '../../internal/utils/getGlobalFocusStyles' diff --git a/packages/react/src/index.ts b/packages/react/src/index.ts index 16c9d5c7e86..e3148feb8f4 100644 --- a/packages/react/src/index.ts +++ b/packages/react/src/index.ts @@ -45,6 +45,9 @@ export {useRefObjectAsForwardedRef} from './hooks/useRefObjectAsForwardedRef' export {useResizeObserver} from './hooks/useResizeObserver' export {useResponsiveValue} from './hooks/useResponsiveValue' +// Utils +export {createComponent} from './utils/create-component' + // Components export {default as Radio} from './Radio' export type {RadioProps} from './Radio' diff --git a/packages/react/src/utils/custom-element.ts b/packages/react/src/utils/create-component.ts similarity index 100% rename from packages/react/src/utils/custom-element.ts rename to packages/react/src/utils/create-component.ts