From 55603ef45f2237bf08d5573d670fdae9574778ef Mon Sep 17 00:00:00 2001 From: Owen Niblock Date: Fri, 19 Apr 2024 12:56:44 +0100 Subject: [PATCH 1/5] Export things we need for CommentEditor --- packages/react/src/RelativeTime/RelativeTime.tsx | 2 +- packages/react/src/drafts/TabPanels/TabPanels.tsx | 2 +- packages/react/src/index.ts | 4 ++++ .../src/utils/{custom-element.ts => create-component.ts} | 0 4 files changed, 6 insertions(+), 2 deletions(-) rename packages/react/src/utils/{custom-element.ts => create-component.ts} (100%) 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/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..82c16df3c83 100644 --- a/packages/react/src/index.ts +++ b/packages/react/src/index.ts @@ -45,6 +45,10 @@ export {useRefObjectAsForwardedRef} from './hooks/useRefObjectAsForwardedRef' export {useResizeObserver} from './hooks/useResizeObserver' export {useResponsiveValue} from './hooks/useResponsiveValue' +// Utils +export {createComponent} from './utils/create-component' +export type {ComponentProps} from './utils/types/ComponentProps' + // 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 From 2e1bfe7a4e1d99dbc4d1d25a869fe4d96acd4bec Mon Sep 17 00:00:00 2001 From: Owen Niblock Date: Fri, 19 Apr 2024 12:58:20 +0100 Subject: [PATCH 2/5] Add changeset --- .changeset/tiny-ghosts-notice.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/tiny-ghosts-notice.md diff --git a/.changeset/tiny-ghosts-notice.md b/.changeset/tiny-ghosts-notice.md new file mode 100644 index 00000000000..bad36a26e54 --- /dev/null +++ b/.changeset/tiny-ghosts-notice.md @@ -0,0 +1,5 @@ +--- +'@primer/react': minor +--- + +Exports createComponent and ComponentProps From 92d7ec696317856dd5eaa9a8b12f57be46f24c8f Mon Sep 17 00:00:00 2001 From: Owen Niblock Date: Fri, 19 Apr 2024 13:12:31 +0100 Subject: [PATCH 3/5] Update snapshot --- packages/react/src/__tests__/__snapshots__/exports.test.ts.snap | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/react/src/__tests__/__snapshots__/exports.test.ts.snap b/packages/react/src/__tests__/__snapshots__/exports.test.ts.snap index 9030c26ae71..e9e0a50f3d8 100644 --- a/packages/react/src/__tests__/__snapshots__/exports.test.ts.snap +++ b/packages/react/src/__tests__/__snapshots__/exports.test.ts.snap @@ -54,10 +54,12 @@ exports[`@primer/react should not update exports without a semver change 1`] = ` "type CircleBadgeProps", "CircleOcticon", "type CircleOcticonProps", + "type ComponentProps", "ConfirmationDialog", "type ConfirmationDialogProps", "CounterLabel", "type CounterLabelProps", + "createComponent", "Details", "type DetailsProps", "Dialog", From 348904ab9ed15db7319d92acfe39c6760996b772 Mon Sep 17 00:00:00 2001 From: Owen Niblock Date: Wed, 1 May 2024 16:38:29 +0100 Subject: [PATCH 4/5] Remove ComponentProps export and use React.ComponentProps in dotcom --- packages/react/src/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/react/src/index.ts b/packages/react/src/index.ts index 82c16df3c83..e3148feb8f4 100644 --- a/packages/react/src/index.ts +++ b/packages/react/src/index.ts @@ -47,7 +47,6 @@ export {useResponsiveValue} from './hooks/useResponsiveValue' // Utils export {createComponent} from './utils/create-component' -export type {ComponentProps} from './utils/types/ComponentProps' // Components export {default as Radio} from './Radio' From 8fe6af5bf897e38c7cd3b58b181051df8a9e9cd4 Mon Sep 17 00:00:00 2001 From: Owen Niblock Date: Wed, 8 May 2024 17:28:37 +0100 Subject: [PATCH 5/5] Remove the bits of ComponentProps --- .changeset/tiny-ghosts-notice.md | 2 +- packages/react/src/__tests__/__snapshots__/exports.test.ts.snap | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.changeset/tiny-ghosts-notice.md b/.changeset/tiny-ghosts-notice.md index bad36a26e54..bc390eb0811 100644 --- a/.changeset/tiny-ghosts-notice.md +++ b/.changeset/tiny-ghosts-notice.md @@ -2,4 +2,4 @@ '@primer/react': minor --- -Exports createComponent and ComponentProps +Exports createComponent diff --git a/packages/react/src/__tests__/__snapshots__/exports.test.ts.snap b/packages/react/src/__tests__/__snapshots__/exports.test.ts.snap index 675aecf3b97..4dbaf3f35d0 100644 --- a/packages/react/src/__tests__/__snapshots__/exports.test.ts.snap +++ b/packages/react/src/__tests__/__snapshots__/exports.test.ts.snap @@ -54,7 +54,6 @@ exports[`@primer/react should not update exports without a semver change 1`] = ` "type CircleBadgeProps", "CircleOcticon", "type CircleOcticonProps", - "type ComponentProps", "ConfirmationDialog", "type ConfirmationDialogProps", "CounterLabel",